2021-04-12 10:23 AM
I am trying to jump from bootloader from application, I tried the methods given here(adapted to jump to application from bootloader) and here.
I am always getting hardfault on executing the setmsp call. The disassembly of the __set_MSP translates to
LDR R3, [R4]
MSR MSP, R3
Where the contents of R4 is 0080 2000, which is the application start address, and contents at address 0x00802000 is 0x24080000 which is the stack pointer value.
The fault bits set on hardfault are PRECISERR at address(BFAR) 0080 2000.
Don't know how to solve this.
Solved! Go to Solution.
2021-04-13 02:20 AM
Thanks, Not setting the stack pointer in bootloader Solved the issue, I also added noreturn attribute to the jump function, BTW 0x00802000 is typo in the questions the jump address is 0x08020000 only.
2021-04-12 01:23 PM
Perhaps you're using this in C, and changing the stack mid-flow, and a subsequent pop driving beyond intended memory limit, or the SRAM clock isn't enabled.
I might recommend having the ResetHandler of the app itself set the SP to __initial_sp rather than trying to set/unwind from C function
Why are you jumping/using 0x00802000, should that be 0x08002000 or 0x08020000 ?
2021-04-13 02:20 AM
Thanks, Not setting the stack pointer in bootloader Solved the issue, I also added noreturn attribute to the jump function, BTW 0x00802000 is typo in the questions the jump address is 0x08020000 only.