I'm using STM32F469 which has quite a lot of flash space (2MB). I'm planning to place a bootloader to handle firmware upgrade and partitions the rest of the flash to store multiple firmware instances. Here are my setup:
@ 0x08000000 with size 128KB
Factory default app
@ 0x08020000 with size 640KB
Update app 1
@ 0x080C0000 with size 640KB
Update app 2
@ 0x08160000 with size 640KB
The idea is to place Bootloader and a factory default app in the flash by default. The bootloader already set the SCB->VTOR register before jumping and the factory default app has start address of 0x08020000 in the linker file like the following:
FLASH ORIGIN: 0x08020000 LENGTH: 1920K
The update 1 and 2 are for new firmware upgrade. I want the application to perform upgrade without entering the bootloader first. So update 1 will place the firmware upgrade on update 2 space when upgrading and vice versa (it's like doing ping pong). It will tell the bootloader which update is the latest one and the bootloader can jump to update 1/2 accordingly.
The problem is, I have to set the start address of the flash for each update to make it work. e.g.: I have to set the linker flash origin to 0x080C0000 if I want to place the update of update 1.
Is there any way I can skip the linker setting? or is there any way to tell the program that its start at certain address? I want the firmware update to be address independent (it can be placed either in update space 1/2) and it seems I have to set this linker statically for now.
Any though guys?