Skip to content

docs(esp32): ship docs/SLIM_ESP32S3.md user-facing reference (#2886 Stage 0) - #2898

Merged
zackees merged 1 commit into
masterfrom
feat/2897-stage0-slim-esp32s3-doc
Jun 7, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/2897-stage0-slim-esp32s3-doc

Conversation

@zackees

@zackees zackees commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

docs(esp32): ship docs/SLIM_ESP32S3.md user-facing reference (#2886 Stage 0)

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-Meta: ESP32-S3 Blink bloat reduction (file:line concrete plan) — supersedes #2885 #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:
  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

Refs #2886, #2897.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive guide for optimizing flash footprint on ESP32-S3 builds, including configuration options and measurement workflow.
    • Updated binary-size analysis documentation to clarify multi-location references for build optimization configuration.

…tage 0)

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
zackees merged commit a8c8c30 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
@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: 4c46b4dc-1db6-4224-9bd2-701e16f50496

📥 Commits

Reviewing files that changed from the base of the PR and between e056628 and fb2edcc.

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

📝 Walkthrough

Walkthrough

This PR adds user-facing documentation (docs/SLIM_ESP32S3.md) consolidating release-build flash-saver techniques for ESP32-S3, and updates the agent-facing binary-size-analysis page to cross-reference it. Both changes are documentation-only; no code is modified.

Changes

ESP32-S3 Flash Footprint Optimization Guide

Layer / File(s) Summary
Quick-start configuration and baseline
docs/SLIM_ESP32S3.md (lines 1–23)
Document introduces the goal, provides a TL;DR PlatformIO configuration snippet (FASTLED_LOG_VERBOSITY=0, sdkconfig_defaults), and establishes the baseline and target flash footprint for the reference use case.
Flash savings overview and expected deltas
docs/SLIM_ESP32S3.md (lines 24–49)
Describes expected total savings across stages, defines the release-build "flash savers" concept, and establishes a legend distinguishing measured vs. projected results.
Per-stage optimization mechanisms (stages 1–4)
docs/SLIM_ESP32S3.md (lines 50–119)
Explains each shipped stage: FASTLED_LOG_VERBOSITY=0 (dead-code elimination), SDKCONFIG overlay tuning, FASTLED_RMT_STATIC_ALLOCATION=1 with safety constraints, and Arduino boot-banner suppression via strong-symbol override; includes measurement workflow, situational guidance, and roadmap for remaining stages.
Related resources and cross-references
docs/SLIM_ESP32S3.md (lines 120–128), agents/docs/binary-size-analysis.md (lines 56–57)
Links to meta-issue, tooling, and source PRs; cross-reference note in agent-facing docs clarifying that both the agent and user-facing release-lever tables must be maintained in sync when new knobs are introduced.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

  • FastLED/FastLED#2897: This PR directly implements the Stage 0 deliverable (user-facing docs/SLIM_ESP32S3.md reference) described in the issue.
  • FastLED/FastLED#2886: Parent meta-issue tracking the multi-stage bloat-reduction plan; this PR delivers the user-facing documentation component of Stage 0.
  • FastLED/FastLED#2895: The cross-reference added to agents/docs/binary-size-analysis.md ensures both the agent-facing and user-facing tables stay in sync per Stage 3 requirements.
  • FastLED/FastLED#2893: The new documentation covers and references the Stage 2 Arduino boot-banner suppression mechanism documented in the retrieved issue.

Possibly related PRs

  • FastLED/FastLED#2791: The documentation explicitly covers the FASTLED_LOG_VERBOSITY=0 logging knob implemented in that PR and must remain in sync with it.
  • FastLED/FastLED#2894: The new documentation references the Arduino-ESP32 boot-banner suppression mechanism (strong-symbol override) introduced in that PR.

Poem

🐰 Whiskers twitching with delight,
A guide to slim builds shining bright—
Flash footprints shrink on S3 skies,
With stages stacked to optimize,
One reference home for every knob,
Hops away! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2897-stage0-slim-esp32s3-doc

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.

@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
… ✅ measured (#2904)

Closes #2903.

Lands the two follow-ups proposed in the 2026-06-06 audit comment on
the parent meta (see
#2886 (comment)).

## What changes

1. **`tests/data/esp32s3_bloat_baseline.txt`** — `388380` → `350568`.

   The previous baseline was the pre-Stage-1 number; with that pin,
   any PR that regressed anywhere between today's measured 350,568 B
   and 388,380 B silently passed the Stage 6 gate. Tightening to the
   measured post-Stage-1 number reclaims that ~38 KB of headroom and
   makes the gate enforce the actual current budget.

2. **`docs/SLIM_ESP32S3.md`** — flip row 1 of the priority table from
   📊 to ✅ with the measured delta inline, add a new "Current
   (Stage 1 only, no opt-in flags)" row to the baseline table, and
   update the per-knob caveat under the table so users know exactly
   which rows are measured vs. still projected.

## What stays 📊

- **Row 2** (`tools/sdkconfig_for_smallest_fastled.defaults`)
- **Row 3** (`-DFASTLED_RMT_STATIC_ALLOCATION=1`)
- **Row 4** (`-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1`)
- **Row 5** (`CONFIG_BT_ENABLED=n`)

These require their respective build flag / overlay to be exercised in
a measured build before they can flip — that's a separate follow-up.

## Measurement provenance

- ELF: `master @ 824cb5c` (the merge-commit of PR #2902, "Stages 4
  + 5 close-out").
- Build mode: PIO release default (`NDEBUG` defined, so Stage 1's
  `FASTLED_LOG_VERBOSITY=0` default fires per #2890). No Stage 2 or 3
  flag set; no Stage 3 overlay applied.
- Toolchain: `xtensa-esp32s3-elf-nm` from
  `~/.platformio/packages/toolchain-xtensa-esp-elf/bin/`.
- Result: `total_flash = 350,568 B` (4,530 sized flash symbols).
- Artifacts: `.build/symbols/esp32s3/report.json` + `report.md` on the
  measuring host.

## Why this PR is safe

The Stage 6 gate at `.github/workflows/bloat_regression_esp32s3.yml`
will run on this PR with the NEW (`350568`) baseline. The build it
measures is essentially `824cb5c0e3 + this PR's docs/data-only diff`,
which has the same `total_flash` as `824cb5c0e3` because nothing in
this PR touches `src/`. Expected gate result: PASS with
`headroom = 0 B`.

If a future PR regresses past 350,568 B, the gate fails fast and the
PR author either lands a saving in the same change or explicitly
raises the baseline file in the same PR with justification.

Refs #2886, #2903, #2898, #2900, #2902.
zackees added a commit that referenced this pull request Jun 7, 2026
…t driver (#2906)

Closes #2905.

Ships a CLI driver that builds the ESP32-S3 NEOPIXEL Blink under each
release-mode opt-in combo from #2886, runs `bash bloat esp32s3`
against each ELF, and emits a Markdown comparison table sized to drop
straight into the priority table in `docs/SLIM_ESP32S3.md`.

The script is the bridge between the SLIM doc's projected (📊)
entries and the measured (✅) ones. A follow-up doc PR runs the
script, captures the table, and flips 📊 → ✅ for the rows backed by
measurement.

## What ships

| File | Role |
|---|---|
| `tests/measure_esp32s3_opt_ins.py` | Multi-config audit driver. CLI: `--config {baseline\|stage2\|stage3\|stage4\|stack\|all}`, `--example Blink`, `--out compare.md`, `--keep-platformio-ini-backup`. |
| `agents/docs/binary-size-analysis.md` | One-line pointer to the script so future agents / users know how to refresh the doc's measurements. |

## Config matrix

| Config | build_flags addition | sdkconfig overlay | Source SLIM row |
|---|---|---|---|
| `baseline` | (none) | (user default) | row 1 — Stage 1 (NDEBUG default) |
| `stage2`   | `-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1` | (user default) | row 4 |
| `stage3`   | (none) | `+ tools/sdkconfig_for_smallest_fastled.defaults` | row 2 |
| `stage4`   | `-DFASTLED_RMT_STATIC_ALLOCATION=1` | (user default) | row 3 |
| `stack`    | Stages 2 + 3 + 4 all enabled | overlay applied | SLIM TL;DR snippet |

## Safety properties

- **Backup / restore.** First action backs up `platformio.ini` →
  `platformio.ini.bak`. SIGINT / SIGTERM handlers restore the file
  before exit; `finally:` block restores on any other exit path.
  The backup is deleted on clean exit unless
  `--keep-platformio-ini-backup` is set.
- **Targeted regex patch, not full INI re-parse.** PlatformIO's
  flavor of INI carries continuation lines and `${var.x}`
  interpolations that `configparser` mangles. The script only patches
  the `[env:esp32s3]` block via a regex that matches up to the next
  `[env:` header (or EOF) — well-defined in practice.
- **Per-config report archival.** Each config's `report.json` gets
  copied to `report.<config>.json` in the same dir, so the per-symbol
  data is preserved for `.claude/symbolaudit/diff.py` comparisons.

## Verification

- `bash lint` → all linters pass (Python via ruff + ty, C++, JS).
  The 6 pre-existing `ty` warnings about `os.system` are in unrelated
  CI scripts; not introduced by this PR.
- The script's first-pass logic was reviewed against the actual
  `[env:esp32s3]` block in `platformio.ini` (extends `env:generic-esp`,
  carries `board_build.flash_size`, `board_build.partitions`,
  `build_flags`). The regex correctly identifies the block boundary.
- Running the script end-to-end on a real machine produces the
  comparison table that the follow-up doc PR consumes; that run
  isn't in this PR because it's a separate measurement step
  (~16 min for 5 configs × ~3-4 min each).

## Out of scope

- **The follow-up doc PR** that runs the script and flips 📊 → ✅
  rows in `docs/SLIM_ESP32S3.md`.
- **Ratcheting `tests/data/esp32s3_bloat_baseline.txt`** — the gate
  baseline only tightens when a measured saving lands in `src/`, not
  when a user-side build flag delivers the savings.
- **CI integration** of the multi-config measurement. Initial scope
  is a developer-facing local tool.

Refs #2886, #2905, #2904, #2900, #2898.
@zackees
zackees deleted the feat/2897-stage0-slim-esp32s3-doc 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 0: Ship docs/SLIM_ESP32S3.md user-facing reference (#2886)

1 participant