Context Switching Problem??

Hi…. Just wondering if anyone has any insight into my problem…. Ive tested FreeRTOS working on a samsung s344b0x arm7 processor and got it working…. my problem now is that i start the scheduler and the first thread executes, and i think that there is a problem when it switches context , i tried increasing the stack sizes by a lot but the problem still happens, what i’m wondering is how to check that a context switch is happening properly, i.e. all the correct bits are getting pushed and popped….. ive been checking (pxCurrentTCB->pxTopOfStack – pxCurrentTCB->pxStack) and it does come up with some pretty big numbers ?? so through my debugging ive came up with : first it breaks on the first thread, then it breaks on vPreemtiveTick, then i try to step through the ISR but it pokes out??? Any ideas would be greatly appreciated. Thanks Will

Context Switching Problem??

Try starting with the scheduler in cooperative (set configUSE_PREEMPTION to 0) mode and with two very simple tasks – int i = 0, j = 0; void v1( void *pvParameters ) {     for(;;)     {         i++;         taskYIELD();     } } void v2( void *pvParameters ) {     for(;;)     {         j++;         taskYIELD();     } } then you should be able to step through the context switch without the tick getting in the way. Once you are sure this is working then you can set the registers in both tasks to known values to check that the known values are saved and restored as expected. once that is working, then you can re-introduce the tick. These steps are a good way of finding the source of the problem.