Skip to main content
Visitor II
January 11, 2023
Solved

Updating Bootloader from Application ??

  • January 11, 2023
  • 3 replies
  • 4110 views

Hi,

I'm having a STM32G474 with Bootloader block (0x0800 0000 - 0x0800 4FFF) and Application block (0x0800 5000 - 0x0807 FFFF).

I need to update Bootloader from Application, by copying a new bootloader located on higher memory. Is it possible ?

I'm using the same code of the bootloader to erase the pages 0 to 4 but no success. I can't even write on the bootloader block.

So is it possible to erase the bootloader from the running application ?

Thanks

    This topic has been closed for replies.
    Best answer by MM..1

    I mean you can , but is this safe? Secondary G474 is dual bank with protections , if you set protect boot ...

    3 replies

    MM..1Answer
    Graduate II
    January 11, 2023

    I mean you can , but is this safe? Secondary G474 is dual bank with protections , if you set protect boot ...

    MAmem.1Author
    Visitor II
    January 11, 2023

    BOOT_LOCK was set. Thank you

    MAmem.1Author
    Visitor II
    January 11, 2023

    I agree, it's not safe but it's the only solution to upgrade systems.

    Graduate II
    January 11, 2023

    Show the same code and return values.

    Graduate II
    January 15, 2023

    Bootloader must be immutable and permanent. If it seems that you have a need to update it, then most likely you have to make a second bootloader. And that second bootloader can actually be just like a second minimal "updater" application, which updates the main firmware. After that, the main firmware can also update the updater. The bootloader doesn't have to do the everyday updates, but it always has to be capable of recovering a device into a working state regardless of what is the state of the updater and main firmware.

    MAmem.1Author
    Visitor II
    January 18, 2023

    It's more complicated than that.

    On the board, we have changed the MCU (due to stock rupture) so it was the occasion to make a new board. we decided to double the size of the external flash. (divided in different blocks to store menu languages and firmwares of daughter boards)

    During normal use, if we want to upgrade the a firmware we have to transfer it by bluetooth and save it on the external flash. So since the flash doubled, we changed all blocks locations and for the bootloader to find the good new location we have to change it too.