Skip to main content
Visitor II
October 15, 2025
Solved

Jumping into bootloader of STM32H563 from user code

  • October 15, 2025
  • 2 replies
  • 326 views

Hello,

I try to jump into the default bootloader of the STM32H563 from user code by setting the NSBOOTADDR:

extern void HalRebootInBootloaderMode(void) {
 FLASH_OBProgramInitTypeDef options;
 HAL_FLASHEx_OBGetConfig(&options);

 options.BootAddr = 0x0BF97000u; // From AN2606. Also tried 0x0BF80000 start of sytem memory found in table 48 of RM0481
 options.BootConfig = OB_BOOT_NS;
 options.OptionType = OPTIONBYTE_BOOTADDR;

 HAL_FLASH_Unlock(); //Returns HAL_OK
 HAL_FLASH_OB_Unlock(); //Returns HAL_OK
 
 HAL_FLASHEx_OBProgram(&options); //Returns HAL_OK
 HAL_FLASH_OB_Launch(); //Returns HAL_ERROR, because of OPT_CHANGE_ERR
 
 HAL_FLASH_OB_Lock();
 HAL_FLASH_Lock();
 HAL_NVIC_SystemReset();
}​

A similar mechanism worked pretty well on STM32H743 (using registers BOOT_ADDR1 and BOOT_ADDR_0 instead on that MCU).
But the snippet above fails on the H563 (HAL_FLASH_OB_Launch() returns HAL_ERROR, and my application always start in my user code).
However HAL_FLASH_OB_Launch() return HAL_OF if I set another address like 0x08000000 or 0x08000100.

- TrustZone is disable
- Provisionning state is 0xED (OPEN)
- BootLock option bytes are on 0xC3 (disabled)
- This article [1] at §3.3 reports a successful jump to bootloader from user code.

What am I missing ?

[1] https://community.st.com/t5/stm32-mcus/understanding-the-bootloader-issue-with-the-go-command-on-the/ta-p/750839

 

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

    Hello @Quentin Ch 

    Did you flow the instruction on the following article please? 

    How to jump to system bootloader from application ... - STMicroelectronics Community

    2 replies

    Saket_OmAnswer
    Technical Moderator
    October 15, 2025

    Hello @Quentin Ch 

    Did you flow the instruction on the following article please? 

    How to jump to system bootloader from application ... - STMicroelectronics Community

    Visitor II
    October 16, 2025

    Indeed, I overlooked about this article as some errors/fixes were reported and the HAL functions looked clearer and were working on a previous project with STM32F743.

    Just need to send then a "Reset" bootloader command instead of "Go" as explained in https://community.st.com/t5/stm32-mcus/understanding-the-bootloader-issue-with-the-go-command-on-the/ta-p/750839

    I assume it is not possible to set an address corresponding to System Memory in NSBOOTADDR of STM32H563