cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H753 Hardfault on jumping from Bootloader to application

sivaram
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

2 REPLIES 2

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 ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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.