Problem with SWI

Hello everybody, I’m trying to change the FREERTOS to have pre-emtive and nonpre-emtive tasks simultaneously. So the idea is when the task has completed its job to yield explicitelly: ________________________________________________________________________________ void vPortYieldProcessor( void ) __attribute__((interrupt("SWI"), naked)); #define portYIELD()     asm volatile ( "SWInt" ) static portTASK_FUNCTION( vTask2, pvParameters ) {     /* Just to stop compiler warnings. */     ( void ) pvParameters;     SendString(EmaName); /* Print something */     portYIELD();         /* trigger a task switch*/ } Actually trhough my debugger (yagarto tools + eclipse) I see that the program hengs always at the program abort trap: .section .startup,"ax"          .code 32          .align 0     b     _start                        /* reset – _start            */     ldr   pc, _undf                        /* undefined – _undf        */     ldr   pc, _swi                        /* SWI – _swi                */     ldr   pc, _pabt                        /* program abort – _pabt    */     ldr   pc, _dabt                        /* data abort – _dabt        */     nop                                    /* reserved                    */     ldr   pc, [pc,#-0xFF0]                /* IRQ – read the VIC        */     ldr   pc, _fiq                        /* FIQ – _fiq                */ _undf:  .word __undf                    /* undefined                */ _swi:   .word vPortYieldProcessor       /* SWI                        */ _pabt:  .word __pabt                    /* program abort            */ _dabt:  .word __dabt                    /* data abort                */ _fiq:   .word __fiq                     /* FIQ                        */ __undf: b     .                         /* undefined                */ __pabt: b     .                         /* program abort            */<-HERE __dabt: b     .                         /* data abort                */ __fiq:  b     .                         /* FIQ                    */ ________________________________________________________________________________ Does anybady know what is going wrong ? Thanks in advance! janiex.

Problem with SWI

You must not allow a task to return from its implementing function.  Either the task must be in an infinite loop, or it must be deleted before it reaches the end of the function.  A task can delete itself before reaching the end of the function. Regards.