Skip to content
Maxim Prokhorov edited this page Sep 23, 2022 · 15 revisions

Two-Step updates

Starting with ESPurna version 1.14.1 and when building with Arduino Core 2.7.4+, it is possible to upload .bin file compressed with gzip

See our OTA page for more information

Introduction

As more and more features get packed into the firmware the binary image grows bigger. Until a few weeks ago it was one of my requirements to build images below the 512000 bytes size. That's the maximum size of an image so two of them would fit in a 1MB flash memory using the '1M (no SPIFFS)' memory layout.

The flash memory is split into 4096 bytes sectors, so a 1MB flash memory has 256 sectors. One of those sectors is used for EEPROM and 4 more are reserved space at the end of the flash. That leaves us with 251 sectors for code (assuming no SPIFFS partition). And that means the code must not be larger than 125 sectors to be able to do OTA. That's 512000 bytes or 500Kb.

ESPurna is close to that limit and I have sacrificed some features that are disabled by default so the limit is not met. But with the release of Arduino Core 2.4.0 things have gone worst on the size battle, albeit much better on other aspects.

That's why I'm starting to use another approach: the two-step updates. The idea behind it is to flash a stripped-down version of the firmware first, lighter and with the minimum features required to flash it again with the real, full-featured image. This lighter version is the ESPurna minimal binary and right now it is around ~350Kb. This means that using this method you can now flash an image of up to ~650Kb.

Of course, it's not as easy as it is doing a single flash, but I think it's worth it.

Procedure

Well, as the name says, you will have to flash over-the-air your device twice. The first time with the 'minimal' image and the second one with the specific image for your device. You can do the first OTA upgrade using any of the OTA methods.

The actual .bin can only be flashed by:

If you are using PlatformIO to build the firmware, you can also try using the ESPurna OTA Manager (still a beta feature) that will guide you through the process...

About ESPurna minimal firmware

This image is basically a stripped-off version of the ESPurna firmware, without several features that usually come bundled in. Currently, there are only two variants:

  • -minimal-arduino-ota with every module disabled, but: mDNS server, Telnet (no debug logs!), Terminal commands, ArduinoOTA and WiFi
  • -minimal-webui with stock web server, to allow HTTP updates instead of ArduinoOTA

Home
Change log

Getting started

Supported hardware and options

Configuration

Integrations

Network

Developers

More around ESPurna

Clone this wiki locally