Chapter 4. API Guides
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 1M
ota_0, app, ota_0, , 1M
ota_1, app, ota_1, , 1M
nvs_key, data, nvs_keys, , 0x1000
• Whitespace between fields is ignored, and so is any line starting with # (comments).
• Each non-comment line in the CSV file is a partition definition.
• The “Offset”field for each partition is empty. The gen_esp32part.py tool fills in each blank offset, starting
after the partition table and making sure each partition is aligned correctly.
Name field
Name field can be any meaningful name. It is not significant to the ESP32-S2. Names longer than 16 characters will
be truncated.
Type field
Partition type field can be specified as app (0x00) or data (0x01). Or it can be a number 0-254 (or as hex 0x00-
0xFE). Types 0x00-0x3F are reserved for ESP-IDF core functions.
If your app needs to store data in a format not already supported by ESP-IDF, then please add a custom partition type
value in the range 0x40-0xFE.
See esp_partition_type_t for the enum definitions for app and data partitions.
If writing in C++ then specifying a application-defined partition type requires casting an integer to
esp_partition_type_t in order to use it with the partition API. For example:
static const esp_partition_type_t APP_PARTITION_TYPE_A = (esp_partition_type_
,→t)0x40;
The ESP-IDF bootloader ignores any partition types other than app (0x00) and data (0x01).
SubType
The 8-bit subtype field is specific to a given partition type. ESP-IDF currently only specifies the meaning of the
subtype field for app and data partition types.
See enum esp_partition_subtype_t for the full list of subtypes defined by ESP-IDF, including the following:
• When type is app, the subtype field can be specified as factory (0x00), ota_0 (0x10) …ota_15 (0x1F)
or test (0x20).
– factory (0x00) is the default app partition. The bootloader will execute the factory app unless there it
sees a partition of type data/ota, in which case it reads this partition to determine which OTA image to
boot.
* OTA never updates the factory partition.
* If you want to conserve flash usage in an OTA project, you can remove the factory partition and use
ota_0 instead.
– ota_0 (0x10) …ota_15 (0x1F) are the OTA app slots. When OTA is in use, the OTA data partition
configures which app slot the bootloader should boot. When using OTA, an application should have at
least two OTA application slots (ota_0 & ota_1). Refer to the OTA documentation for more details.
– test (0x20) is a reserved subtype for factory test procedures. It will be used as the fallback boot partition
if no other valid app partition is found. It is also possible to configure the bootloader to read a GPIO
input during each boot, and boot this partition if the GPIO is held low, see Boot from Test Firmware.
Espressif Systems 1435
Submit Document Feedback
Release v4.4