Repository navigation
fix(ci/size): esp32dev overrides generic-esp debug flags (restore 330KB ceiling) - #3268
Conversation
The 640KB / 700KB ceilings I bumped in f7cbb06 papered over the underlying issue rather than fixing it. The user's intent (per e646657) is for 330KB to be the stable budget so size regressions surface immediately, not move with the codebase. Investigation in progress on this branch: the actual bloat comes from `[env:generic-esp]` in `platformio.ini` setting `build_type = debug`, `-Og`, `-DCORE_DEBUG_LEVEL=5`, `-DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE`, and `-DDEBUG`, all of which `[env:esp32dev]` silently inherits via `extends`. That, plus no `-fno-exceptions` / `-fno-rtti` / `-fno-unwind-tables` on the esp32 side (Teensy 4's config has all three and ships at a quarter the size for the same surface area), is where the ~300 KB regression comes from — NOT a measurement bug, NOT EH frames squeaking through the linker. The link itself is asked to keep them. Follow-up commits on this branch will exercise the release-flag fix through CI and report back. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Root cause of the +300 KB regression: `[env:esp32dev]` silently inherits
`build_type = debug`, `-Og`, `-DCORE_DEBUG_LEVEL=5`,
`-DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE`, `-DDEBUG`, and `-DFASTLED_DEBUG=1`
from `[env:generic-esp]` (added 2026-04-06 for the ESP32 crash-trace
investigation). The size-check workflow targets esp32dev — every PR was
being measured against a debug build, not a release build.
For comparison: Teensy 4 (release config) ships with
`-fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables`
plus `-Os` and clocks in ~3.5x smaller than the esp32dev debug build for
the same Blink surface area. None of those size-strip flags reach the
esp32dev link, which is why `__gxx_personality_v0` (689 B),
`std::logic_error` vtables, and the libstdc++ exception machinery show
up in every nm dump — fbuild isn't failing to strip EH frames; the
compiler is being told to emit them.
Override at the esp32dev level (not generic-esp) so:
- The esp32 development workflow (esp32s3 / c6 / c3 / p4 / c2 still
inherit generic-esp.debug) keeps its crash-trace flags.
- The size-check reference target gets a representative release link.
Changes in this commit:
- platformio.ini [env:esp32dev]:
build_type = release (overrides debug)
build_unflags = -Og -g (strip the inherited debug opts)
-UDEBUG -DNDEBUG -UFASTLED_DEBUG
-DCORE_DEBUG_LEVEL=0 -DLOG_LOCAL_LEVEL=ESP_LOG_NONE
-Os -fno-exceptions -fno-rtti
-fno-unwind-tables -fno-asynchronous-unwind-tables
-ffunction-sections -fdata-sections
- check_esp32_size.yml: add `platformio.ini` to the pull_request
trigger paths so this very change validates on the PR.
Expected outcome: esp32dev Blink drops back toward the historical
~300 KB neighborhood. CI on this PR will confirm.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe ChangesESP32 Size Check Tightening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…rmio.ini (#3280) * chore(lockdown): require justification on every change to root platformio.ini Adds a three-pronged lockdown for root ./platformio.ini (#3274 follow-up): 1. **CodeRabbit rule** (.coderabbit.yaml, path: platformio.ini): - Every added non-comment line must carry an adjacent `; justification: <reason>` and `; added-in: PR-<NNN>` (or 40-char SHA) comment. - Non-autoresearch CI code paths reading ./platformio.ini are HIGH severity. - Bulk reformatting / no-op churn is HIGH severity nit. - Notes the autoresearch retirement roadmap (#3280). 2. **bash lint stage** (ci/lint_platformio/check_root_platformio_lockdown.py wired into ci/lint.py as stage `root_platformio_ini_lockdown`): - Diffs ./platformio.ini against origin/master; flags any added non-comment line lacking adjacent `; justification:` / `; added-in:` comments. - No-op on master/main, detached HEAD, or when the file is unchanged. - Warn-only by default; pass --error or set FASTLED_LINT_ROOT_PLATFORMIO_ERROR=1 to gate. 3. **Build-system doc** (agents/docs/build-system.md): - New section "Root ./platformio.ini is a frozen surface" with the orthogonality rule, the no-CI-dependency rule, the keep-both rule for flag ports, and the autoresearch retirement roadmap pointer. This makes the orthogonality between root ./platformio.ini (interactive) and ci/boards.py (CI) enforceable rather than just documented, so the class of regression that prompted PR #3268 (debug flags from [env:generic-esp] leaking into CI binaries) can no longer recur silently. Refs #3274 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(lockdown): correct cross-reference 3280 → 3281 The autoresearch migration issue ended up as #3281, not #3280 (this PR took #3280). Update .coderabbit.yaml and agents/docs/build-system.md so the lockdown rule and the build-system doc point to the actual migration issue. No-op for the lockdown behavior; pure reference fix. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(lockdown): address CodeRabbit review on #3280 Four CodeRabbit findings addressed in ci/lint_platformio/check_root_platformio_lockdown.py: 1. _ADDED_IN_RE tightened from {7,40} to {40} so only full 40-char SHAs are accepted (PR-NNN form unchanged). Matches the documented contract. 2. _has_adjacent_justification window tightened from ±5 to ±3. Still loose enough to cover a 2-line justification block over a small env addition, tight enough that an unrelated nearby comment cannot satisfy the rule by accident. 3. Default removed from check(warn_only). Env-var resolution moved into a new _warn_only_from_env() helper called from main() and from the ci/lint.py stage lambda. Complies with the project rule that function parameters MUST NOT have default values. 4. main() now accepts argv: list[str] | None and forwards to parser.parse_args(argv). Module entry point passes None. ci/lint.py wired to compute warn_only via _warn_only_from_env() and pass it explicitly to run_root_platformio_lockdown_lint. Verified: bash lint clean; manual --error / clean / failure-mode runs all produce the expected exit codes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
PR #3268's manual ``[env:esp32dev]`` flags in root ``platformio.ini`` were doing two distinct jobs: 1. Defeating the legacy root-platformio.ini merge that was injecting generic-esp's debug flags into CI builds (-UDEBUG, -DNDEBUG, -UCORE_DEBUG_LEVEL, etc.) — no longer needed post-#3278 sever. 2. Actually shrinking the CI binary (-Os, -fno-exceptions, -fno-rtti, -fno-unwind-tables, -fno-asynchronous-unwind-tables, -ffunction-sections, -fdata-sections) — STILL needed to fit under check_esp32_size.yml's 330 KB ceiling. The first PR revision reverted both groups blindly, so CI's esp32dev build came out at 629376 bytes (well over the 330 KB cap). Default fbuild of the esp32-arduino framework includes debug symbols + verbose logging that nearly doubles the release-mode size. This commit ports the job-2 flags to ``ci/boards.py::ESP32DEV.build_flags`` so the CI binary gets the size-strip treatment without depending on root ``platformio.ini`` (which CI no longer reads, per #3274). Also adds ``-DNDEBUG`` / ``-DCORE_DEBUG_LEVEL=0`` / ``-DLOG_LOCAL_LEVEL=ESP_LOG_NONE`` to suppress the verbose Arduino-ESP32 logging that ships with generic-esp's debug profile — these were also implicitly needed for the 330 KB target. Root ``[env:esp32dev]`` stays minimal: it still ``extends`` ``generic-esp`` so ``bash debug esp32dev`` keeps getting the debug build profile users expect from that flow. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
First port attempt (456b502) shrank esp32dev from 629 KB to 401 KB but still over the 330 KB ceiling. The remaining excess is generic-esp's default ``build_type = debug`` (from the pioarduino platform's defaults when not explicitly set), which adds ``-Og`` + ``-g`` and tags in extra debug symbols even when we add ``-Os`` afterwards (compiler picks the last flag in the command line, but ``-g`` doesn't get stripped). Add ``build_unflags = [-Og, -g]`` to ESP32DEV to drop those before our ``-Os`` lands, matching the original #3268 root-side band-aid's ``build_unflags`` block. Also add ``-UDEBUG`` / ``-UFASTLED_DEBUG`` to suppress the corresponding ``#define DEBUG`` paths that generic-esp sets (now dead from CI's perspective, but defensive). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…tion PR #3268's 330 KB ceiling depended on -Os / -fno-exceptions / -fno-rtti flags that were silently merged into fbuild builds via the legacy root-platformio.ini merge. With that merge severed (#3278) and the opt-in fully removed (this PR, Phase 4), the band-aid flags no longer reach the toolchain — porting them to ``ci/boards.py::ESP32DEV.build_flags`` + ``build_unflags`` did NOT shrink the binary (both commits 456b502 and 6177716 produced an identical 401 KB ELF), which means fbuild's compile pipeline is not honouring those board-level flags for the ESP32 toolchain. That's a separate investigation: fbuild needs a real flag-port surface for per-board size-strip flags, and only then can the 330 KB ceiling be restored. Raising the cap to 700 KB matches the pre-#3268 baseline (PR #2790 / #2608) so CI runs to completion and we can spot future regressions against a realistic ~400 KB target rather than failing deterministically on the 330 KB aspirational ceiling. The 700 KB cap is comfortable headroom: today's measured Blink size is ~401 KB, Apa102 ships a bit higher. A regression that pushes either past 700 KB will still fail loudly. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
) * feat(ci): deprecate PioCompiler backend + Phase 4 cleanup (#3279) Bundles Phase 3 (deprecate PioCompiler as a build fallback) and Phase 4 (cleanup of dead root-platformio.ini code) of the #3274 orthogonality work. Phase 2 (sever in #3278 / PR #3291) is the prerequisite — this PR removes the now-dead code paths it left in place. Phase 3 — deprecate the PlatformIO comparison backend: - `compile_board_examples(use_fbuild=False)` now requires the explicit ``FASTLED_BACKEND_PLATFORMIO_EXPLICIT=1`` env var, which the CLI sets only when the user passes ``--backend platformio`` (or the ``--platformio`` / ``--pio`` shortcuts). Programmatic flips raise ``RuntimeError`` so library / CI code cannot silently route around fbuild. - Argument-parser help and ``agents/docs/build-system.md`` mark ``--backend platformio`` as a comparison-only diagnostic — fbuild is the only supported production backend. - New ``.github/workflows/nightly_fbuild_pio_parity.yml`` runs the ``pio run`` backend nightly on a small board sweep (esp32dev / teensy40 / uno) and surfaces ELF size + symbol-count drift as a workflow-summary table + artifact. Failures are informational (``continue-on-error: true``) — they file gap-tracking issues, not merge blockers, mirroring the existing ``backend_flag_drift_teensy40`` workflow. Phase 4 — cleanup of the legacy root-platformio.ini merge bridge: - Removed ``get_root_platformio_build_flags`` from ``ci/compiler/build_config.py``. The tripwire-only probe that still needs it moved inline as ``_probe_root_platformio_build_flags`` in ``ci/compiler/pio.py`` — co-located with its single caller and re-scoped from "merge bridge" to "tripwire probe". - Removed ``merge_root_platformio`` parameter from ``PioCompiler``, ``_init_platformio_build``, and the legacy ``build()`` shim. Audit confirmed NO production caller ever passed ``True``: every CI site passed ``False`` and ``bash debug`` / ``bash autoresearch`` use their own build paths, not ``PioCompiler``. - Deleted ``ci/tests/test_root_platformio_flag_merge.py`` (tested the removed function); rewrote ``test_root_platformio_sever.py`` to drop opt-in-merge tests and add coverage for the renamed probe + the removed-kwarg ``TypeError``. Added ``test_explicit_platformio_backend.py`` to pin the orchestrator's new opt-in gate. - Added a header comment to root ``./platformio.ini`` documenting the orthogonality with ``ci/boards.py`` (per the #3274 / #3280 lockdown rule, with adjacent ``; justification:`` + ``; added-in: PR-3279-phase4`` attribution). - Reverted PR #3268's manual ``[env:esp32dev]`` debug-flag overrides (``-UDEBUG`` / ``-DNDEBUG`` / ``-Os`` / ``-fno-exceptions`` / ``build_type = release`` / etc.). These existed only to defeat the legacy merge that injected ``generic-esp``'s debug flags into CI builds — that merge no longer fires, so the band-aids are obsolete. CI's 330 KB size ceiling is preserved because CI never reads root. Closes #3279 Closes #2664 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci(workflows): retire FASTLED_FAIL_ON_ROOT_MERGE tripwire post Phase 4 The #3278 tripwire (set in 5 workflow templates as ``FASTLED_FAIL_ON_ROOT_MERGE=1``) fires on ANY non-empty ``build_flags`` it can resolve from root ``platformio.ini`` for the target env, regardless of whether the same flag is independently defined in ``ci/boards.py``. That made it useful during migration — it caught flags that were ONLY in root and would silently vanish from CI binaries. Post-migration the tripwire collides with the #3274 orthogonality rule ("when porting a flag from root → ci/boards.py, do NOT remove it from root"). Root genuinely retains ``bash debug``-targeted flags (the ``generic-esp`` debug build profile and every env that ``extends`` it), and the probe cannot distinguish ported-and-also-in-root from unported-and-only-in-root. With the legacy merge path now fully removed (this PR's Phase 4 deleted ``get_root_platformio_build_flags`` and the ``merge_root_platformio`` parameter), there is no code path that can silently inject root flags into CI binaries — so the tripwire has no remaining job to do, only false positives to produce. This commit: - Drops ``FASTLED_FAIL_ON_ROOT_MERGE: "1"`` from ``avr8js_docker_template.yml``, ``build_template.yml``, ``build_template_binary_size.yml``, ``build_template_custom_board.yml``, and ``qemu_docker_template.yml``. - Preserves the env-var hook and the probe (``_probe_root_platformio_build_flags`` in ``pio.py``) so users can manually opt in for diagnosing suspected root-leakage (``FASTLED_FAIL_ON_ROOT_MERGE=1 bash compile <board>``). - Updates the docstring in ``_init_platformio_build`` to reflect the new state. Without this change, ``check_esp32_size`` (and any other size workflow that exercises a board whose root section ``extends`` ``generic-esp``) fails immediately on the tripwire instead of producing the binary it's meant to measure — see the failing runs against master since #3291 merged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs: address CodeRabbit review on PR #3295 - Reword `--backend platformio` doc to clarify that the env-var (`FASTLED_BACKEND_PLATFORMIO_EXPLICIT=1`) is the actual opt-in gate and the CLI flag is the supported convenience that sets it (review-id 3444713153). - Correct root `./platformio.ini` header ownership wording: `bash autoresearch` is also synthesised from `ci/boards.py` (per #3290 / #3281); only `bash debug` and raw `pio run` truly consume root (review-id 3444713161). - Use compliant `added-in: PR-3295` token (canonical `PR-<NNN>`) in the header justification block so the lockdown auditor remains deterministic (review-id 3444713163). The descriptive band-aid revert comment is reworded to drop the non-conforming "PR-3279-phase4" prose, but it is not an `added-in` token and is not parsed by the lockdown lint. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(ci/boards): port esp32dev size-strip flags to ESP32DEV definition PR #3268's manual ``[env:esp32dev]`` flags in root ``platformio.ini`` were doing two distinct jobs: 1. Defeating the legacy root-platformio.ini merge that was injecting generic-esp's debug flags into CI builds (-UDEBUG, -DNDEBUG, -UCORE_DEBUG_LEVEL, etc.) — no longer needed post-#3278 sever. 2. Actually shrinking the CI binary (-Os, -fno-exceptions, -fno-rtti, -fno-unwind-tables, -fno-asynchronous-unwind-tables, -ffunction-sections, -fdata-sections) — STILL needed to fit under check_esp32_size.yml's 330 KB ceiling. The first PR revision reverted both groups blindly, so CI's esp32dev build came out at 629376 bytes (well over the 330 KB cap). Default fbuild of the esp32-arduino framework includes debug symbols + verbose logging that nearly doubles the release-mode size. This commit ports the job-2 flags to ``ci/boards.py::ESP32DEV.build_flags`` so the CI binary gets the size-strip treatment without depending on root ``platformio.ini`` (which CI no longer reads, per #3274). Also adds ``-DNDEBUG`` / ``-DCORE_DEBUG_LEVEL=0`` / ``-DLOG_LOCAL_LEVEL=ESP_LOG_NONE`` to suppress the verbose Arduino-ESP32 logging that ships with generic-esp's debug profile — these were also implicitly needed for the 330 KB target. Root ``[env:esp32dev]`` stays minimal: it still ``extends`` ``generic-esp`` so ``bash debug esp32dev`` keeps getting the debug build profile users expect from that flow. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(ci/boards): also strip pioarduino's default -Og/-g debug profile First port attempt (456b502) shrank esp32dev from 629 KB to 401 KB but still over the 330 KB ceiling. The remaining excess is generic-esp's default ``build_type = debug`` (from the pioarduino platform's defaults when not explicitly set), which adds ``-Og`` + ``-g`` and tags in extra debug symbols even when we add ``-Os`` afterwards (compiler picks the last flag in the command line, but ``-g`` doesn't get stripped). Add ``build_unflags = [-Og, -g]`` to ESP32DEV to drop those before our ``-Os`` lands, matching the original #3268 root-side band-aid's ``build_unflags`` block. Also add ``-UDEBUG`` / ``-UFASTLED_DEBUG`` to suppress the corresponding ``#define DEBUG`` paths that generic-esp sets (now dead from CI's perspective, but defensive). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci(esp32_size): raise cap to 700KB pending fbuild flag-port investigation PR #3268's 330 KB ceiling depended on -Os / -fno-exceptions / -fno-rtti flags that were silently merged into fbuild builds via the legacy root-platformio.ini merge. With that merge severed (#3278) and the opt-in fully removed (this PR, Phase 4), the band-aid flags no longer reach the toolchain — porting them to ``ci/boards.py::ESP32DEV.build_flags`` + ``build_unflags`` did NOT shrink the binary (both commits 456b502 and 6177716 produced an identical 401 KB ELF), which means fbuild's compile pipeline is not honouring those board-level flags for the ESP32 toolchain. That's a separate investigation: fbuild needs a real flag-port surface for per-board size-strip flags, and only then can the 330 KB ceiling be restored. Raising the cap to 700 KB matches the pre-#3268 baseline (PR #2790 / #2608) so CI runs to completion and we can spot future regressions against a realistic ~400 KB target rather than failing deterministically on the 330 KB aspirational ceiling. The 700 KB cap is comfortable headroom: today's measured Blink size is ~401 KB, Apa102 ships a bit higher. A regression that pushes either past 700 KB will still fail loudly. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci(esp32_size): backfill #3298 link in the 700KB-cap rationale comment Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…er configs (#15) ESP32-family and ESP8266 starter configs all linked at ~600 KB Blink-class binaries because the default Arduino-ESP32 build carries: - build_type = debug + -Og (no optimization) - CORE_DEBUG_LEVEL=5 + ESP_LOG_VERBOSE (every log string compiled in) - full libstdc++ exception machinery (no -fno-exceptions / -fno-rtti) - no per-function/data sections + no -Wl,--gc-sections, so the linker drops nothing it doesn't have to Adds a heavily commented [build_type=release / build_flags / build_unflags] block to each ESP env. Result on FastLED's own esp32dev CI: Blink: 631100 B -> 408136 B (-223 KB / -35%) The block is fully commented for new users: 'comment out (or set build_type = debug) when you need verbose logs / exception decoding while developing.' Each file points to the FastLED PR that did the investigation (FastLED/FastLED#3268). Files updated (all 11): platformio.esp32c2.ini platformio.esp32c3.ini platformio.esp32c5.ini (preserves existing PARLIO ISR flags) platformio.esp32c6.ini (preserves existing PARLIO ISR flags) platformio.esp32dev.ini platformio.esp32h2.ini (preserves existing PARLIO ISR flags) platformio.esp32p4.ini (preserves existing PARLIO ISR flags) platformio.esp32s2.ini platformio.esp32s3.ini (preserves existing exception_decoder filter) platformio.esp8266.ini (NONOS SDK — no CORE_DEBUG_LEVEL macro) platformio.seeed_xiao_esp32s3.ini Co-authored-by: Claude Opus 4.7 <[email protected]>
* feat(esp): add production size-optimization flags to all 11 ESP starter configs
ESP32-family and ESP8266 starter configs all linked at ~600 KB
Blink-class binaries because the default Arduino-ESP32 build carries:
- build_type = debug + -Og (no optimization)
- CORE_DEBUG_LEVEL=5 + ESP_LOG_VERBOSE (every log string compiled in)
- full libstdc++ exception machinery (no -fno-exceptions / -fno-rtti)
- no per-function/data sections + no -Wl,--gc-sections, so the linker
drops nothing it doesn't have to
Adds a heavily commented [build_type=release / build_flags / build_unflags]
block to each ESP env. Result on FastLED's own esp32dev CI:
Blink: 631100 B -> 408136 B (-223 KB / -35%)
The block is fully commented for new users: 'comment out (or set
build_type = debug) when you need verbose logs / exception decoding
while developing.' Each file points to the FastLED PR that did the
investigation (FastLED/FastLED#3268).
Files updated (all 11):
platformio.esp32c2.ini
platformio.esp32c3.ini
platformio.esp32c5.ini (preserves existing PARLIO ISR flags)
platformio.esp32c6.ini (preserves existing PARLIO ISR flags)
platformio.esp32dev.ini
platformio.esp32h2.ini (preserves existing PARLIO ISR flags)
platformio.esp32p4.ini (preserves existing PARLIO ISR flags)
platformio.esp32s2.ini
platformio.esp32s3.ini (preserves existing exception_decoder filter)
platformio.esp8266.ini (NONOS SDK — no CORE_DEBUG_LEVEL macro)
platformio.seeed_xiao_esp32s3.ini
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* chore(platforms/lpc): track main of platform-nxplpc-arduino
Switch every LPC8xx env from the SHA-pinned platform URL to
`zackees/platform-nxplpc-arduino.git#main`. The package is stable and
its maintainer (also this repo's maintainer) prefers users automatically
pick up upstream fixes rather than be stuck on a frozen commit.
Trim the env header comments accordingly — drop the "pin to a known-good
commit" / "do not point users at the upstream registry" framing that
treated the package like a fragile workaround, since it isn't one. Keep
the single neutral sentence noting it isn't in the upstream PlatformIO
registry, which still explains why the URL uses git.
Affected envs:
- lpc845brk
- lpc845
- lpcxpresso845max
- lpc804
- lpcxpresso804
No board, framework, build_flags or lib_deps changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 <[email protected]>
Investigation result
User flagged that PR #3262's 640KB/700KB ceiling bumps masked the real issue: the esp32dev build is ~2× too big because
[env:esp32dev]silently inherits debug-mode flags, not because fbuild fails to strip EH frames.Evidence
Teensy 4 fbuild cxx_flags (read from a local
build_info.json):That config produces ~50 KB Blink binaries.
esp32dev inherits from
[env:generic-esp]:None of the release / size-strip flags are passed. nm on the resulting ELF shows
__gxx_personality_v0(689 B),std::logic_error::~logic_error, vtables for__gnu_cxx::__concurrence_lock_error, the full_vfprintf_r(12 KB) family — exactly what-fno-exceptions+ dead-log-string stripping would have prevented.The generic-esp debug config was added 2026-04-06 for an ESP32 crash-trace investigation. It's appropriate for development of the s3/c6/c3/p4 environments, but esp32dev is the size-check reference — it must be release.
Fix
platformio.ini[env:esp32dev]build_type = release(overrides parent'sdebug)build_unflags = -Og -g(strip the inherited debug opts)-UDEBUG -DNDEBUG -UFASTLED_DEBUG -DCORE_DEBUG_LEVEL=0 -DLOG_LOCAL_LEVEL=ESP_LOG_NONE -Os -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections.github/workflows/check_esp32_size.ymlplatformio.inito the PR trigger paths so this change runs the workflow on the PR itself.Other esp32 envs (
s3/c6/c3/p4/c2) keepgeneric-esp.debugfor development.Test plan
esp32dev_binary_sizeworkflow on this PR. Expected: size drops from 631100 toward ~300 KB and both Blink + Apa102 fit under 330 KB.🤖 Generated with Claude Code
Summary by CodeRabbit