We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
For Cortex-M3 the low bit of the address needs to be set to indicate Thumb state, so if the starting address in RAM was say 0x20000100 (i.e. 0x20000101 is stored at 0x20000004 in the asm above).In C it would betypedef void RAM_fn_t(void);RAM_fn_t* fp = (RAM_fn_t*)0x20000101;(*fp)();It doesn't set SP the way the asm above does. The cast is technically undefined behavior in C, but pragmatically it does what it looks like.Equivalently, if you prefer terseness/parentesis:(*((void (*)(void))0x20000101))();
typedef void RAM_fn_t(void);RAM_fn_t* fp = (RAM_fn_t*)0x20000101;(*fp)();
(*((void (*)(void))0x20000101))();