Best practice keeping track of banks for OTA rollback
Let say there are two separate flash banks defined in the linker script, Bank 1 and Bank 2.
The current application version executes in Bank 1, and in Bank 2 the previous version is stored.
When the bootloader identifies a new version, for example on a SD-card, the previous version is erased and flashing is made into Bank 2. If all goes well (checksum etc) the bootloader then sets this version as the current version and makes a memory jump to start this version in Bank 2. However if things goes wrong, it jumps back to previous version in Bank 1.
At pre-build time, the active flash bank needs to be set in the linker script and the VTOR pointer needs to be aligned with the memory address to this bank.
Now, what is the best practice to keep track on which bank to use on pre-build time?
