If you’ve ever needed to clone your ESP32 or ESP8266, or simply back up its firmware, you’re in the right place. Today, I’m going to walk you through how to extract the binary file (often referred to as the "firmware") from your ESP32. This file can then be uploaded to another device, allowing you to replicate the exact functionality without needing the original source code.
Imagine you’ve spent countless hours perfecting your code on one ESP32, and now you want to duplicate this on multiple devices. Or maybe you want to safeguard your work by backing up the firmware. Extracting the binary file is the key to achieving this without the hassle of rewriting or copying code manually.
First, make sure you have:
This allows you to see the commands used during the upload process, which we’ll need later.
If you don’t already have a sketch uploaded to your ESP32, go ahead and upload something simple, like a basic blink sketch.
esptool.py
and copy it.esptool.py --chip esp32 --port COM3 --baud 115200 read_flash 0x00000 0x400000 firmware.bin
COM3
should be replaced with your actual COM port.0x400000
represents a 4MB flash size; adjust this if your ESP32 has a different flash size.esptool.py
is located, and paste the modified command. Press Enter and hold the BOOT button on your ESP32 when prompted.The extracted firmware will be saved as firmware.bin
in your chosen directory. This file contains all the code and data from your ESP32’s flash memory.
To clone this firmware onto another ESP32, use the following command:
esptool.py --chip esp32 --port COM3 --baud 115200 write_flash 0x00000 firmware.bin
Replace COM3
with the correct port for the new ESP32. Press Enter, hold the BOOT button, and watch the magic happen!
By following these steps, you’ve mastered the art of extracting and cloning firmware on ESP32 devices. This method is not only useful but a huge time-saver when working with multiple devices. Whether you’re backing up your work or sharing it, this process ensures you have full control over your creations.
Got questions or tips of your own? Drop them in the comments here!