vtaskDelayUntil + ride GCC + str710

we created a GCC STR71X port from combining the STR71X IAR port and the LPC2000 GCC port.  optimization : -o1 + debug -g I just notice after several executions that : - the tasksuspend & taskresume is working well - fifo is working well - semaphore is working well - vTaskDelayUntil is not working well and I’m wondering that what is working is when there is taskYield : switch context with software interrupt and vTaskDelayUntil is working good when we are stopping the task because it’s switching context with taskYield and when we are reputting the task when the tick is good (in wdg interrupt) something wrong is happening. So I have pb with switching context with the wdg timer which is in IRQ mode. - TaskYield OK : it’s in supervisor mode - WDG timer not OK : it’s in IRQ mode I just found an idea to see if it is from this:  the taskyield is calling SWI interrupt which is in supervisor mode and in this case everything is working well and the timerWDG is in IRQ mode and not in supervisor mode so in vPortPreemptiveTick (function called in WDG), I’m doing a SWI interrupt and I added in vPortYiledProcessor the vTAskIncrement just to try if it will work and in this case the vTaskDelayUntil is working and the tasks are switching normally. So I don’t understand for the port for IAR/STR710 : is it good or no for the WDG Timer because we are not in supervisor mode in this case? Which changes must I do for the WDG timer to be in supervisor mode. Thanks

vtaskDelayUntil + ride GCC + str710

Don’t fully understand what you are saying but IRQ mode is fine for an context switch.  You do not need to be in supervisor mode. Are you sure you have declared your swi handler correctly – using the naked attribute as well as the swi attribute.  Have you remembered to add 4 to the return address in thw swi handler? asm volatile ( "ADD        LR, LR, #4" );

vtaskDelayUntil + ride GCC + str710

In the SWI handler everything is working well : it’s a __attribute__((interrupt("SWI"),naked)); + there is asm volatile ( "ADD LR, LR, #4" ); code : void vPortYieldProcessor( void ) __attribute__((interrupt("SWI"), naked)); void vPortYieldProcessor( void ) { asm volatile ( "ADD        LR, LR, #4" ); portSAVE_CONTEXT(); vTaskSwitchContext(); portRESTORE_CONTEXT();    } The pb is in WDG interrupt : this interrupt is not working well for the context switch and when in vPortPreemptiveTick I’m doing asm volatile ("SWI 1"); instead of everything else, the vTaskDelayUntil is working well that’s why I was asking if in IRQ mode the context switch is working. code not working: void vPortPreemptiveTick( void ) __attribute__((naked)); void vPortPreemptiveTick( void ) {        portSAVE_CONTEXT();    vTaskIncrementTick(); vTaskSwitchContext(); WDG->SR = 0x0000; portCLEAR_EIC();        portRESTORE_CONTEXT(); } code working: void vPortPreemptiveTick( void ) __attribute__((naked)); void vPortPreemptiveTick( void ) {        asm volatile ( "SWI 1" ); } I don’t understand why the WDG irq is not good switchng context?

vtaskDelayUntil + ride GCC + str710

Interesting, it looks ok.  You have configUSE_PREEMPTION set to true?

vtaskDelayUntil + ride GCC + str710

configUSE_PREEMPTION  1

vtaskDelayUntil + ride GCC + str710

configUSE_PREEMPTION 1