cancel
Showing results for 
Search instead for 
Did you mean: 

Why Doesn't My STM32 Bootloader Jump to the Application After a Hard Reset?

Harsh_Gajjalwar
Associate II

Hello STM Community,

I'm working on an STM32 project that involves a custom bootloader and application code. Here's the setup:

  • Bootloader: Located at 0x08000000.
  • Application: Located at 0x08040000.
  • The bootloader successfully jumps to the application using a soft reset or in normal operation. However, after a hard reset (power cycle), the bootloader doesn't jump to the application as expected.

Here's the goto_application function I am using in the bootloader:

void goto_application(void)
{
/* Disable all interrupts */
__disable_irq();

/* Set the application's vector table address */
SCB->VTOR = 0x08040000UL;

/* Get the application reset handler address */
void (*app_reset_handler)(void) = (void (*)(void))(*((volatile uint32_t*)(0x08040004UL)));

/* Set the application's main stack pointer (MSP) */
__set_MSP(*(volatile uint32_t*)(0x08040000UL));

/* Disable SysTick */
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;

/* Ensure changes are applied */
__DSB();
__ISB();

/* Jump to the application's reset handler */
app_reset_handler();
}

What I've Tried:

  1. Verified the application vector table is correctly placed at 0x08040000.
  2. Deinitialized HAL and RCC in the bootloader before jumping.
  3. Confirmed that the application's linker script starts at 0x08040000.
  4. Double-checked the option bytes to ensure boot mode settings are correct.

Problem:

  • After a power cycle, the bootloader executes but does not jump to the application.
  • In normal operation (e.g., without a power cycle), the jump works fine.
0 REPLIES 0