Skip to main content
MAmem.1
Associate III
Jan 11, 2023 12:43 PM UTC
Solved

Updating Bootloader from Application ??

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.
MM..1
MM..1Best answer
Super User
Jan 11, 2023 12:54 PM UTC

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

6 replies

MM..1
MM..1Best answer
Super User
Jan 11, 2023 12:54 PM UTC

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

MAmem.1
MAmem.1Author
Associate III
Jan 11, 2023 2:04 PM UTC

BOOT_LOCK was set. Thank you

MAmem.1
MAmem.1Author
Associate III
Jan 11, 2023 1:05 PM UTC

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

MM..1
Super User
Jan 11, 2023 1:25 PM UTC

Show the same code and return values.

Piranha
Principal III
Jan 15, 2023 3:16 AM UTC

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.1
MAmem.1Author
Associate III
Jan 18, 2023 11:07 AM UTC

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.