Skip to main content
Visitor II
June 5, 2025
Question

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

  • June 5, 2025
  • 3 replies
  • 346 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

    This topic has been closed for replies.

    3 replies

    shubmaneAuthor
    Visitor II
    June 5, 2025

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

    shubmane_2-1749116128052.png

     

     

    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

    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?