cancel
Showing results for 
Search instead for 
Did you mean: 

How to start bootloader from application code

BHeiß.1
Associate II

I tried this code:

    // BOOTLOADER starten -------------------------------------------------------------------------------------------

    void (*SysMemBootJump)(void);                              // Funtkion Jump definieren

    volatile uint32_t addr = 0x1FFF0000;                        // System Memory-Adresse für STM32G07 laden

    HAL_RCC_DeInit();                                       // RCC auf Default setzen

    SysTick->CTRL = 0;                                    // Systick Timer zurücksetzen

    SysTick->LOAD = 0;                                    // ...

    SysTick->VAL = 0;                                       // ...

    __disable_irq();                                       // Alle Interrupts sperren

    HAL_UART_DeInit(handleuart);                              // UART ausschalten

    __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();                     // System Memory remappen

    SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));   // Sprung-Adresse auf System Memory-Adresse setzen

    __set_MSP(*(uint32_t *)addr);                              // Main Stack-Pointer setzen

    SysMemBootJump();                                       // BOOTLOADER starten

    while (1)

    {

       // Diese Schleife Sollte nie erreicht werden

    }

This worked fine with the previous uses STM32F05. I just changed the adress of the bootloader (AN2606).

Can anybody help me?

Thanks

3 REPLIES 3
Uwe Bonnes
Principal III

This question was asked a zillion times. Search here. In short, add code in your user programm at the very start before further initialization that scans for a signature and if that signature is found, jump to the bootloder. To get from running user program to the bootloader, set that signature and reset .

BHeiß.1
Associate II

Thank you for your response. There were several problems to solve. I did it with help of the ST support.

Best regards

Bernd