Flash bank swapping for mboot, and fragmenting rest of firmware? #15166
Unanswered
victorallume
asked this question in
STM32 / Pyboard
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Here's a half-formed idea, I'd like to get some discussion as to the feasibility of. Many STM chips (and other MCUs) have flash bank swapping to allow for risk-free updates. So there are two banks of flash, one of which is active. The other one is used to write an update to, and if the update was successfully written, a bit is set to use that bank as the primary. The code doesn't see which bank is being used - the addressing is automatically offset by the MCU.
The problem is that this effectively halves the amount of available flash. But what if bank-swapping was just used for the mboot bootloader? So there's an mboot at 0x08000000 and one at 0x08100000. mboot is small (one, maybe two sectors). Then the main firmware lives in two non-contiguous sections at 0x08020000 - 0x08100000 and 0x08120000 - 0x08200000. I have no idea if it's possible to have flash layout non-contiguous like this, nor how to get around the bank swapping mechanism not being wanted for the firmware once mboot passes control on to that.
As an probably more realistic alternative, it might be possible to use bank swapping, but once bank 2 has been flashing and has booted successfully, it flashes itself to bank 1, and reboots to bank 1. This then keeps the main firmware address ranges unchanged
What do people think?
Beta Was this translation helpful? Give feedback.
All reactions