bootloader with 2 application
I am working with an STM32F0 device and I want to implement a firmware update mechanism.
My current plan is to split the internal flash into three regions:
Bootloader: 0x08000000
Application Slot 1 (App1): 0x08004000
Application Slot 2 (App2): 0x08008000
The bootloader always runs first.
Only one application slot is active at a time.
The update flow is planned as follows:
If App1 is currently running and a new firmware update arrives, the new firmware is written to App2.
If App2 is running, the new firmware is written to App1.
After the update, the bootloader selects which slot to boot.
My concern is about the linker script (.ld) configuration:
When I build a new application firmware, I set the flash origin address in the linker script to:
This works correctly when the firmware is programmed into App1.
However, if the same binary is written to App2 at address 0x08008000, the vector table, reset handler, and absolute addresses inside the firmware will still be linked for 0x08004000.
So my questions are:
Is it correct that a firmware built for 0x08004000 cannot directly run from 0x08008000?
What is the recommended way to manage this kind of dual-slot update system on an STM32F0?
Any guidance or best-practice recommendations would be greatly appreciated.
