Booting with dual flash banks vs. bank swap
Dear experts,
I'm reading RMs for STM32 models with dual flash banks (F4, H7...) and don't quite understand how to use bank switching.
Take the firmware update scenario when old firmware is in bank1 and new is programmed to bank2. So it programs some option byte to switch banks and next time should boot from bank2.
If the new version is bad, I'd like to boot automatically from bank1. But how? the option byte is written. Is there a way to control bank switch by external pin?
On some systems that I've seen before we did it in the following way: we made a simple watchdog (CPLD or whatever) that automatically toggles the boot selector pin.
If the CPU does not touch the watchdog in defined time since reset, it will switch the selector pin and reset again.
So if the new firmware fails to boot, the system will reboot to the old firmware.
I'd like to implement the same on STM32, with external widget if needed, but better without it.
On the other hand, for H7 you can define alternative start addresses in option bytes, for BOOT0 high and low. But without bank switch this won't be useful. My firmware is not position independent, it is built for specific addresses in 1st bank. It won't run off bank2 if banks are not switched.
Any ideas, please?
-- pa
