cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Multi-firmware custom BootLoader

pfifre
Associate II
Posted on June 03, 2014 at 09:12

Hi all,

I've already developped a custom bootloader on SMT32F407 by using USB device port.

It works fine.

Now, I want to add a new feature to embedded two firmwares in the flash.

This feature can provide some facilities to user:

- Switch from one firmware to the other

- Go back to the old firmware if an upgrade failed

My first question is:

All the adresses of the dowloaded firmware are base on a flash base (ex : 0x80000000) and they are fixed by linker.

How can I virtualize adresses to switch from firmware to another?

Thanks a lot.

Pascal

#stm32f4-bootloader
2 REPLIES 2
chen
Associate II
Posted on June 03, 2014 at 10:14

Hi

''All the adresses of the dowloaded firmware are base on a flash base (ex : 0x80000000) ''

Yes.

''and they are fixed by linker.''

Yes.

''How can I virtualize adresses to switch from firmware to another?''

It is not possible to ''virtualize adresses'' without a 'memory controller'

The same application must be built for 2 different addresses.

(FYI the linker can switch to relocatable code BUT then the code needs to be run from RAM and something, usually the OS, must load the code into RAM and 'fix' the addresses in the code - by 'fix' I mean convert the offset into a physical RAM address. As far as I know, it is not possible to execute a binary with offsets, all addresses must be physical addresses).

''- Go back to the old firmware if an upgrade failed''

Perhaps instead of trying to directly execute the binary in different locations, the bootloader always loads into the secondary location.

When the bootloader starts, if the secondary location is different/newer than the primary location, the bootloader can copy the newer version to the primary location before starting it.

Just a suggestion of a different strategy.

pfifre
Associate II
Posted on June 03, 2014 at 10:56

Hi sung,

Thanks.

I thought something like this by copying from one location to the current location.

I try it today.

Best regards,

Pascal