I had to look it up and found that several compilers do not allow to put C-statements in a functions which has the naked attribute. The reason is that it is considered not safe.
Now I wonder if it is allowed to call the C-function from within an inline statement:
extern "C" void vPortYield( void ) __attribute__( ( naked ) );
void vPortYield( void )
{
portSAVE_CONTEXT();
/* Call vTaskSwitchContext() */
asm volatile ( "call vTaskSwitchContext" );
portRESTORE_CONTEXT();
asm volatile ( "ret" );
}
Note that portSAVE/portRESTORE only contain ASM statements. Can you try this?
NOTE: I used the prefix extern "C"
because I testing the compilation with a C++ compiler.