Repository navigation
perf(esp32): suppress Arduino-ESP32 boot banner via build-flag shim (#2886 Stage 2) - #2894
Conversation
…2886 Stage 2) Closes #2893. Adds a build-flag-gated strong override of the Arduino-ESP32 core's `shouldPrintChipDebugReport()` weak symbol. Setting build_flags = -DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1 in `platformio.ini` (or the equivalent in Arduino IDE `compiler.cpp.extra_flags`) makes the optimizer fold both `if (shouldPrintChipDebugReport())` branches at vendor `main.cpp:55` and `main.cpp:63` to dead code. `--gc-sections` then drops `printBeforeSetupInfo()` (~1,464 B at top-25 row #21 of #2886) plus its ~1-2 KB of formatted-stream rodata carrier strings — projected ~3 KB of flash savings on the ESP32-S3 NEOPIXEL Blink baseline. ## Why a build flag, not an include? The earlier design (an opt-in include `#include <extras/suppress_arduino_chip_debug_report.cpp.hpp>` in the user sketch) collided with the unity-build linter: every `.cpp.hpp` under `src/` is required to participate in a `_build.cpp.hpp` aggregator, which in turn is compiled by a `+.cpp` wrapper in `src/fl/build/`. The shim file is therefore unavoidably part of the library compilation unit. Gating the body on `FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT` and `FL_IS_ESP32` keeps the default behavior unchanged for every user who doesn't explicitly opt in. Opt-in via build flag is the same ergonomic shape as `FASTLED_RMT_STATIC_ALLOCATION` (#2846) and `FASTLED_LOG_VERBOSITY` (#2791) — recognizable to existing users following the bloat-reduction docs. ## Files - `src/extras/suppress_arduino_chip_debug_report.cpp.hpp` — the shim. Empty body unless `FL_IS_ESP32 && FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT`. - `src/extras/_build.cpp.hpp` — unity-build aggregator for `extras/`, documented as the home for build-flag-gated shims. - `src/fl/build/extras+.cpp` — independently-compiled wrapper TU that pulls `extras/_build.cpp.hpp` into the library build (matches the existing `platforms+.cpp` / `third_party+.cpp` pattern). - `ci/lint_cpp/test_unity_build.py` — register `fl/build/extras+.cpp` in `EXPECTED_BUILD_FILES` so the unity-build linter accepts the new wrapper. ## Verification - `bash lint --cpp` → all C++ linting checks pass; the pre-existing PlatformIO-internal-usage warnings (issue #2701) are warn-only and unchanged by this PR. - Flash savings (`bash bloat esp32s3 --build` with `-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1`) measured by the Stage 6 verification gate; this PR only ships the mechanism. ## User-facing behavior | Build flag | ESP32 target | Effect | |---|---|---| | unset / `=0` | yes | no change (vendor weak default fires) | | `=1` | yes | strong override → `printBeforeSetupInfo()` dead-stripped | | any | no | shim expands to nothing | Refs #2886, #2893.
|
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 (4)
📝 WalkthroughWalkthroughThis PR implements Stage 2 of the bloat-reduction plan by adding an opt-in shim that suppresses the Arduino-ESP32 boot-banner code path. The shim provides a strong override of the vendor's weak ChangesBoot-banner suppression shim and build integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)src/fl/build/extras+.cppsrc/fl/build/extras+.cpp:10:10: fatal error: 'platforms/new.h' file not found ... [truncated 1067 characters] ... ng/install/lib/clang/18/include" 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 |
…rlay (#2886 Stage 3) (#2896) Closes #2895. Adds a documented, opt-in ESP-IDF sdkconfig overlay that users plug into `board_build.sdkconfig_defaults`. Drops ~10-15 KB of release-build flash on a typical ESP32 LED installation by disabling IDF components that a deployed strip never uses: | Knob | Eliminates | Savings | |---|---|---:| | `CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=n` | libespcoredump (top-25 rows #18 + #25, ~3 KB symbols + ~5 KB tail) | ~8 KB | | `CONFIG_LOG_DEFAULT_LEVEL=ESP_LOG_NONE` | libesp_diagnostics + IDF log strings (top-25 row #19) | ~3 KB | | `CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y` | bootloader-stage UART chatter | ~1 KB | | `CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y` | panic-time backtrace formatter | ~1-2 KB | `CONFIG_BT_ENABLED=n` is shipped commented-out (~15 KB extra when the project currently has BT on) — users uncomment when they know their sketch doesn't touch BLE/BT. ## Files - `tools/sdkconfig_for_smallest_fastled.defaults` — the overlay itself, with inline per-knob comments grounding each line in the #2886 top-25 attribution. - `agents/docs/binary-size-analysis.md` — adds a "Release-build flash savers (in order of impact)" table that lists this overlay alongside the FASTLED_LOG_VERBOSITY default (#2890), the boot-banner shim (#2894), and FASTLED_RMT_STATIC_ALLOCATION (#2846). Single reference point for what knobs exist and how to enable them. ## Why a user-side overlay, not a library-side default `sdkconfig` is consumed by the ESP-IDF build before any FastLED TU is compiled. FastLED cannot mutate IDF defaults from a library; the deliverable here is therefore a *shippable overlay file* the user points `board_build.sdkconfig_defaults` at, plus documentation that tells them which lines map to which savings. ## User integration ``` [env:esp32s3] board_build.sdkconfig_defaults = sdkconfig.defaults ${platformio.packages_dir}/framework-arduinoespressif32/tools/sdkconfig.defaults.esp32s3 ${PROJECT_LIBDEPS_DIR}/${PIOENV}/FastLED/tools/sdkconfig_for_smallest_fastled.defaults ``` (See the file's header for the full snippet; `PROJECT_LIBDEPS_DIR` resolution varies by PIO project layout.) ## Verification - `bash lint --cpp` → C++ linting passes (this PR is docs-only; pre-existing PlatformIO-internal-usage warnings unchanged). - Per-project flash deltas are user-side measurements; the projection table in `binary-size-analysis.md` cites the #2886 top-25 baseline attribution for each line. Refs #2886, #2895.
…tage 0) (#2898) Closes #2897. Adds a user-facing reference page that consolidates every release-build flash-saver FastLED currently ships into a single discoverable location. End users no longer have to grep across PRs and meta-issues to find the knobs. Sections: 1. **TL;DR** — a drop-in `platformio.ini` snippet that stacks Stages 1+2+3 and `FASTLED_RMT_STATIC_ALLOCATION` in one place. 2. **Baseline & how to measure** — pre-#2886 NEOPIXEL Blink baseline (388,380 B), Stage 6 target (≤ 280,000 B), `bash bloat esp32s3` pointer. 3. **Release-build flash savers (in priority order)** — five-row table with how-to-enable, savings, status (✅ measured vs. 📊 projected), and PR cross-link for each knob. 4. **Per-stage detail** — one section per shipped stage with the mechanism, file path, and integration snippet: - Stage 1 (`FASTLED_LOG_VERBOSITY=0`, now NDEBUG default) — #2890 - Stage 2 (`FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1` build flag → strong override of vendor weak `shouldPrintChipDebugReport()`) — #2894 - Stage 3 (`tools/sdkconfig_for_smallest_fastled.defaults` overlay applied via `board_build.sdkconfig_defaults`) — #2896 - `FASTLED_RMT_STATIC_ALLOCATION=1` — #2846 (pre-existing) 5. **Situational notes** — Stage stacking, sdkconfig integration gotchas, `PROJECT_LIBDEPS_DIR` fallback. 6. **Measuring your build** — `bash bloat esp32s3` quickstart + diff pointer. 7. **Roadmap** — Stages 4 (cold-helper audit), 5 (basic_string::write simplification), 6 (CI regression gate). The ✅/📊 status flags on the priority table flip to ✅ when Stage 6 records measured deltas. Also adds a cross-reference from `agents/docs/binary-size-analysis.md` (the agent-facing reference shipped in #2896) to the new user-facing doc, with a maintenance note that future knobs must update both surfaces. ## Honesty about projections Every savings figure in this PR is marked 📊 (projected from the #2886 top-25 attribution). The ✅ status gets unlocked when Stage 6 of #2886 wires the regression-gate run that records measured baselines. The Roadmap section calls this out explicitly so readers know which numbers carry empirical weight. ## Verification - `bash lint --cpp` → all C++ linting checks pass; this PR adds no C++ code. - Doc references (`tools/sdkconfig_for_smallest_fastled.defaults`, `src/extras/suppress_arduino_chip_debug_report.cpp.hpp`, `src/fl/log/log.h:66-92`) verified against the post-#2896 tree. Refs #2886, #2897.
…DISABLE_SPI_CHIPSETS (#2914) Closes #2913. Adds an opt-in build flag `FASTLED_DISABLE_SPI_CHIPSETS=1` that gates the SPI dispatch branch in `fl::Channel::showPixels`. For NEOPIXEL-only sketches the SPI branch is dynamically unreachable, but the compiler cannot prove that — every `pixelIterator.writeXXX(...)` reference inside the 11-case switch is statically reachable, keeping ~720 B of encoder bodies and the switch-table footprint linked. ## Measured baseline (post-#2911, `master @ 6bd4ebd`) Dead-code SPI encoder symbols currently linked into a NEOPIXEL Blink: | Symbol | Size | |---|---:| | `fl::PixelIterator::writeLPD8806<fl::vector_psram<u8>>` | 235 B | | `fl::PixelIterator::writeSK9822<fl::vector_psram<u8>>` | 197 B | | `fl::PixelIterator::writeAPA102<fl::vector_psram<u8>>` | 197 B | | `fl::PixelIterator::writeSM16716<fl::vector_psram<u8>>` | 91 B | | **Total** | **720 B** | Plus the `showPixels` body itself shrinks by the switch-table footprint (~300-500 B for an 11-case xtensa switch). Projected total saving: **~1.0-1.2 KB** on a NEOPIXEL Blink build with the flag enabled. ## Behavior - **Flag unset (default):** No change. The SPI dispatch is present; every existing example using APA102 / SK9822 / etc. continues to work. - **Flag set (`-DFASTLED_DISABLE_SPI_CHIPSETS=1`):** The SPI branch is removed at preprocess time. `showPixels()` on a channel whose chipset is an `SpiChipsetConfig` falls through to the post-dispatch event emission with no data encoded — the channel silently emits nothing. Users opt in with the understanding that they're not using SPI chipsets in this build. This mirrors the opt-in build-flag pattern shipped in #2894 (Stage 2 / boot-banner shim) — minimal default-change risk, real savings for users who can accept the constraint. ## Files - `src/fl/channels/channel.cpp.hpp` — `#if !defined(FASTLED_DISABLE_SPI_CHIPSETS) || !FASTLED_DISABLE_SPI_CHIPSETS` wraps the `else if (mChipset.is<SpiChipsetConfig>())` block. The gate's behavior + savings are documented inline at the comment block above the branch. - `docs/SLIM_ESP32S3.md` — adds row 6 to the "Release-build flash savers" priority table with the new flag, its constraint, and PR link. ## Verification - `bash lint --cpp` → all C++ linting checks pass. - The flag follows the established opt-in pattern; default behavior unchanged. - Measured saving will be validated on the post-merge build (a `-DFASTLED_DISABLE_SPI_CHIPSETS=1` build of Blink, compared against the current `347,004 B` baseline). ## Expected savings - Eliminated: writeAPA102 (197 B), writeSK9822 (197 B), writeLPD8806 (235 B), writeSM16716 (91 B) = 720 B (PixelIterator SPI encoders reachable only from showPixels' SPI branch). - Eliminated: ~300-500 B of switch-table + dispatch code in `showPixels` body. - Net: ~1.0-1.2 KB projected on NEOPIXEL Blink with flag set. The Stage 6 regression gate (`tests/test_esp32s3_bloat_regression.py`, baseline = `347004`) does NOT change in this PR because it measures the default-flag build, which is unchanged. A separate follow-up records the flag-on measured number once a measurement run lands. Refs #2886, #2913, #2908, #2911.
perf(esp32): suppress Arduino-ESP32 boot banner via build-flag shim (#2886 Stage 2)
Closes #2893.
Adds a build-flag-gated strong override of the Arduino-ESP32 core's
shouldPrintChipDebugReport()weak symbol. Settingin
platformio.ini(or the equivalent in Arduino IDEcompiler.cpp.extra_flags) makes the optimizer fold bothif (shouldPrintChipDebugReport())branches at vendormain.cpp:55and
main.cpp:63to dead code.--gc-sectionsthen dropsprintBeforeSetupInfo()(~1,464 B at top-25 row #21 of #2886) plusits ~1-2 KB of formatted-stream rodata carrier strings — projected
~3 KB of flash savings on the ESP32-S3 NEOPIXEL Blink baseline.
Why a build flag, not an include?
The earlier design (an opt-in include
#include <extras/suppress_arduino_chip_debug_report.cpp.hpp>in the usersketch) collided with the unity-build linter: every
.cpp.hppundersrc/is required to participate in a_build.cpp.hppaggregator,which in turn is compiled by a
+.cppwrapper insrc/fl/build/. Theshim file is therefore unavoidably part of the library compilation
unit.
Gating the body on
FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORTandFL_IS_ESP32keeps the default behavior unchanged for every userwho doesn't explicitly opt in. Opt-in via build flag is the same
ergonomic shape as
FASTLED_RMT_STATIC_ALLOCATION(#2846) andFASTLED_LOG_VERBOSITY(#2791) — recognizable to existing usersfollowing the bloat-reduction docs.
Files
src/extras/suppress_arduino_chip_debug_report.cpp.hpp— the shim.Empty body unless
FL_IS_ESP32 && FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT.src/extras/_build.cpp.hpp— unity-build aggregator forextras/,documented as the home for build-flag-gated shims.
src/fl/build/extras+.cpp— independently-compiled wrapper TU thatpulls
extras/_build.cpp.hppinto the library build (matches theexisting
platforms+.cpp/third_party+.cpppattern).ci/lint_cpp/test_unity_build.py— registerfl/build/extras+.cppin
EXPECTED_BUILD_FILESso the unity-build linter accepts thenew wrapper.
Verification
bash lint --cpp→ all C++ linting checks pass; the pre-existingPlatformIO-internal-usage warnings (issue ci: sweep PlatformIO build usage and add linters that enforce fbuild-only board builds #2701) are warn-only and
unchanged by this PR.
bash bloat esp32s3 --buildwith-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1) measured by theStage 6 verification gate; this PR only ships the mechanism.
User-facing behavior
=0=1printBeforeSetupInfo()dead-strippedRefs #2886, #2893.
Summary by CodeRabbit
New Features
FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORTto hide startup messages on ESP32 targets.Chores