Repository navigation
Description
Context
Discovered while landing PR #3295 (#3279 Phase 4). The PR ports the band-aid size-strip flags (-Os, -fno-exceptions, -fno-rtti, -fno-unwind-tables, -fno-asynchronous-unwind-tables, -ffunction-sections, -fdata-sections, plus build_unflags = -Og -g) from root platformio.ini's [env:esp32dev] section to ci/boards.py::ESP32DEV.build_flags / .build_unflags, since CI no longer reads root after the #3278 sever.
Symptom
After porting the flags, bash compile esp32dev --examples Blink (which CI uses) still produces an identical 401240-byte ELF before and after adding them — two consecutive PR commits (456b502 with build_flags only, 6177716 adding build_unflags too) both produced the same 401240-byte binary. That's strong evidence fbuild's compile pipeline is not honouring board-level build_flags / build_unflags for the ESP32 toolchain.
The synthesised platformio.ini DOES contain the flags correctly (verified by Board.to_platformio_ini() locally), so the data is reaching the file fbuild reads — but fbuild itself appears to either drop them or get them overridden later by the platform's default toolchain config.
Reproduce
- Check out PR feat(ci): deprecate PioCompiler backend + Phase 4 cleanup (#3279) #3295 at commit 8764099.
bash compile esp32dev --examples Blink.- Observe the resulting ELF at
.build/pio/esp32dev/.pio/build/esp32dev/firmware.elfis ~401 KB despite ESP32DEV.build_flags containing-Os -fno-exceptions -fno-rtti -ffunction-sections -fdata-sectionsetc. - Compare the actual compiler command line fbuild emits (or
firmware.map's--gc-sectionsevidence) against whatci/boards.pyspecifies — most likely the flags either never reach the compile commands or are overridden by the framework's own command-line later.
Why it matters
PR #3268 introduced a 330 KB ceiling in check_esp32_size.yml predicated on those band-aid flags working. With the legacy root-merge path gone, the ceiling is unreachable until fbuild has a working flag-port surface. PR #3295 raises the ceiling back to 700 KB as a stopgap. Tightening it back to 330 KB requires fixing this fbuild gap first.
Acceptance
Board.build_flagsandBoard.build_unflagsfromci/boards.pyreach the actual compile commands fbuild issues for ESP32 boards.bash compile esp32dev --examples Blinkwith the size-strip flag set produces an ELF measurably smaller than 401 KB (target: ≤ 330 KB).check_esp32_size.ymlcan be tightened back tomax_size: 330000.
Refs
- PR Deprecate PioCompiler as build fallback + Phase 4 cleanup (#3274 Phase 3) #3279 (Phase 4 cleanup that exposed the gap)
- PR feat(ci): deprecate PioCompiler backend + Phase 4 cleanup (#3279) #3295 (this PR; raises the cap as stopgap)
- PR Sever root platformio.ini merge from CI compile path (#3274 Phase 2) #3278 (Phase 2 sever)
- PR fix(ci/size): esp32dev overrides generic-esp debug flags (restore 330KB ceiling) #3268 (originated the 330 KB band-aid; flags listed there)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
ci(esp32_size): backfill #3298 link in the 700KB-cap rationale comment
feat(ci): deprecate PioCompiler backend + Phase 4 cleanup (#3279) (#3295
ci(lockdown): freeze max_size in every check_*_size.yml + add lint en…
docs(ci/size): catalogue check_*_size.yml thresholds as real ceilings…
zackees commentedon Jul 27, 2026
Re-measured on current master (2026-07-27). The propagation gap this issue describes is fixed — the remaining redness has a different cause.
Flags now reach the compile commands
bash compile esp32dev --examples Blink, then inspecting.build/pio/esp32dev/.fbuild/build/release/compile_commands.json(58 TUs):-Os-fno-exceptions-fno-rtti-fno-unwind-tables-ffunction-sections-fdata-sectionsbuild_unflagsalso works: a token-exact scan across all entries finds no-g*at all, and no-Otoken other than-Os. Both-Ogand-gare correctly stripped.What's left is code size, not plumbing
With the flags fully applied, esp32dev Blink is 391543 bytes (382 KB) — down from the 401240 bytes recorded in the issue body, so the flags are measurably doing something, but still ~52 KB over the 330 KB ceiling.
Against this issue's acceptance criteria:
Board.build_flags/build_unflagsreach the actual compile commandscheck_esp32_size.ymltightened to 330000 — already at 330000, but CI stays red on the size gapSuggested disposition
The specific defect named in the title is resolved. The residual ~52 KB is per-symbol code size, which is exactly what #2974 / #2886 and their children track — not a fbuild flag-port problem.
Suggest closing this as "propagation fixed" and letting the remainder live in the bloat metas. Leaving that call to a maintainer rather than closing unilaterally.
Meanwhile #3743 corrects
check_esp32_size.yml, which still tells readers the redness is caused by this issue and to "fix #3298" — that comment now sends people after an already-fixed bug.fix(ci): correct size-gap arithmetic and scope the #3298 claim
zackees commentedon Jul 27, 2026
Correction to my previous comment: the size gap figure was wrong.
391543 − 330000 = 61543 bytes (~61.5 KB) over the ceiling, not the "~52 KB" I wrote. That came from mixing units — comparing 382 KB (391543/1024) against the 330 KB ceiling read as decimal. In KiB it's 382.4 − 322.3 = 60.1 KiB.
Everything else in that comment stands: the flags do reach all 58 TUs,
build_unflagsstrips both-Ogand-g, and the binary is measurably down from 401240 → 391543. Only the remaining-gap number was off.docs(ci): correct stale esp32 size-ceiling attribution (#3298) (#3743)