This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bootloader Memory Jump Freeze

I am working on a bootloader and it works ~70% of the time. But about 30% of the time the instrument freezes when executing the memory jump portion of the code.

uint32_t JumpAddress;
typedef void (*pFunction)(void);
pFunction Jump_To_Application;

#define ApplicationAddress (uint32_t) 0x08010000 // This is where the application is properly stored

...

if (((*(__IO uint32_t*) ApplicationAddress) & 0x2FFE0000) == 0x20000000) {
    JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
    Jump_To_Application = (pFunction) JumpAddress;
    __set_MSP(*(__IO uint32_t*) ApplicationAddress);

    // Code gets here without problem, the next line works / freezes randomly
    Jump_To_Application();
}

This memory jump code is basically a copy/paste from commonly used bootloader code. What could be the cause of the random freeze?

Parents
  • You've got interrupts and other crap running that doesn't take well to it's vectors going nowhere? Watchdogs?

    You've got clocks running already that don't take well to someone mashing the gear box? Say you have the PLL running at 168 MHz off HSE, with HSI disabled, switching the synchronous machine to a non-functioning clock is fatal.

    Try providing a proper Hard Fault handler on both sides, and see why it's dumping. Bring up a post-mortem debug session and see why it died.

    Copy-n-Paste doesn't infer a through understanding of what the processor state is at the hand off.

Reply
  • You've got interrupts and other crap running that doesn't take well to it's vectors going nowhere? Watchdogs?

    You've got clocks running already that don't take well to someone mashing the gear box? Say you have the PLL running at 168 MHz off HSE, with HSI disabled, switching the synchronous machine to a non-functioning clock is fatal.

    Try providing a proper Hard Fault handler on both sides, and see why it's dumping. Bring up a post-mortem debug session and see why it died.

    Copy-n-Paste doesn't infer a through understanding of what the processor state is at the hand off.

Children