Skip to main content

ESP-IDF C5 - Assign. 2.2

·2 mins·
Table of Contents
Create a custom partition table that adds a spiffs filesystem partition, then flash it and confirm the change by reading it back from flash.
WS00C - This article is part of a series.
Part 7: This Article

In this assignment, you’ll set a custom partition table using VS Code.

Assignment steps
#

  1. Enable the custom partition table in menuconfig.
  2. Add a spiffs partition using the partition table editor.
  3. Build and flash the new partition table.
  4. Read the partition table again to confirm the change.

Enable the custom partition table in menuconfig
#

  1. Open menuconfig: > ESP-IDF: SDK Configuration Editor (menuconfig)

  2. Go to Partition TableCustom Partition Table CSV.

    This tells ESP-IDF to build the project’s partition table from a CSV file that you edit yourself, instead of one of the built-in schemes.

Add a spiffs partition using the partition table editor
#

  1. Open the editor: > ESP-IDF: Open Partition Table Editor UI
  2. Copy the partition table from Assignment 2.1 as your starting point.
  3. Add a spiffs partition after the existing entries.
Custom partition table

Custom partition table

Build and flash the new partition table
#

  1. Build the partition table: > ESP-IDF: Build Partition Table
  2. Flash the partition table: > ESP-IDF: Flash (UART) Your Project

Read the partition table again to confirm the change
#

Read the partition table back from flash, as you did in Assignment 2.1, to confirm the new spiffs partition was written correctly.

  1. Read the flash and dump the partition table into a .bin file using esptool.py:

    esptool.py -p <YOUR-PORT> read_flash 0x8000 0x1000 partition_table.bin
    <YOUR-PORT> is the same port you use to flash the device (e.g. /dev/tty.usbmodem1131101 or COM25).
  2. Convert the partition_table.bin file to a readable format using gen_esp32part.py:

    python $IDF_PATH/components/partition_table/gen_esp32part.py partition_table.bin

    You get this output:

    Parsing binary partition input...
    Verifying table...
    # ESP-IDF Partition Table
    # Name, Type, SubType, Offset, Size, Flags
    nvs,data,nvs,0x9000,16K,
    otadata,data,ota,0xd000,8K,
    phy_init,data,phy,0xf000,4K,
    factory_app,app,factory,0x10000,1M,
    ota_0,app,ota_0,0x110000,1M,
    ota_1,app,ota_1,0x210000,1M,
    fs,data,spiffs,0x310000,64K,

    The table now includes the fs partition, confirming that the custom partition table with the spiffs filesystem was flashed successfully.

Conclusion
#

In this assignment, you built a custom partition table CSV based on the OTA scheme from the previous assignment and added a spiffs partition for a filesystem. You then built, flashed, and verified the new partition table. With the partition table in place, you’re ready to move on to OTA updates.

Next step
#

Next step → Lecture 3

Or go back to navigation menu

WS00C - This article is part of a series.
Part 7: This Article

Related

ESP-IDF C5 - Assign. 1.1

·9 mins
Write an application that connects the ESP32-C5 to a Wi-Fi network as a station, restricts the radio to the 5 GHz band, and reports the band and channel it joined.

ESP-IDF C5 - Assign. 2.1

·3 mins
Switch the partition table to a scheme that supports OTA updates, and confirm the change by reading it back from flash.

ESP-IDF C5 - Assign. 3.1

·6 mins
Configure the partition table for OTA, then write an application that connects to Wi-Fi and performs a single OTA update by downloading new firmware from a fixed HTTPS URL with esp_https_ota.