raburton / rboot

An open source bootloader for the ESP8266
https://richard.burtons.org/tag/rboot/?order=ASC
MIT License
300 stars 72 forks source link

Potential for flash corruption... #33

Closed snichols closed 7 years ago

snichols commented 7 years ago

Here's a neat issue we've run into with our live devices using rboot. If the device loses power when rboot is writing to flash, it's possible for write to be incomplete. Basically if flash erase happens and power is lost before write then flash is left in the erased state.

It's a rare problem -- 1 : 1000 so far. But it has happened. Only way I can see this being worked around is to have two copies of the configuration and double-buffer them.

raburton commented 7 years ago

That does sound rare, to hit a problem between the erase and write of the single config sector, but not possible. However, if the config sector is lost rBoot will create a new default one on next boot so it should then boot the first rom (this may not be the one you just flashed, but you'll be back up and running).

snichols commented 7 years ago

Yeah, that's the fallback for sure... and works. Just causes a double OTA which isn't the worst thing in 1:1000 chance. :)