Associate II
May 19, 2026
Question
STM32H5 Cannot enter system bootloader from software
- May 19, 2026
- 2 replies
- 127 views
0x0BF97000 (system bootloader base per AN2606): the jump appears to succeed (In Debug reaches the bootloader region), but execution then breaks at an address inside the bootloader ROM with no further progress and no USB enumeration. The hardware boot path works correctly. The problem is purely on the software-jump path.
I created an empty project in sample you can download and test it. I also attached my option bytes (i think everything is default).
MCU: STM32H573 (also tested h523)
I created an empty project in sample you can download and test it. I also attached my option bytes (i think everything is default).
MCU: STM32H573 (also tested h523)
/**
******************************************************************************
* @file dfu_jump.c
* @author Uğur Tümer
* @brief See dfu_jump.h. Implements the magic-word + soft-reset path into
* the STM32H523 system bootloader (USB DFU on PA11/PA12).
******************************************************************************
*/
#include "dfu_jump.h"
/** Magic word stored in TAMP_BKP0R between the request and the next boot. */
#define DFU_JUMP_MAGIC 0xDEADB007UL
#define BOOTLOADER_BASE_ADDR 0x0BF97000
static void enable_backup_access(void)
{
__HAL_RCC_RTC_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
}
void dfu_jump_request(void)
{
enable_backup_access();
TAMP->BKP0R = DFU_JUMP_MAGIC;
__DSB();
__ISB();
NVIC_SystemReset();
}
void dfu_jump_check_and_run(void)
{
enable_backup_access();
if (TAMP->BKP0R != DFU_JUMP_MAGIC)
{
return;
}
TAMP->BKP0R = 0U;
__disable_irq();
for (uint16_t i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); ++i)
{
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
}
__DSB();
__ISB();
SysTick->CTRL = 0U;
SysTick->LOAD = 0U;
SysTick->VAL = 0U;
__enable_irq();
(void)HAL_RCC_DeInit();
(void)HAL_DeInit();
SCB->VTOR = BOOTLOADER_BASE_ADDR;
uint32_t bootloader_msp = *(volatile uint32_t *)(BOOTLOADER_BASE_ADDR);
uint32_t bootloader_entry = *(volatile uint32_t *)(BOOTLOADER_BASE_ADDR + 4U);
__set_MSP(bootloader_msp);
void (*const sys_boot)(void) = (void (*)(void))bootloader_entry;
sys_boot();
while (1)
{
__NOP();
}
}int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* MPU Configuration--------------------------------------------------------*/
MPU_Config();
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
dfu_jump_check_and_run();
dfu_jump_request();
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_ICACHE_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
