I have bought an M5STACK CORE2 V1.1 system and now I want to start experimenting with it.
Before flashing something on the system I would like to save the initial contents of the flash, so that I’m able to restore it to the system after my experiments.
The result of a short internet search was to use esptool, a serial utility for flashing, provisioning, and interacting with Espressif SoCs.
Because I’m using the ESP-IDF, the integrated development environment of Espressif, I only had to activate the right environment to have the esptool available:
source ~/.espressif/tools/activate_idf_v6.0.sh
Now the esptool can be started with:
python3 /$VIRTUAL_ENV/bin/esptool

To read out the whole flash memory of the SoC the command I used this command:
esptool --chip esp32 --port /dev/cu.usbserial-59740149631
--baud 230400 read-flash 0 0x1000000 m5stack_core2_backup.bin
Using higher baud rates of 921600 and 460800 did not work. With the baud rate of 230400 the process ran for ~ 13 minutes.
The name of the USB port to use was found by listing the ports with
ls /dev/cu.usb*
on my Mac.

Leave a Reply