2025-07-11 9:35 AM
Hi folks,
I am trying to implement a dual bank OTA system on my STM32F429IGT6 using DBM1 and BFB2 in the STMCubeProgrammer, but I'm having trouble booting into the second flash region (which I will call app_b from now on, along with app_a for the first flash region). By my logic, each app will have 512KB of flash memory, so app_a will start at 0x08000000, and app_b will start at 0x08080000. Through some online digging, I saw that having one linker script per app is what I should be doing, with each app's flash being its address that I mentioned before, but then set the app_b vector table offset to 0x00080000, so theoretically app_b can start at 0x08080000 because that's the result from the OR operation of 0x08000000 and 0x00080000. So here is my normal testing routine:
Build App_A, note version number --> generate a .bin file through a post build command
Flash App_A with start address 0x08000000 in the CubeProgrammer
Append Version Number to see change
Build App_B --> generate .bin file
Flash App_B with start address 0x08080000 in the CubeProgrammer
*From this point BFB2 would still be set to 0, and I can reset my board and it boots up fine to App_A*
Enable BFB2 (BFB2->1)
Restart board, but no response at all
Disable BFB2 (BFB2->0)
Restart board, boots to App_A fine
Essentially its the same file just besides the version number, which is just a const char*, the origin address in the linker, and the vect table offset. Any help would be appreciated, thank you!
2025-07-11 10:23 AM - edited 2025-07-11 10:23 AM
Doesn't the BFB bit switch the banks?
Both images should be built/fixated for 0x08000000 operation and SCB->VTOR would be 0x08000000
Now you'd need to WRITE the new image at the higher address 0x08080000, and if that's complete swap them.
I'd probably work with a loader in the front, and effectively allow it to fork() in the UNIX sense. ie same exact code, so doesn't matter what BFB maps, or if it changes.
So it runs, and checks the application portion, perhaps at 0x080010000, and selects the most current and intact image based on CRC/Signing and a Sequence Number or Date Stamp