As promised here is my new boot loader for the ESP8266 – rBoot.
Advantages over SDK supplied bootloader:
- Open source (written in C) – this is the big one.
- Supports any number of roms.
- Roms can be different sizes.
- Rom slots can be used for resource storage as well as bootable apps (and benefit from the OTA update system).
- Can use the full size of the SPI flash (see below).
- Rom slots can be altered after deployment (with care!).
- Earlier rom validation (less prone to errors).
- Can try multiple backup roms (without needing to reboot).
- Rom selection by GPIO (e.g. hold down a button when powering on to start a recovery rom).
- Wastes no stack space (SDK boot loader uses 144 bytes).
- Documented config structure (easy to configure from user code).
Disadvantages over SDK supplied bootloader:
- Not compatible with sdk libupgrade (but equivalent source included, based on open source copy shipped with earlier SDKs, so you can easily update your existing OTA app use this new code).
- Requires you to think slightly more about your linker scripts, rather than just using the pair supplied with the SDK (but it’s not really that difficult – if you’re programming in C it’ll be well within your capabilities).
Problems common to both:
- You still need to relink user code against multiple different linker scripts depending where you intend to place it on the flash, because the memory mapped position of the .irom0.text section needs to be known at link time. This also prevents you moving roms around at will once they have been compiled.
- Only 8MBit of flash can be memory mapped at a time (the SDK bootloader allows at most the first 2 x 8Mbit chunks to be used for roms, rBoot doesn’t have this limit, on a 32MBit flash you can have 4 x 8MBit roms), see memory mapping imitation for more details.
I’ve decided to start putting my source code on GitHub, it’ll be easier to maintain keep my blog tidier.