Category: MicroController

ESP32: how to read and write the partition table of an ESP device?

To communicate with an ESP32 the ESP-IDF (Espressif IoT Development Framework) can be used. This framework provides a collection of useful scripts to communicate with your ESP device. The framework is supported on Windows, Linux and macOS.

You can download the ESP-IDF repository and extract the contents into a folder.

Note that you need to have python 3 installed. For example by using brew install python on macOS. In addition, the esptool library is required by running pip install esptool in your terminal.

Reading the Partition Table

The partition table is located at 0x8000 (32768) on older, and on 0x9000 (36384) on newer systems. Its length is always 0xc00 (3072) bytes.

With the, this can be read out, for example by the command

python $(IDF_PATH)/components/esptool_py/esptool/ read_flash 0x9000 0xc00 ptable.img

To create a “human” readable csv file, you can use the tool:

python $(IDF_PATH)/components/partition_table/ ptable.img > ptable.csv

In my case, the partition table looks as follows:

Foto von Vishnu Mohanan auf Unsplash