Repository navigation
Description
Surprise
I added build flags to [env:esp32c6] in the root platformio.ini, ran bash compile esp32c6 --examples AutoResearch --backend platformio, and the build succeeded — but the flags were not present in the compiled firmware. After several increasingly heavy-handed cache busts (touching source, deleting .build/pio/esp32c6/.pio, forcing a full rebuild) the symbols still indicated the flags hadn't been compiled in. The compiled-in flags were exactly the set carried by the Board entry in ci/boards.py.
Root cause
bash compile --backend platformio ultimately synthesises a fresh PlatformIO project at .build/pio/<env>/platformio.ini from the Board definition in ci/boards.py. That synthesised file does not inherit build_flags from the root platformio.ini. Repro: after a build run, inspect the generated file —
# .build/pio/esp32c6/platformio.ini
[env:esp32c6]
board = esp32-c6-devkitc-1
platform = …
framework = arduino
board_build.flash_size = 4MB
board_upload.flash_size = 4MB
board_build.partitions = huge_app.csv
build_flags =
-funwind-tables # ← only what ci/boards.py says
-fopt-info-all=…
-Wl,-Map,…
…The root platformio.ini is ignored by this code path. (It IS read by fbuild deploy, which makes the divergence even more confusing — flags 'work' under fbuild but vanish under PIO.)
Why this matters
Anyone reading the root platformio.ini reasonably assumes that's where env-level config lives. I lost about an hour of debug time on ESP32-C6 (USB-CDC routing flag silently absent → silent device) before noticing the generated file. Subtler defines (CORE_DEBUG_LEVEL, CONFIG_PARLIO_*) would just produce mysteriously different runtime behaviour with zero log signal.
Proposed fix
Either:
- Merge root
[env:<board>].build_flagsinto the synthesised PIO config. Read the root platformio.ini and forward overrides for the matching[env:<board>]section. - Make the synthesised platformio.ini
extends = ../../../platformio.ini::env:<board>so PIO's own override semantics apply. - Document the divergence. A loud note in
CLAUDE.mdand at the top ofplatformio.inisaying 'the bash-compile path does not read this file — editci/boards.pyinstead' would at least save the next person the same hour.
Option 1 or 2 keeps the existing single source of truth for users who already wrote configuration in the obvious place.
Environment
- Branch: fix-esp32c6-parlio (commit 5fcddee)
- bash compile esp32c6 --examples AutoResearch --backend platformio --no-filter
- Symptom first noticed while investigating ESP32-C6 parlio (perf(parlio/wave8): umbrella — single-core algorithmic optimizations to enable ISR-chunked streaming #2548 follow-up)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(ci): merge root platformio.ini build_flags into synthesised PIO e…
feat(ci): deprecate PioCompiler backend + Phase 4 cleanup (#3279) (#3295
zackees commentedon Jun 19, 2026
Replaced by the documented separation in root `./platformio.ini`'s new header comment (#3295): root is for `bash debug` only; CI compile, size-check, bloat, tests, and `bash autoresearch` all synthesise their own `platformio.ini` from `ci/boards.py`. The original `--backend platformio` symptom (discarded root `build_flags`) is now intentional behaviour by orthogonality.
Refs: #3274 (parent), #3278 / #3291 (sever), #3279 / #3295 (Phase 4 cleanup).