I want to restart the program counter at 0x0000 when leaving a function, I already try the following solutions, but the compiler always returns me a syntax error : code void (*pReset) (void) = 0x00; extern code void (*pReset) (void) = 0x00;
The statement
((int( code * )( void ) ) 0x0000 ) ();
In particular, it wouldn't reset the stack pointer - the processor would still be waiting to "return" from the function which did this!
In some circumstances (optimiser setting?), if the very last statement in a function is a call to another function, the compiler will use a "jump" instead of a "call" instruction
Thanks for Your answer, when Itry the statment : void (*pReset) (void) = 0x00; The compiler compiles with no error, but I'm not certain if it is what I want to do.
You do not have to worry about resetting the stack pointer, the startup code will handle that.