Skip to main content
Visitor II
April 12, 2021
Solved

STM32H753 Hardfault on jumping from Bootloader to application

  • April 12, 2021
  • 1 reply
  • 1116 views

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.

    This topic has been closed for replies.
    Best answer by sivaram

    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.

    1 reply

    Graduate II
    April 12, 2021

    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 ?

    sivaramAuthorAnswer
    Visitor II
    April 13, 2021

    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.