saiberion wrote on Tuesday, July 23, 2013:
I was updating a software project for an AT91SAM7S256 to add some new features amd emcountered a really strange problem.
The software initialised some necessary hardware and creates an Init Task with highest priority for further initialisation where scheduler commands are needed. In this task other tasks are created that should only start running after the init task is done.
Now I ran into a really strange behaviour.
From the init task I call a function that creates a task located in file a.c and es soon as the init function ends with vTaskDelete(NULL) the software locks ups or somehow gets cought in a reboot loop.
The really strange part is, if I copy the code of the task function to main.c everything works as expected, I can even start multiple instances to the same task code. It is also possible to move the task code to another file b.c and it still works. I’m puzzled why task code leads to undefined behaviour if it is located in a.c.
FreeRTOS Version 7.2.0 and 7.5.0
Yagarto Toolchain: BU 2.20.1; GCC 4.5.0; NL 1.18.0; GDB 7.1
Any ideas why this is happening? So far I only found out that it that it happens at the end of the context switch with FreeRTOS function vTaskSwitchContext() and for some unknown reason the task function in a.c results in different disassembly output than it’s exact copies in b.c and main.c
At the moment I’m stripping down the project to see how long I can reproduce this behaviour and also to maybe upload the project code.