cancel
Showing results for 
Search instead for 
Did you mean: 

how to jump to system booltloader from app code without change boot0 to high

deposition
Visitor

Hi All,

MCU is STM32H563. I attempted to jump from the Secure App directly to the System Bootloader so that I could program the OBK file without pulling BOOT0 high.
However, using the method below, the jump never succeeds — the MCU keeps resetting continuously.

Sometimes it resets immediately, and sometimes it reaches the reset vector of the system bootloader and then resets again.

static void JumpToBootloader(void)
{
funcptr_NS NonSecure_ResetHandler;

__disable_irq(); // Disable interrupts

SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;

HAL_RCC_DeInit(); // Reset clock configuration

for (int i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
}
__DSB(); __ISB();

SCB_NS->VTOR = BOOTLOADER_BASE_NS;

/* Set non-secure main stack (MSP_NS) */
__TZ_set_MSP_NS((*(uint32_t *)BOOTLOADER_BASE_NS));

/* Get non-secure reset handler */
NonSecure_ResetHandler = (funcptr_NS)(*((uint32_t *)((BOOTLOADER_BASE_NS) + 4U)));

/* Start non-secure state software application */
NonSecure_ResetHandler();
}

From the documentation AN2606 (page 54), I learned that the System Bootloader version in the H563 is Boot_V3_2, which includes the following statement:

Before jumping to the BL, the SFSP maps all the resources needed by the BL
to the non-secure domain. A jump from the BL (“Go” command) to an
application using other resources does not work.

So does this mean that jumping directly to the BL address without going through SFSP cannot succeed?

 

0 REPLIES 0