Although it’s always been possible to use Sming compiled apps with rBoot it wasn’t easy. I’ve shared Makefiles and talked a few people through it previously on the esp8266.com forum, but now there is a new sample project on GitHub to help everyone do it.
The sample demonstrates:
- Compiling a basic app (similar to the rBoot sample for the regular sdk).
- Big flash support, allowing up to 4 roms each up to 1mb in size on an ESP12.
- Over-the-air (OTA) updates.
- Spiffs support, with a different filesystem per app rom.
Spiffs support depends on a patch to Sming, for which there is a pull request pending to have it included properly. Probably the most common way I envisage this being used is a pair of app roms (to allow for easy OTA updates ) with a separate spiffs file system each, but rBoot is flexible enough to let you lay out your flash however you want to.
Suggested layout for 4mb flash:
0x000000 rboot 0x001000 rboot config 0x002000 rom0 0x100000 spiffs0 0x1fc000 (4 unused sectors*) 0x200000 (2 unused sectors†) 0x202000 rom1 0x300000 spiffs1 0x3fc000 sdk config (last 4 sectors)
* The small unused section at the top of the second mb means the same size spiffs can be used for spiffs0 and spiffs1. The top of the fourth mb (where spiffs1 sits) is reserved for the sdk to store config.
† The small unused section at the start of the third mb mirrors the space used by rBoot at the start of the first mb. This means only one rom needs to be produced, that can be used in either slot, because it will be of the same size and have the same linker rom address.
I’m messing with ESP8266 stuff. Specifically a Sonoff basic device. I’m trying to downgrade to a previous version of their firmware. I have two devices on the previous firmware and four that OTA upgraded before I realized the “feature” that I want to avoid. I’ve done comparisons between the two bin files of the previous versions and also compared two bin of the later versions and have attempted to try and plug in the later version stuff into the previous version. I uploaded the previous version and looking at the serial out it seems to just boot loop:
rll⸮⸮|⸮l⸮|⸮l⸮b|⸮⸮⸮⸮r⸮blb⸮⸮nn⸮lnn⸮⸮⸮bp⸮⸮lrlrlp⸮n⸮⸮lbn⸮|⸮⸮b⸮⸮nn⸮l⸮⸮l`⸮nnl`nr⸮⸮⸮n⸮⸮l`p⸮n⸮r⸮⸮⸮⸮⸮bn⸮|쎎⸮b⸮⸮nn⸮l`⸮nnl`nr⸮⸮⸮n⸮lp⸮n⸮r⸮⸮⸮⸮⸮⸮lbn⸮|⸮⸮⸮b⸮⸮nn⸮l`⸮nnl`nr⸮⸮⸮n⸮l`r⸮⸮n⸮l`rl⸮⸮n⸮⸮⸮nn⸮⸮⸮⸮rnnn⸮l⸮b⸮l⸮⸮l⸮⸮⸮⸮⸮⸮lll~rl⸮⸮llln⸮⸮⸮⸮l⸮⸮⸮`⸮⸮l⸮⸮n⸮⸮n⸮n~⸮⸮ll⸮⸮bllpb⸮br⸮⸮⸮l`nl⸮p⸮⸮l`bl`l⸮⸮n⸮n⸮⸮⸮nl⸮|bll`rl⸮⸮⸮⸮n⸮r⸮⸮n|⸮⸮l⸮prl⸮⸮r⸮l⸮l⸮l`⸮⸮r⸮l⸮l⸮l`⸮⸮r⸮l⸮⸮⸮ll`⸮⸮⸮n⸮⸮nlrl⸮⸮⸮
ets Jan 8 2013,rst cause:1, boot mode:(3,6)
load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8
2nd boot version : 1.6
SPI Speed : 40MHz
SPI Mode : DOUT
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000
⸮⸮⸮⸮n⸮r⸮⸮n|⸮⸮l⸮prl⸮⸮r⸮l⸮l
ets Jan 8 2013,rst cause:1, boot mode:(3,6)
load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8
2nd boot version : 1.6
SPI Speed : 40MHz
SPI Mode : DOUT
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000
If you have any feedback on this, I’d appreciate it.
Thanks,
David
Sonoff devices don’t use rBoot or Sming.
Hi Richard, can I use it with Adruino IDE? If yes, how?
Yes in theory, it’s just an ide using the espressif supplied sdk. However I’ve not done it myself so I don’t know if it’s as easy as it should be. If arduino ide hides away a common set of build scripts then you’d need to find them and tweak them. But if all the makefile stuff is in the project in the normal way then you should just be able to import the rboot-sample from github and build it from within the ide. I’m afraid you’d have to have a play, but if you get it sorted and can provide feedback that’d be great.
It is not clear to me whether rom0 can span a 1MB boundary, e.g. rom0 has size 1MB and starts at 0x002000, ending at 0x101fff. If so, can rom1 be of same size (1MB) and start at 0x102000? Would this require rom1 and rom2 to be different (linked with different relative locations)?
A rom cannot span the mb boundary.
Thanks Richard. So to allow maximum space for runtime code, the first ROM should (could) start at 0x100000 which would allow the rom to be 1MB long.
That’s correct, it’s hard to imagine needing quite that much code space, but if you do that’s the way to get it.