My only concern around not having the V1 code in there as a fallback, is that if the V2 download fails and the unit reboots, it is then a non-functional unit until it can successfully download code.
For our 24x7 remote logging application - this is not really an acceptable possibility.
So either I need a way of removing all the V1 code from RAM before running V2, or could I as part of the download new code process do this ?
erasePage()
write a dump of the current running code into Flash
then follow by writing the V2 code (downloaded) into Flash
If V2 downloads and verifies I can write to my EEPROM that the V2 code is valid to run - so the bootloader knows which version to load.
There would still be some risks around this, but probably acceptable for our application
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
My only concern around not having the V1 code in there as a fallback, is that if the V2 download fails and the unit reboots, it is then a non-functional unit until it can successfully download code.
For our 24x7 remote logging application - this is not really an acceptable possibility.
So either I need a way of removing all the V1 code from RAM before running V2, or could I as part of the download new code process do this ?
There would still be some risks around this, but probably acceptable for our application