We have found a serious architectural problem with the AVR implementation of FreeRTOS when running on an XMega (a 128A1, in our case) and using preemption.
As you may know, the XMega allows each interrupt to be assigned a priority of low, medium, or high. The problem is that the FreeRTOS task switcher does not take the interrupt level into account when it switches context. If the system is in the middle of, let's say, a medium-level interrupt, the current implementation will bestow that interrupt level on to whatever task it may decide to switch to. That implies that the task is now running at medium interrupt level, and will stay that way until it yields or is preempted out. :shock:
Also, the ISR that was running doesn't complete until the original task comes around.
We found this out when the real time clock task mysteriously died after turning on a particular ISR.
We're thinking of ways around the problem, but for the moment the workaround is to turn off preemption.
Be careful with these new interrupt levels. There be dragons here!
Just wanted to let folks know.
Stu