/      日本語

How to Specify the Partition Table for Writing to ESP32

How to apply any partition table when writing to the ESP32 mounted on TWELITE SPOT
This guide explains how to apply any partition table when writing sketches or files to the ESP32 mounted on TWELITE SPOT.

Creating the Definition File

The partition table is defined in a csv file.

In the example below, out of the 16MB flash area, 8MB is allocated for the file system.

# TWELITE SPOT 16MB with 8MB LittleFS
# Name,  Type, SubType, Offset,   Size,     Flags
nvs,     data, nvs,     0x9000,   0x5000,
otadata, data, ota,     0xE000,   0x2000,
app0,    app,  ota_0,   0x10000,  0x7F0000,
spiffs,  data, spiffs,  0x800000, 0x800000,
  • TWELITE SPOT 16MB with 8MB LittleFS is the name displayed in the Arduino IDE.
  • nvs is the area used by the system. Do not change.
  • otadata is the area used when using OTA. Do not change.
  • app0 is the area where the firmware is written.
  • spiffs is the area used by the LittleFS file system.

The units of the Offset and Size columns in the csv file are bytes, expressed in hexadecimal.

Therefore, the usable sizes for firmware and file system in the above example can be calculated as follows:

  • Size of app0: 0x7F0000 = 8323072, approximately 7.875MB
  • Size of spiffs: 0x800000 = 8388608, exactly 8MB

Registering the Definition File

Open the Arduino15 folder and add the csv file to the following path:

Arduino15/packages/esp32/hardware/esp32/x.x.x/tools/partitions

x.x.x is the version of Arduino core for the ESP32

Applying the Partition Table

From the Arduino IDE toolbar, open Tools -> Partition Scheme and select the added partition table.

The selected partition table will be applied to subsequent firmware and file system writes.