Moderator note: This thread was split from
.
Hi Santosh,
While inside my M3 bootloader, i am trying to update the application side MSP value and to do this i am trying something as pointed out below. With this approach the MSP and SP get incremented by 2 bytes than what i am actually loading through register R0.
inline void set_sp (uint32_t app_stack){
asm(" msr msp, r0\n");
}
This increment of 2 bytes intern causes my application code to call FaultISR routine.
What i actually pass to app_stack (r0) = 0x20002358
&
What actually gets passed to MSP = 0x200002360
If i do not try to set the MSP / SP value i can make a comfortable jump to my application from bootloader and everything resumes normal.
Can you please confirm if this is how arm ISA behaves or is there something i am missing.
Thanks



