2025-09-09 4:58 AM
Hi,
I’m working on an STM32F767 custom bootloader with two application slots:
Main Application Slot → starts at 0x08040000
Backup (Factory) Slot → starts at 0x08100000
I have written a bootloader that checks both slots and jumps to the valid application:
SCB->VTOR = app_base; // Set vector table offset
__set_MSP(*(uint32_t*)app_base); // Set initial stack pointer
void (*app_reset_handler)(void) = (void*)(*(uint32_t*)(app_base + 4));
app_reset_handler(); // Jump to reset handler
I tested two scenarios:
I built one binary with FLASH start = 0x08040000.
I program the same binary into both slots:
Slot 1 → 0x08040000
Slot 2 → 0x08100000
Result:
Main slot works :white_heavy_check_mark:
Backup slot fails :cross_mark: — the application does not start.
The binary built for 0x08040000 fails when executed from 0x08100000?
Is there a way to make one application binary run from both flash addresses?
2025-09-09 5:34 AM
Have you set correctly the VTOR for the apps? It has to change when you run the app from the second bank
2025-09-09 6:15 AM
You can use position independent code, which is not common. You will still need to set VTOR correctly.
You can use bank remapping if it's placed at the same position within each bank.
2025-09-09 8:02 AM
Hello @MADHU2
The recommended method for dual-slot booting is to build two separate application binaries; each linked to a different flash start address using distinct linker scripts—one for the main slot at 0x08040000 and another for the backup slot at 0x08100000. This ensures that each binary’s vector table and all absolute addresses are correctly aligned with its designated flash region. During firmware updates, both binaries are included in the update package, and the bootloader is responsible for checking the validity of each slot and jumping to the appropriate application.