-
-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTA upgrade to Sming 4.3 #2251
Comments
Continuing from above, here are the require steps to perform an OTA upgrade:
If anyone has attempted this, please post and we'll see if there are framework changes that can be made to simplify/ease the process. At the very least, we should ensure the documentation covers this process. |
For now:I would suggest the following layout:
Such a setup will make it possible to do remote upgrade OTA with minimal changes and risk. Old apps will continue to work as expected. For the futurerBoot and PT contain certain information that can be found in both. It will be better:
|
Actually, we wouldn't need to erase the sector first as the area should already be blank - so little risk attached.
Keeping the rBoot config and partition table in the same sector is bad as subsequent OTA updates risk losing both rBoot config AND PT. We could keep the PT in the boot sector. Offset 0x0C00, for example, allows 32 partitions with plenty of space for the boot code. Aside: Generally, the partition table should be fixed at deployment and updating it via OTA should rarely be required. However, a safer way to to this might involve reserving two sectors for the partition table, using the second as a backup. OTA updating the boot sector should be avoided if at all possible! Proposed solutionLosing 4Kbytes of program space from 1MB is a non-issue. Keeping a compatible layout to support OTA updating is valuable though. It is currently a requirement that the partition table is located immediately after the boot sector. However, relaxing this restriction for the ESP8266 (and Host) would eliminate the above complications.
The OTA update procedure is:
|
This PR adds partition table support to the ESP8266 bootloader (rBoot). See #2254 #2251. The ESP8266 flash layout has been reverted to the original Sming 4.2 layout, with the addition of the partition table in the sector before the RF calibration data at end of flash. Update rBoot Update bootloader to read ROM addresses from partition table on boot. These overwrite whatever values have been set in its own configuration, thus avoiding inconsistencies. rBoot has been forked to simplify management. An additional partition subtype has been added for RF calibration data, so existing applications running off the develop branch will need re-building and re-flashing. The partition table may now be freely relocated for the Esp8266 (+ Host) to allow compatibility with existing devices which must be upgrade OTA. Methods have been added to OTA classes to allow update regions to be set using partitions; this is safer than working with raw flash addresses but the underlying mechanism hasn't changed.
I've opened this issue to discuss how OTA (over-the-air) upgrading of existing ESP8266 devices might work when migrating to the new partition-table structure.
With partition tables the ESP8266 layout has necessarily been altered. See https://sming.readthedocs.io/en/latest/upgrading/4.2-4.3.html.
Re-flashing a device to 4.3 should be as simple as:
I've used the Microsoft (TM) Notepad+Pencil App to illustrate some scenarios. On the left are the flash sector numbers (easier than writing addresses).
(1) This is a typical layout for Sming 4.2 devices:
(2) This is the new default layout for Sming 4.3:
The closest we can to the previous layout is shown in (3). There is a further development that could be made to the framework by allowing the partition table to share the boot sector, shown in (4).
The text was updated successfully, but these errors were encountered: