16

I am developing on an ESP32 devboard (esp8266, wroom). I need to get the partition table of the currently running device.

This document contains a quite good documentation of its partition table. I can also read/write flash regions by the esptool.py and parttool.py tools. These can manage and modify the table well.

However, I did not find a way to read its partitions. How can I do it?

2 Answers 2

21

The current tools of the ESP32 have no explicit option for that. However, the existing tools can be easily combined to do this.

The partition table is located at 0x8000 (32768) on older, and on 0x9000 (36384) on newer systems. Anyways, its location can be found (and be set) at the CONFIG_PARTITION_TABLE_OFFSET setting in the menuconfig. Its length is always 0xc00 (3072) bytes.

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

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

And then, the gen_esp32part.py tool can be used to convert it to csv to the stdout: gen_esp32part.py ptable.img.

For some scripting, these tools can be also combined, for example in a Linux

(python $(IDF_PATH)/components/esptool_py/esptool/esptool.py \
  read_flash 0x9000 0xc00 /dev/fd/3 >&2) 3>&1|python \
  $(IDF_PATH)/components/partition_table/gen_esp32part.py /dev/fd/0

will dump the table to the stdout.

1
  • On some of the newer ESP32 processors, like the ESP32-S3, the address of the partition table has changed to 0x8000 instead of 0x9000.
    – TrentP
    Commented Jan 9 at 8:35
1

Option 1: idf.py
If you have an esp-idf project you can simply run this command. You must be in your project folder, e.g. 'c:\my-esp32-projects\sample-project'

idf.py partition-table

and the partition table will be print in console like this:

Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************

Option 2: Espressif-IDE
Use the Espressif-IDE, right-click on your project and choose ESP-IDF: Partition Table Editor, this way you have a graphic window where you can view/edit the partition table for your esp32 application enter image description here

1
  • This is where you configure the partition table you want to upload. It will not get you the partition table of the currently running device.
    – Sim Son
    Commented Feb 17 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.