Skip to content

docs(esp32): ship tools/sdkconfig_for_smallest_fastled.defaults overlay (#2886 Stage 3) - #2896

Merged
zackees merged 1 commit into
masterfrom
feat/2895-stage3-sdkconfig-overlay
Jun 7, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/2895-stage3-sdkconfig-overlay

Conversation

@zackees

@zackees zackees commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

docs(esp32): ship tools/sdkconfig_for_smallest_fastled.defaults overlay (#2886 Stage 3)

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

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

Refs #2886, #2895.

Summary by CodeRabbit

  • Documentation

    • Enhanced flash optimization guidance for ESP32-S3 with a ranked reference table of build-time configuration options, showing each option's approximate flash savings and original sources.
  • New Features

    • Added a configuration template resource with documented settings to help reduce release-build flash usage on ESP32-S3 devices through optional, stackable configuration layers.

…rlay (#2886 Stage 3)

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.
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6455248e-245e-468a-b40f-118bb7dd6d71

📥 Commits

Reviewing files that changed from the base of the PR and between 80c6d98 and b4a19d3.

📒 Files selected for processing (2)
  • agents/docs/binary-size-analysis.md
  • tools/sdkconfig_for_smallest_fastled.defaults

📝 Walkthrough

Walkthrough

PR adds a new ESP-IDF sdkconfig overlay file (tools/sdkconfig_for_smallest_fastled.defaults) for users to reduce release-build flash usage on ESP32-S3 by disabling unused IDF components (coredump-to-flash, logging, bootloader output, panic backtrace), along with documentation describing each knob's savings and integration path.

Changes

Release-build Flash Savers for ESP32-S3

Layer / File(s) Summary
Flash-saving sdkconfig overlay and documentation
tools/sdkconfig_for_smallest_fastled.defaults, agents/docs/binary-size-analysis.md
New overlay file with four conservative ESP-IDF configuration toggles (CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=n, CONFIG_LOG_DEFAULT_LEVEL=ESP_LOG_NONE, CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y, CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y) each documented in-place, plus a commented optional Bluetooth disable knob. Documentation updated with ranked table of flash-saving levers including the overlay settings, approximate savings, and PR/issue sources.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related Issues

  • #2895: This PR directly implements the Stage 3 deliverable—the sdkconfig overlay file and user documentation referenced in the linked issue.
  • #2886: This PR documents and implements the IDF component disabling strategy described as the multi-stage bloat-reduction parent plan, with per-knob savings grounded in the top-25 symbol table.

Poem

🐰 A flash that's lean, configurations keen,
Coredumps off, and IDF unseen—
The overlay lands with docs in hand,
ESP32-S3 bloat meets FastLED's command! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2895-stage3-sdkconfig-overlay

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit e056628 into master Jun 7, 2026
1 check passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 7, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 7, 2026
zackees added a commit that referenced this pull request Jun 7, 2026
…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.
zackees added a commit that referenced this pull request Jun 7, 2026
…rlay (#2916)

Closes #2915.

Adds the biggest missing single lever to the Stage 3 overlay file
shipped in #2896. The standard newlib printf cluster — `_vfprintf_r`
(11.3 KB), `_svfprintf_r` (11.1 KB), `_svfiprintf_r` (7.3 KB),
`_vfiprintf_r` (7.3 KB), `_dtoa_r` (3.2 KB), `get_arg$isra$0` copies
(4.9 KB cumulative) — collectively eats **~45 KB** on the post-#2911
ESP32-S3 NEOPIXEL Blink baseline (the largest non-FastLED cluster in
the audit). Nano newlib drops it by 50-70%.

## Why this was missed

The Stage 3 overlay #2896 targeted four sub-1.5 KB symbol clusters
(coredump, IDF diag log, bootloader chatter, panic formatter) but
left the dominant ~45 KB libc printf cluster unattended. Adding
`CONFIG_NEWLIB_NANO_FORMAT=y` is a one-line config flip that's a
larger lever than every other Stage 3 knob combined.

## The constraint

Nano newlib printf has no `%f` / `%lf` / `%lld` / positional-arg
support. Sketches that print floating-point values via printf will
see literal format specifiers in the output instead of the formatted
number. For LED installations this is rarely an issue — strip
control code doesn't typically log floats. For sketches that DO need
extended formats, the user either drops the overlay entirely or
layers their own sdkconfig with `CONFIG_NEWLIB_NANO_FORMAT=n` after
FastLED's.

## Files

- `tools/sdkconfig_for_smallest_fastled.defaults` — new entry with
  inline constraint documentation, placed in the "Conservative knobs"
  section (it qualifies because most LED installations don't print
  floats).
- `docs/SLIM_ESP32S3.md` — row 2 of the priority table updated from
  `~10-15 KB` → `~30-45 KB`. Stage 3 detail section's knob table
  expanded from 4 → 5 rows with the nano-newlib entry at the top,
  plus a new constraint sidebar.
- `agents/docs/binary-size-analysis.md` — agent-facing copy of the
  priority table mirrors the SLIM doc update.

## Verification

- `bash lint --cpp` → all C++ linting checks pass (this PR doesn't
  touch C++).
- The overlay file remains opt-in (users must wire it into
  `board_build.sdkconfig_defaults` themselves). Default behavior is
  unchanged for users who haven't already chosen the overlay.
- Measured savings will be validated on a follow-up build with the
  overlay applied. Expected: ~20-30 KB drop in `total_flash` vs
  current baseline (`347,004 B`).

## Expected savings

- Pre-overlay (Stage 1 only): 347,004 B (current measured baseline).
- Post-overlay (Stages 1+3 with nano printf):
  ≈ 347,004 - 25,000 = ~322,000 B (projected).
- Gap to #2886 end-goal (280,000 B): ~42 KB remaining,
  most of which lives in #2856 (structural meta).

The Stage 6 regression gate baseline does NOT change in this PR
(the default-flag build is unchanged). A follow-up PR records the
measured number after a build with the overlay applied.

Refs #2886, #2915, #2896, #2906.
@zackees
zackees deleted the feat/2895-stage3-sdkconfig-overlay branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Stage 3: sdkconfig overlay for ESP32 builds — ~10-15 KB (#2886)

1 participant