ESP8266 OTA & Partition Tables

I have an ESP8266 board with 1MB of flash and have been having some troubles with OTA updates. Using the Arduino IDE and selecting the option “1MB Flash (FS:64kB, OTA:~470kB)” I am able to upload the my program (~465kB) and use OTA updates. When I upload using PlatformIO (I’m using the VS Code extension if that makes any difference) I am unable to perform OTA updates on the same firmware. Using smaller firmware I was able to get OTA updates working in both Arduino and PlatformIO.

Here’s the log from a failed OTA upload: https://pastebin.com/7vTb6MtU

My platformio.ini: https://pastebin.com/2kKH3HR7

Here’s what my options looked like in the Arduino IDE

My suspicion is that the default partition table in PlatformIO does not have large enough OTA partitions for my firmware, but I couldn’t find any way to change it nor did I have much luck finding information on ESP8266 partition tables. Any help on this matter would be greatly appreciated.

Thanks,
Ryan

Since you selected board = sonoff_th in your platformio.ini, your default settings are

The ldscript value (documentation) decides what flash layout will be used. Specifically the default file will get you

In the Arduino you have selected “Flash Size: 1MB (FS:64KB OTA:~470KB)”

which, as you can see in Arduino-ES8266,

corresponds to the eagle.flash.1m64.ld file, and hence, per above linked documentation, you should be adding

board_build.ldscript = eagle.flash.1m64.ld

to your platformio.ini to equalize your settings between the Arduino IDE & PlatformIO…

1 Like

Thank you very much Max for your detailed response, it has resolved my issue. Being inexperienced and coming from the Arduino IDE I had never heard of ldscript and glossed over it in the documentation. Thanks again for your help.