Skip to content

How to Save and Restore ESP8266 and ESP32 Firmware

We may want to save and later restore ESP8266 and ESP32 firmwares that came with them and were installed from the factory. It will come handy later on when we are troubleshooting the ESP development boards for possible defects.

We need the software Esptool to do this. Esptool is based on Python and so we need to first install Python.

If you are using Windows and do not have Esptool installed yet, please see the article entitled How to Install Esptool on Windows 10.

Gathering the Board’s Info

To properly save and restore an ESP8266 or an ESP32 firmware, we must be sure on the size of the flash chip involved.

To gather the board’s info, run the flash_id command.

Screenshot of the esptool command flash_id needed to gather information for saving and restoring esp8266 and esp32 development boards

Notice that we did not specify the port where the development board is connected. Esptool was smart enough to scan the different ports. It found that the board is connected on COM8.

On the screenshot above, I highlighted the important information with an arrow. The most important info we need is the flash size, which, in this particular case, is 4MB.

Save 1MByte or 8Mbit Flash

The command for saving the firmware of an ESP8266 or ESP32 chip with a 1MB (8Mbit) flash chip is as follows:

–baud 115200, the baud rate of the data transfer
–port COM8, the communications port where the board is connected
read_flash, the specific command
0x0, the starting address of the flash memory to read in hexadecimal
0x100000, the size of flash memory to read in hexadecimal (1048576 or 1MB decimal)
fw-backup-1M.bin, file name of the saved firmware

Save 4MByte or 32Mbit Flash

When saving the firmware of a development board with 4MB (32Mbit) of flash chip, we adjust the memory size parameter on the command. Hexadecimal 0x400000 is decimal 4194304 or 4MB.

Restore 1MByte or 8Mbit Flash

Restore 4MByte or 32Mbit Flash

Related Articles on How to Save and Restore ESP8266 and ESP32 Firmware

How to Test NodeMCU V3 Using Esptool
How to Install Arduino IDE on Windows 10
How to Set up Arduino IDE for ESP8266 Programming
How to Install Esptool on Windows 10
NodeMCU V3 ESP8266 Pinout and Configuration
NodeMCU ESP-32S Pin Configuration
How to Use MCP4725 Module with Arduino
How to Use ADS1220 ADC Module with Arduino

References on How to Save and Restore ESP8266 and ESP32 Firmware

ESP8266 on Wikipedia
ESP32 on Wikipedia
Esptool Wiki

4 thoughts on “How to Save and Restore ESP8266 and ESP32 Firmware”

Leave a Reply

Your email address will not be published. Required fields are marked *