2026-02-04 6:14 PM
I am creating a program that jumps from the bootloader to the application program using the STM32F410.
The bootloader uses 0x08000000 to 0x08003FFF.
The application uses 0x08004000 to 0x08007FFF.
The bootloader program jumps to the application program successfully,
but after entering the application program, the USART interrupts do not function.
The SPI in the application program continues to operate after the jump.
I'm posting the jump-related program.
Can you figure out what the cause might be? I'd appreciate your help.
【Bootloader main.c】
void jump_main(){
__disable_irq();
// Clear all interrupt bits
for (uint8_t i=0; i<8; i++)
{
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
}
int * address = (int *)0x08004004;
__set_MSP(*(int*)0x08004000);
*(int*)0xE000ED08 = 0x08004000;
((void (*)())(*address))();
}
【Application main.c】
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
Data_Init();
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
__HAL_RCC_SYSCFG_CLK_ENABLE();
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
MX_SPI2_Init();
MX_SPI5_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
MX_TIM11_Init();
/* USER CODE BEGIN 2 */
huart1.Instance->SR |= 0x28;
huart2.Instance->SR |= 0x28;
huart1.Instance->CR1 |= 0x2C;
huart2.Instance->CR1 |= 0x2C;
hspi1.Instance->CR1 |= 0x40;
hspi2.Instance->CR1 |= 0x40;
hspi5.Instance->CR1 |= 0x40;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if(USART_flg==0){
Tx_RGB(255,0,255);
USART_flg=1;
}else{
Timer++;
if(Timer==1136){
Timer=0;
Timer1s++;
if(Timer1s==1000){
Timer1s=0;
if(flg==1){
Tx_RGB(255,255,0);
flg=2;
}else if(flg==2){
Tx_RGB(0,255,255);
flg=1;
}
}
}
}
}
/* USER CODE END 3 */
}
2026-02-04 6:23 PM
> __disable_irq();
This disables interrupts. You need to enable them later on by calling __enable_irq(). Typically this is done before the jump.
See here for example jump to X code:
How to jump to system bootloader from application ... - STMicroelectronics Community
Also ensure you are not doing the jump from within an interrupt. Set a flag and jump from within main.
2026-02-04 10:39 PM
The application needs to "install" its own vector table to function properly.
Did you consider / check that ?
2026-02-04 11:19 PM
Is the SCB->VTOR setup correctly? See the content and comments in the file:
https://github.com/gbm-ii/STM32_Inc/blob/main/cm_boot.h