I been porting freeRTOS to the ARM9 core of a Texas Instruments OMAP L138 and the closest offical port to what i wanted was the ARM Cortex R4 port for Code Composer Studio running on a RM48 chip.
After a day of hunting down all the problems i finally got my port working, then as i was playing around with it some i noticed some strange effects where it stopped task switching permanently. The problem kept happening when i tried to run 2 tasks at the same priority level but one contained nothing but an infinite loop with no delays, also later found out the infinite loop task had to be created last in the main sub. I was suspecting my interrupts started misbehaving again so spent a afternoon tracking down what it could have been.
Turns out the problem is in the way ulCriticalNesting variable was being handled. I did not realize the kernel boots it self in permanent critical section protection (would be silly not to do that now that i see it). But what happens in the routine xPortStartScheduler(void) is variable ulCriticalNesting gets set to 0 to make sure the first task run has no critical nesting as it enters, BUT this is not enough! The check for this being 0 is performed in vPortExitCritical( void ) so the first task is entered in critical mode, this means preemptive ticks can’t happen! This bug fixes it self when you call any sort of RTOS function like delay as that contains the vPortExitCritical( void ) call.
I have fixed it by setting nesting ulCriticalNesting to 1 instead and then calling vPortExitCritical( void ). I know very few applications will trigger this bug, but it left me running in circles quite a bit trying to find it because i was looking for it at all the wrong places.I already saw one other forum user have very similar tread switching lockup happen on a PIC.
You guys might want to do something about it if it really is a bug (I have not tested the original port as i only have the hardware to run my own port) The port i found this in came in the official FreeRTOS V7.5.2 release, i have not checked any other ports for this tho.