cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Running Application from Bootloader

Pushpalatha
Visitor

I seek your assistance with an issue I'm encountering while attempting to jump from my bootloader to an application stored at a specific address in the flash memory of an STM32H723ZGT6TR microcontroller.

 

 

I am able to successfully flash the application binary from a USB to the flash memory using bootloader code. However, I am unable to run the application using the following code snippet:

 

 
 
 uint32_t msp_value = *(__IO uint32_t *)0x08040000;
__set_MSP(msp_value);
uint32_t resethandler_address = *(__IO uint32_t *) (0x08040000 + 4);
app_reset_handler = (void*) resethandler_address;
app_reset_handler();
NVIC_SystemReset();
 
I would appreciate your review and any  suggestions or corrections you might have. Thank you for your time and assistance.
4 REPLIES 4
Imen.D
ST Employee

Hello @Pushpalatha and welcome to the Community 🙂

Please have a look at these articles which will help you on how to Jump to bootloader from application:

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

When I flash the application code using STM32CubeIDE and then run the bootloader code, I am able to successfully jump to the application address and execute the application. However, when I attempt to flash the application code from within the bootloader itself, I encounter difficulties in running the application code afterward. I suspect the issue lies with the flash write process during the bootloader operation.

SMarie
Associate III

Could you show us your process of how you write the flash in the bootloader?

void Flash_Write(uint32_t address, uint8_t *data, uint32_t length) {
    HAL_FLASH_Unlock();

    for (uint32_t i = 0; i < length; i += 8) {
        uint32_t data_word = *(uint32_t *)(data + i);
        if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, address + i, data_word) != HAL_OK) {
            Error_Handler();
        }
    }