Strange lock ups

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.

rtel wrote on Tuesday, July 23, 2013:

If the code is the same, but only works when it is included from a file with one name but not another, then my first thought is that it can only be something to do with the build process.  Is it possible that you are supplying different command line options to different files?  Maybe a.c is being built in thumb mode and all the others in ARM mode and you don’t have the interworking option set?  (normally you can mix ARM and thumb mode tasks, but you have to tell the compiler you intend doing that)


saiberion wrote on Tuesday, July 23, 2013:

Up until a few minutes I was sure that all files were compiled with the same parameters, but my Makefile had a missing two-liner for the added source file.

So, my bad, everything is working fine now.
It probably was as you said that this file was not built in thumb mode because make had to guess the build parameters.