2025-10-15 5:50 AM - edited 2025-10-15 6:08 AM
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 ?
2025-10-15 7:41 AM
Hello @Quentin Ch
Did you flow the instruction on the following article please?
How to jump to system bootloader from application ... - STMicroelectronics Community