cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Bootloader from Application ??

MAmem.1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief II

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

View solution in original post

6 REPLIES 6
MM..1
Chief II

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

MAmem.1
Associate III

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

Show the same code and return values.

BOOT_LOCK was set. Thank you

Piranha
Chief II

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.

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.