AnsweredAssumed Answered

STM32F042 jumps to ST bootloader issue

Question asked by jiang.peng on Feb 1, 2018
Latest reply on Feb 19, 2018 by jiang.peng

I have an application and want to jump to ST bootloader. It does not work and it seems to jump back from bootloader.

 

Jump to Bootloader area from user application on STM32F0 

STM32L021 Jump to Bootloader issue 

From AN2606, STM32F042 should jump to 0x1FFFC519, but the system address is 0x1FFFC400,I think I still need use 0x1FFFC519.

 

 

 

User can jump to the System Memory Boot
loader from his application code using the
following entry point:0x1FFFC519 (Thumb mode)

I suspect it may related to valid code in bank, and cause a second jump back to application.

Does ST has some proved solution for this kind MCU?

 

Here is my code:

 

void jumpToSTBootloader()//called from first line of main
{
    #define ApplicationAddress    0x1FFFC519

 

    typedef  void (*pFunction)(void);

 

    uint32_t  JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
    pFunction Jump_To_Boot = (pFunction) JumpAddress;
    __disable_irq();
    // Disable used PLL
    HAL_RCC_DeInit();
    SysTick->CTRL = 0;   // Reset the Systick Timer
    SysTick->LOAD = 0;
    SysTick->VAL  = 0;
    /* ARM Cortex-M Programming Guide to Memory Barrier Instructions.*/
    __DSB();

    __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();

    /* Remap is bot visible at once. Execute some unrelated command! */
    __DSB();
    __ISB();
    __set_MSP(*(__IO uint32_t*) ApplicationAddress);
    Jump_To_Boot();
    while(1);

 

}

 

Many thanks

Outcomes