Skip to main content
Associate
June 5, 2025
Question

Custom Bootloader - Not able to jump on the specific location on flash

  • June 5, 2025
  • 3 replies
  • 347 views

Hi team,

We are working on the custom bootloader on stm32u073RC. not able to jump on the specific location.

#define APPLICATION_PARTITION_1 0x0801D000


void jump_to_application_partition_1(void)
{
 /* Disable Interrupts */
 __disable_irq();

 /* Get the stack pointer and reset vector from the backup application section */
 uint32_t app_stack_pointer_1 = *(volatile uint32_t *) APPLICATION_PARTITION_1;
 uint32_t app_reset_vector_1 = *(volatile uint32_t *) (APPLICATION_PARTITION_1 + 4);

 /* Mapping of the backup application reset vector */
 pfunction app_entry_1 = (pfunction) app_reset_vector_1;

 /* Setting of the vector table to backup application */
 SCB->VTOR = APPLICATION_PARTITION_1;

 /* Setting MSP - (Main Stack Pointer) */
 __set_MSP(app_stack_pointer_1);

 /* Enable Interrupts */
 __enable_irq();

 /* Jump to backup application */
 app_entry_1();
}

 Thanks,

Shubham

3 replies

shubmaneAuthor
Associate
June 5, 2025

No source available for "__udivmoddi4() at 0x80003ce"

shubmane_2-1749116128052.png

 

 

TDK
Super User
June 5, 2025

Step through the code, what happens after the call to app_entry_1?

It would be better to disable interrupts as in the example code.

How to jump to system bootloader from application ... - STMicroelectronics Community

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Super User
June 5, 2025

Your variables app_stack_pointer_1, app_reset_vector_1, app_entry_1 may be located on the stack.

Line 20 (__set_MSP) moves the stack pointer. What do you think happens to the variables on the stack?