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

Allow for special fallback rom slot #16

Open ToSa27 opened 8 years ago

ToSa27 commented 8 years ago

I've moved OTA capabilities and a lot of other one time or rare case functionality (like AP with mini webserver for first time configuration of SSID/PW) into one dedicated ROM instead of duplicating that functionality in all ROMs wasting space. To properly select the last good ROM, the bootloader needs to be aware of this setup and pick the next ROM to check accordingly. I've added a new flag similar to the ERASE_SDKCONFIG flag to facilitate this - could be done via defines as well as I don't expect this behavior to change after design time. If another ROM wants to switch to this functionality, it can set the temp ROM in RTC-mem and force a soft-reboot e.g. forcing a watchdog timeout in an endless loop.

ToSa27 commented 8 years ago

Actually an even better approach would be to define the ROM number for the fallback ROM dynamically similar to the GPIO ROM number. The two unused bytes in the config struct would be a good place to do so. This would allow for OTA updates of the fallback itself as well leveraging another unused slot and then switching the fallback ROM number if successfully updated... I'd propose to close this without merging - I'll share an improved PR later (refactoring my entire codebase, hence it might take a couple of days).