2026-04-30 9:42 PM - last edited on 2026-04-30 11:48 PM by MM..1
Hi all,
I am trying to develop a bootloader software for STM32F765.
I requires two features in it.
1) jumping from Bootloader to Application
2) jumping from Application to Bootloader
I could make jump from Bootloader to Application very easily.
But I am suffering with jumping from Application to Bootloader for 4-5 days now.
The final code I tried is given below:
void Bootloader_JumpToBootloader_Program(void)
{
void (*app_reset_handler)(void);
__disable_irq();
SysTick->CTRL = 0 ;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_RCC_DeInit();
HAL_DeInit();
/* 2) disable all enabled interrupts */
NVIC->ICER[ 0 ] = 0xFFFFFFFF ;
NVIC->ICER[ 1 ] = 0xFFFFFFFF ;
NVIC->ICER[ 2 ] = 0xFFFFFFFF ;
NVIC->ICER[ 3 ] = 0xFFFFFFFF ;
NVIC->ICER[ 4 ] = 0xFFFFFFFF ;
NVIC->ICER[ 5 ] = 0xFFFFFFFF ;
NVIC->ICER[ 6 ] = 0xFFFFFFFF ;
NVIC->ICER[ 7 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 0 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 1 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 2 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 3 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 4 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 5 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 6 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 7 ] = 0xFFFFFFFF ;
// Set embedded bootloader vector table base offset
WRITE_REG(SCB->VTOR, SCB_VTOR_TBLOFF_Msk & 0x00000000);
__enable_irq();
// Instruction synchronization barrier
__ISB();
uint32_t msp_val = *(uint32_t *)SYSTEM_START_ADDRESS;////SYSTEM_START_ADDRESS
__set_MSP(msp_val);
__DSB(); // Data synchronization barrier
__ISB(); // Instruction synchronization barrier
uint32_t reset_handler_address = *(uint32_t *)(SYSTEM_START_ADDRESS + 4);////SYSTEM_START_ADDRESS
/* assign the reset handler address to reset handler */
app_reset_handler = (void *)reset_handler_address;
app_reset_handler = (void (*) (void))reset_handler_address;
/* Jump to reset handler of the User Application */
app_reset_handler();
}Please share your valuable suggestions to solve the issue.
Sajeevan.K
2026-04-30 11:53 PM
Jumping into , dont work on MCUs with empty flash checks. I dont test 765, but other require before jump erase flash part 0. How you try this ? First step is test with hw way .
after this work, do jump from app.
2026-05-02 7:09 AM
do you mean you want to jump from the application to the bootloader software you are writing? the bootloader here means the software you are writing or the bootloader inside the STM32F765 system memory and flashed in the manufacture?
2026-05-02 1:38 PM - edited 2026-05-02 1:39 PM
The OP says: "embedded bootloader". That's system memory.