Board_build.embed_txtfiles does not put .S files in a subdirectory?

I’m building an ESP32 project that uses a signed application. The ESPIDF framework wants the file signature_verification_key.bin.S file in the bootloader directory off the project root. I have no problem actually creating the .S file, but it’s placing it in the ./.pio/build/esp32-gateway directory, rather than in ./.pio/build/esp32-gateway/bootloader. If there’s a way to tell embed_txtfiles where to put the output file, I’m missing it.

If I manually copy signature_verification_key.bin.S into ./.pio/build/esp32-gateway/bootloader and run pio run again, it finishes building and links just fine.

Is there any work around for this? I have no control over what ESPIDF wants as far as where the file is located. It’s buried deep somewhere in the framework CMake files.

platformio.ini:

[platformio]
default_envs = esp32-gateway

[env:esp32-gateway]
platform = espressif32
board = esp32-gateway
framework = espidf

board_build.partitions = partitions.csv
board_build.embed_txtfiles =
  server_certs/ca_cert.pem
  bootloader/signature_verification_key.bin

[env:esp32-poe]
platform = espressif32
board = esp32-poe
framework = espidf

board_build.partitions = partitions.csv
board_build.embed_txtfiles =
  server_certs/ca_cert.pem
  bootloader/signature_verification_key.bin

Building:

$ pio run
Processing esp32-gateway (platform: espressif32; board: esp32-gateway; framework: espidf)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-gateway.html
PLATFORM: Espressif 32 (3.5.0+sha.d93c9ef) > OLIMEX ESP32-GATEWAY
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf 3.40302.0 (4.3.2)
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - tool-ninja 1.9.0
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-riscv32-esp 8.4.0+2021r2-patch2
 - toolchain-xtensa-esp32 8.4.0+2021r2-patch2
 - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
Reading CMake configuration...
Generating assembly for certificate bundle...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Generating assembly for .pio/build/esp32-gateway/ca_cert.pem.S
Generating assembly for .pio/build/esp32-gateway/signature_verification_key.bin.S
Compiling .pio/build/esp32-gateway/src/ethernet.o
Compiling .pio/build/esp32-gateway/src/fwota.o
...
Compiling .pio/build/esp32-gateway/bootloader/bootloader_support/src/esp32/bootloader_esp32.o
*** [.pio/build/esp32-gateway/bootloader/signature_verification_key.bin.o] Source `.pio/build/esp32-gateway/bootloader/signature_verification_key.bin.S' not found, needed by target `.pio/build/esp32-gateway/bootloader/signature_verification_key.bin.o'.
================================================================================================================= [FAILED] Took 107.72 seconds =================================================================================================================

Environment    Status    Duration
-------------  --------  ------------
esp32-gateway  FAILED    00:01:47.724
============================================================================================================ 1 failed, 0 succeeded in 00:01:47.724 ============

File not where it needs to be:

$ find . -name \*.S
./.pio/build/esp32-gateway/x509_crt_bundle.S
./.pio/build/esp32-gateway/ca_cert.pem.S
./.pio/build/esp32-gateway/__pio_env/__dummy.S
./.pio/build/esp32-gateway/signature_verification_key.bin.S

Copy .S file to bootloader directory:

$ cp ./.pio/build/esp32-gateway/signature_verification_key.bin.S ./.pio/build/esp32-gateway/bootloader
$ pio run
Processing esp32-gateway (platform: espressif32; board: esp32-gateway; framework: espidf)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-gateway.html
PLATFORM: Espressif 32 (3.5.0+sha.d93c9ef) > OLIMEX ESP32-GATEWAY
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf 3.40302.0 (4.3.2)
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - tool-ninja 1.9.0
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-riscv32-esp 8.4.0+2021r2-patch2
 - toolchain-xtensa-esp32 8.4.0+2021r2-patch2
 - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
...
Linking .pio/build/esp32-gateway/bootloader.elf
Building .pio/build/esp32-gateway/bootloader.bin
esptool.py v3.1
Merged 1 ELF section
Linking .pio/build/esp32-gateway/firmware.elf
Retrieving maximum program size .pio/build/esp32-gateway/firmware.elf
Checking size .pio/build/esp32-gateway/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.6% (used 18492 bytes from 327680 bytes)
Flash: [=====     ]  54.7% (used 573769 bytes from 1048576 bytes)
Building .pio/build/esp32-gateway/firmware.bin
esptool.py v3.1
Merged 2 ELF sections
================================================================================================================= [SUCCESS] Took 21.78 seconds =================================================================================================================

Environment    Status    Duration
-------------  --------  ------------
esp32-gateway  SUCCESS   00:00:21.779
================================================================================================================= 1 succeeded in 00:00:21.779 =================================================================================================================