I am using FreeRTOS with Cortex M3 core. The system has 3 interrupt and one task. All the interrupts set a semaphore to wake up this task. One interrupt has higher preemption priority than other two. this means it can interrupt other two interrupts.
The program runs great for hours!!!
Then all of a sudden it stop working normally. The ISRs set the semaphore but the task is not waken up. Thus semaphore remains always set.
1. it was found that the semaphore given from ISR routine expected that the routine could never be interrupted as it was called from ISR. But this is false in case of cortex-m3. It could be preempted. So i disabled the interrupt for this routine.
2. It was found then that the task which was supposed to wakeup is already in the readyList but the topReadyListPriority was somehow turned to 0. As the context switching routine doesnt scan through whole radyList but just wakeup the first task it finds in readyList having the priority of topReadyListPriority, our task is never been called. To overcome this problem i set the topReadyListPriority to be highestTaskPriority so that contextswitch routine scans the whole ready list. In other word i remove the optimization and so whole readyList is always scaned through to find the highest priority task.
Now my program runs for more hours. but still there is problem.
3. It was then found that the task is not more in readyList and the semaphore to which it blocks is already set.
I have inserted lots of assertions in the freeRTOS source files but couldnt find anything.
ANY SUGGESTION WILL BE HIGHLY APPRECIATED