bsder wrote on Monday, February 08, 2010:
Taking these in reverse order:
Why would you call vTaskStartScheduler() without creating at least one task first?
This was just to see what vTaskStartScheduler would do when faced with no tasks. I was looking to see if the exception would fire even with no tasks. It does not, so the data structures are consistent even with no tasks initially. And vTaskStartScheduler() sits in an infinite loop. I am a bit surprised by that-I would have expected it to simply return.
Why would the tasks terminate?
In my case, it was not intentional. I had a bug in my tasks that was causing them to terminate. The *PROBLEM* was that I couldn’t diagnose that my tasks were terminating because FreeRTOS caused that BUS ERROR(IFETCH) exception which smashed any useful diagnostic information.
Presumably, something doesn’t clean up properly when all tasks terminate. I suspect that there is an old stack lying around or a NULL pointer in some scheduling queue that gets followed.
This gives me some concern because I am going to want to be able to use a bootloader to overwrite the flash on this at some point. It would be nice to have a clean way of shutting down FreeRTOS, moving back to a small bootloader, updating the flash, and then reactivating FreeRTOS.