Cannot build ESP32 firmware image with default partition layout

I am adapting the adafruit/nina-fw firmware for ESP32 to build with PlatformIO. I have the project compiling, but I’m unsure how to port over the construction of the firmware image binary.

The original code uses this partitions.csv file:

# Name,   Type, SubType, Offset,  Size
nvs,      data, nvs,     0x9000,  0x6000
phy_init, data, phy,     0xf000,  0x1000
certs,    data, 0x04,    0x10000, 0x20000
factory,  app,  factory, 0x30000, 0x180000

The combine.py script merges together the boot loader, some certificate trust store data, and some other contents. At runtime, the code uses esp_partition_find_first() to locate the certificate data.

It looks like PlatformIO embeds binary data differently using board_build.embed_files. That being the case, I think I ought to be able to just use the default partitions_singleapp.csv layout. But this always errors with:

> Could not find the any filesystem section in the partitions table ~/.platformio/packages/framework-espidf@3.40405.230623/components/partition_table/partitions_singleapp.csv

My sdkconfig.nina-fw file is already set up for “Single factory app, no OTA”:

CONFIG_PARTITION_TABLE_SINGLE_APP=y
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"

What’s missing? Why is PlatformIO being insistent on my having a SPIFFS partition?

Other questions: Is it possible to embed the certificate data using the named partition method (avoiding a code change)? And I don’t have to do anything to have the bootloader embedded into the firmware image, right?

My platformio.ini file so far:

[platformio]
src_dir = main

[env:nina-fw]
platform = espressif32 @ 5.4.0  # for esp-idf 4.4.5
framework = espidf
board = esp32-s3-devkitc-1
# board_build.partitions = partitions.csv

Related thread which doesn’t really answer why the default partition layout doesn’t work.

Source that generates the error message.

But this only happens when you click “Build Filesystem Image” and not “Build Firmware” right?

Since there are no references to roots.pem in the CMakeFile, I don’t think it uses either “Filesystem” or “embed_files” way of including that data. It literally only uses in combine.py. Which means, you should be able to run the combine.py script with just the adapted path to build/nina-fw.bin as-is.

Note that you can even let this be triggered automatically by post-action on the firmware.bin. See https://docs.platformio.org/en/latest/scripting/actions.html

I should mention I’m using PlatformIO Core from the CLI. I do not have a build target, only buildfs, so I assumed this is what I’m supposed to use on ESP32.

I’d be happy eliminating the combine.py script.