I have two tasks that are mutually exclusive front ends for a piece of embedded software.
One of the tasks is initially created by another task.
When this new task receives a given command, it creates the other task and deletes itself.
When I do this the code seems to restart at the function being run at the time that the first task was deleted.
Task 1 creats task 2, then idles
Task 2 later receives a command which starts task 3, task 2 then kills itself with vTaskDelete(NULL).
Task 3 later receives a command which starts task 2, task 3 then kills itself with vTaskDelete(NULL). But it seems that task 2 then immediately suspends or yields to the now dead task 3.
The same function is called by task 1, 2 and 3 for creating and deleting tasks, 2 and 3 are created with the same priority.
I can’t trace what exactly happens as it happens inside the RTOS kernel which the debugger (insight/gdb) has problems with tracing.
I thought perhaps task 2, when being re-created is resuming at the last function it was running when it was killed, which is the single task change function.
What other mechanisms can I use to trace the problem?
Using FreeRTOS v4.0.4 on an LPC/ARM7, is this a known problem? Will updating to a newer FreeRTOS solve it? (so far avoided this as it may cause a lot more work)