leaflabs / libmaple

[INACTIVE] C and C++ library for STM32 ARM Cortex-M3 development boards.
http://leaflabs.com/docs/libmaple.html
Other
304 stars 218 forks source link

Wrong comment in freertos-blinky.cpp example #79

Open kyab opened 11 years ago

kyab commented 11 years ago

I think loop() never reaches in this example. Maybe some other task named "background" should be introduces.

void setup() {
    // initialize the digital pin as an output:
    pinMode(BOARD_LED_PIN, OUTPUT);

    xTaskCreate(vLEDFlashTask,
                (signed portCHAR *)"Task1",
                configMINIMAL_STACK_SIZE,
                NULL,
                tskIDLE_PRIORITY + 2,
                NULL);
    vTaskStartScheduler();

    // Will not get here unless a task calls vTaskEndScheduler ()
}

void loop() {
   //wrong! never reached 
   // Insert background code here
}

// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated objects that need libmaple may fail.
__attribute__((constructor)) void premain() {
    init();
}

int main(void) {
    setup();

    while (true) {
        loop();
    }
    return 0;
}
bnewbold commented 11 years ago

@nis, can you confirm?

kyab, neither mbolivar nor I wrote this example; if you test your assumption and submit a pull request we'll probably accept it.