Backstory
Several Tasmota devices based on an ESP8285 have to be flashed with alien firmware. The devices' programming ports are not accessible (except for one dummy device which was cracked open for testing).
The Tasmota firmware currently installed is based on the Arduino core, uses ESP8266httpUpdate.h
and allows to OTA-update from a http server.
Problem
The problem is that the Tasmota firmware for the ESP8266 (=8285) family always uses a 1MB partition scheme while my specific device is based on the ESP8285H16 which incorporates 2MB of flash. The second half of flash memory is therefore unused.
What I want to do
Using only over-the-air updates I want to update the Tasmota devices' flash layout so that the full 2MB of flash can be used and eventually upload a firmware that is bigger than what's currently possible.
Ideally the final flash layout uses a completely new partition scheme.
How can it be achieved?
I know this can be challenging and will probably require multiple intermediate firmware versions. This is okay because the upgrade process will not happen "in the field" (but still no physical access to the chips) and occasional fails are acceptable - the process will be tested beforehand.
There's already a related answer from @Majenko here, but it covers the ESP32. While I know where to start with an ESP32, I'm a bit puzzled with the ESP8266/8285:
I tried to read the whole flash images of the device to get a picture of what I'm dealing with and found the flash layout to be completely different from what I'm used to (ESP32).
Mainly, there wasn't a partition table at flash address 0x8000 while the Espressif documention specifies this exact address.
I found almost no documentation about the ESP8266 partition scheme as defined by the Arduino core:
- Where in flash is the partition table?
- If there is none, how does OTA work on ESP8266?
- Where in flash is the bootloader?
- Where does the filesystem begin (if there is one)?
Requirements
- The flash layout needs to be changed using only OTA updates
- Any information stored in the current flash or filesystem may be deleted
- Multi-step updates are no problem
- There's physical access to one device so the routine can be tested
Edit: Illustration
This is the normal OTA routine according to the docs:
and this is what I have in mind:
But for this I need to know the borders of each section, ideally during runtime.