4 ms·
Ok. Your explanation was clearer to me than the one from the article. But still, how does your bootloader know which version to use? What I did many times in t
by scoutt 5y ago
Ok. Your explanation was clearer to me than the one from the article. But still, how does your bootloader know which version to use?
What I did many times in the past is to have two areas in flash: "normal run" and "update". "Normal run" has the running firmware and "update" is an area where the running firmware will use to store a new version.
It goes like this: the new firmware version is flashed to the "update" area in flash, usually with a header and a checksum. Then the bootloader will check for this header/checksum in the "update" area and if valid, will flash the contents of "update" area into "normal run" area. Then the contents of "update" are invalidated (erased) and the bootloader jumps to "normal run" as usual.
If any of the above fails, the firmware will be just re-written. The above is also valid for checking if the new firmware is authorized to run (signed, whatever).
I know some Nordic chips have special registers for this purpose.
- m_eiman 5y agoIn our case the images contain some meta data, including version and checksums. The bootloader can default to starting the newest version, and be sure that everything is fine by checking the checksum. If needed the bootloader can be instructed to either remain in bootloader mode (to receive a new firmware image) or to start the older firmware.