Chapter 4. API Guides
4.22 Partition Tables
4.22.1 Overview
A single ESP32-S2's flash can contain multiple apps, as well as many different kinds of data (calibration data,
filesystems, parameter storage, etc). For this reason a partition table is flashed to
Partition table length is 0xC00 bytes (maximum 95 partition table entries). An MD5 checksum, which is used for
checking the integrity of the partition table, is appended after the table data.
Each entry in the partition table has a name (label), type (app, data, or something else), subtype and the offset in flash
where the partition is loaded.
The simplest way to use the partition table is to open the project configuration menu (idf.py menuconfig) and
choose one of the simple predefined partition tables under CONFIG_PARTITION_TABLE_TYPE:
•"Single factory app, no OTA"
•"Factory app, two OTA definitions"
In both cases the factory app is flashed at offset 0x10000. If you execute idf.py partition-table then it will print a
summary of the partition table.
4.22.2 Built-in Partition Tables
Here is the summary printed for the "Single factory app, no OTA"configuration:
# ESP-IDF Partition Table
# Name,
Type, SubType, Offset,
nvs,
data, nvs,
phy_init, data, phy,
factory,
app,
factory, 0x10000, 1M,
• At a 0x10000 (64 KB) offset in the flash is the app labelled "factory". The bootloader will run this app by
default.
• There are also two data regions defined in the partition table for storing NVS library partition and PHY init
data.
Here is the summary printed for the "Factory app, two OTA definitions"configuration:
# ESP-IDF Partition Table
# Name,
Type, SubType, Offset,
nvs,
data, nvs,
otadata,
data, ota,
phy_init, data, phy,
factory,
app,
factory, 0x10000,
ota_0,
app,
ota_0,
ota_1,
app,
ota_1,
• There are now three app partition definitions. The type of the factory app (at 0x10000) and the next two
"OTA"apps are all set to "app", but their subtypes are different.
• There is also a new "otadata"slot, which holds the data for OTA updates. The bootloader consults this data
in order to know which app to execute. If "ota data"is empty, it will execute the factory app.
4.22.3 Creating Custom Tables
If you choose "Custom partition table CSV"in menuconfig then you can also enter the name of a CSV file (in the
project directory) to use for your partition table. The CSV file can describe any number of definitions for the table
you need.
The CSV format is the same format as printed in the summaries shown above. However, not all fields are required in
the CSV. For example, here is the "input"CSV for the OTA partition table:
Espressif Systems
Size, Flags
0x9000,
0x6000,
0xf000,
0x1000,
Size, Flags
0x9000,
0x4000,
0xd000,
0x2000,
0xf000,
0x1000,
1M,
0x110000, 1M,
0x210000, 1M,
1434
Submit Document Feedback
(default
offset) 0x8000 in the flash.
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers