Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong comment in freertos-blinky.cpp example #79

Open
kyab opened this issue Jul 13, 2013 · 1 comment
Open

Wrong comment in freertos-blinky.cpp example #79

kyab opened this issue Jul 13, 2013 · 1 comment

Comments

@kyab
Copy link

kyab commented Jul 13, 2013

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
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants