STM32C031 does not jump correctly from bootloader to application
I am using an STM32C031 and am trying to write the bootloader program and application program as a single .bin file.
However, I have designed the boot loader program to start up when the power is turned on and jump to the application program by specifying the flash memory if the specified signal has not been received for a while, but I cannot get it to jump properly. It seems to jump to the application program from the flash memory location, but the application program does not work properly.
What kind of program should I use to make the boot loader program start working correctly when it jumps to the application program?
Also attached are the documents to which we are referring.
The usage of flash memory is as follows.
Boot program: 0x08000000~0x080027FF
Application program: 0x08003800~0x080077FF
The program for the jump part described in the boot loader program is as follows.
void jump_main(){
HAL_TIM_Base_Stop_IT(&htim17);
huart1.Instance->CR1 &= ~0x20;
//Disable all interrupts
NVIC->ICER[0] = 0xFFFFFFFFFF;
NVIC->ICER[1] = 0xFFFFFFFFFF;
NVIC->ICER[2] = 0xFFFFFFFFFFFF;
//Clear pendings
NVIC->ICPR[0] = 0xFFFFFFFFFFFF;
NVIC->ICPR[1] = 0xFFFFFFFFFFFF;
NVIC->ICPR[2] = 0xFFFFFFFFFF;
int *user_app = (int *)(0x08003800+0x04);
__set_MSP(*(uint32_t *)0x08003800);
*(int*)0xE000ED08 = 0x08003800;
((void(*)())(*user_app))();
while(1){ };
}
