2025-01-12 10:05 PM
Hello STM Community,
I'm working on an STM32 project that involves a custom bootloader and application code. Here's the setup:
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();
}