Repository navigation
Description
Context
Platform sub-issue of #4737. +39,714 B flash / +2,714 B RAM versus 3.10.3.
Source measurements, flash / RAM in bytes, fbuild 2.5.37, per-version source/examples and constant per-board build configuration. Reference SHAs: 3.10.3 20667c3a64, 3.10.6 ebf8c2823c, master 0c2e9f7300.
Pinned ESP32 framework: Arduino-ESP32 3.3.11 / ESP-IDF 5.5.5.
| example | 3.10.3 | 3.10.6 | master reference |
|---|---|---|---|
| Blink | 271250 / 23370 | 311160 / 26532 | 310964 / 26084 |
Execution workflow
Work one checklist item and one platform sub-issue at a time across the entire #4737 project, in the existing repository checkout without git worktrees. Use a feature branch in that checkout and reuse .build/fbuild/esp32dev, toolchain/dependency caches and test caches. Run builds sequentially. Verify changed source/flags are reflected in the ELF; use the appropriate wrapper's --clean only when stale-output evidence requires it. Record each completed item's measurements, checks and commit/PR before moving on.
Checklist
- Reproduce this platform's current starting measurements with recorded SHA, flags and framework versions, and verify cache validity.
- Create matched symbol/link-map evidence using
bash bloat esp32dev; retain both the published example and controlled RGB-workload measurements where applicable. - Attribute RMT/channel objects, driver matching/registration, encoders, buffers and global state; coordinate binding work with Eliminate memory usage from dynamic driver binding. #4733.
- Separate Blink's UART/banner cost from the library using a controlled RGB workload.
- Reduce unused default state/code while preserving runtime driver selection and WiFi coexistence.
- Land measured default flash and RAM reductions below the recorded master values for every example in this child, and quantify remaining gaps to 3.10.3.
- Add a focused size regression check. For any implementation, capture a failing budget/reproduction before coding (RED) and the passing result afterward (GREEN); run relevant tests, lint and code review.
- Ratchet applicable existing flash budgets and enforce RAM budgets through existing checks, preserving normal feature behavior and avoiding relaxed ceilings.
- Publish final before/after bytes, remaining gaps, source SHA, commands, flags, framework versions and landed commit/PR links; update meta(memory): reduce default flash/RAM usage across all measured platforms #4737's platform scorecard.
Decisions
- Default-build reductions are required; optional slim configurations supplement the work but do not satisfy this child.
- Scope is this platform; shared fixes must be measured on affected siblings and tracked in the parent.
- Any unmet reduction criterion needs an explicit maintainer-approved exception with exact bytes before closure.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 7, 2026
ESP32 investigation and candidate progress
Starting master
8d8207f391and historical 3.10.320667c3a64are rebuilt and analyzed with fbuild bloat, using the same cached ESP32 project and constant GCC14.2.0 / Arduino-ESP32 3.3.11 / IDF5.5.5 configuration. Published and controlled historical builds are 271250 /23370 B (board flash/RAM). Starting published master is 310880 /26036, controlled 296584 /26028.Current uncommitted candidate on
fix/memory-4738-esp32dev: published 310524 /25964, controlled 296228 /25956. Both save 356 B flash /72 B physical RAM versus matched starting builds. Scoped image-flash/attributed-RAM published budget 313327 /34557 is GREEN; original and intermediate size checks provide RED evidence. Remaining historical gaps: published +39274 /+2594, controlled +24978 /+2586.RMT manager144 →132 B: reuse full-width TX counters for combined global-pool totals, then place the pool flag beside DMA flags. TX/RX inspection, reservations, rollback, recovery, reset, DMA behavior and all strategy values remain. Actual original/candidate accounting probes pass in local QEMU. Two routine buffering-adjustment messages now use FL_LOG_RMT; actual error warnings remain. No fl::printf logging found in the ESP32 platform path.
The unused ESP32 HTTP route-context vector was initialized during startup even when no Server methods were linked. Its owner now initializes on actual HTTP use with static Singleton backing storage, preserving the existing unique_ptr contexts and cleanup order without a new heap owner. Real local loopback lifecycle probes pass on original and candidate: GET responses, live route addition, old-route validity after growth, stop/restart, registration-failure cleanup, then successful serving again. The production caller is AutoResearchNet.cpp. Default Blink contains no HTTP route-context symbols after the change. This does not claim physical WiFi/RMT waveform testing.
Fresh builds use generated-TU compile-only fingerprints plus the clean fbuild wrapper while retaining dependency/toolchain caches. A source restore reused the original ELF; the scoped budget rejected it and forced verification reproduced the candidate. The ELF section ledger accounts for RMT structural savings and linker padding separately from board totals. Attributed RAM is a separate metric and also counts IRAM code; it is not physical board data/BSS.
Still pending: investigate the remaining unused SPI host-tracking global, verify shared ESP32 siblings, run final native/sanitizer/lint/code review gates, ratchet final budgets, then open/land a PR and freshly verify it. This child remains open. Work is sequential in this checkout, no worktrees and no CI Full. Artifacts are retained in
.build/memory-4737/esp32dev/.zackees commentedon Oct 7, 2026
Further local optimization progress (candidate; child remains open)
Constant-initialized SPI host accounting replaces the startup vector with one compact record per SDK host ID. The existing SPI2 selection, occupancy checks, bus release, and invalid-host no-op behavior remain; no new heap owner or caller opt-in is introduced. The 68-byte SPI tracking symbol is absent from default Blink.
All cells are board flash/RAM bytes. Starting source is
8d8207f391; same fbuild2.5.37, Arduino-ESP32 3.3.11, IDF5.5.5 and Xtensa GCC14.2.0 default flags. Published candidate remains +39178/+2522 versus 3.10.3 (271250/23370); controlled remains +24890/+2514. Published and controlled fresh builds were performed sequentially, preserving framework/toolchain caches.Focused SPI budget was RED before editing (313327/34557 exceeded ceilings313326/34556), then GREEN. Final published budget is image313231/attributedRAM34489; the existing workflow size tool independently confirms313231 ELF text+data. Attributed RAM is distinct from board RAM.
The exact-final HTTP implementation passed the real SDK loopback lifecycle probe in local QEMU: existing/live routes, growth, stop/restart, duplicate registration failure and a new server after failure. The previous original/candidate RMT accounting probes cover shared/dedicated pools, reservations, rollback and reset. These are emulator results; physical waveform validation is not claimed.
Shared C3 published build is now402670/68388, down512/136 versus its previously landed403182/68524. C6/S3 sequential validation is underway. Explicit SPI production-path validation, shared final budget updates, final native/sanitizer/lint/review gates, PR and landed verification remain outstanding. No CI Full or git worktrees used. Parent remains open; cumulative landed performance will be updated when this child closes.
zackees commentedon Oct 7, 2026
Implementation and local validation are complete in PR #4753, candidate
73b21d672f. Ordinary PR checks/review are running; this child stays open until merge and fresh landed verification. Parent #4737 must remain open.Matched ESP32 published Blink:310880/26036→310428/25892 bytes (452flash/144physicalRAM saved). Controlled RGB:296584/26028→296140/25884 (444/144 saved). Matched3.10.3:271250/23370; remaining published gap39178/2522. Default image313231, attributedRAM34489, scoped budget GREEN.
RMT shared counters/padding, HTTP ownership initialized on actual use, and constant-initialized SPI host accounting retain features. Original/candidate real-SDK RMT accounting, HTTP loopback lifecycle, and SPI ownership tests pass. Public SPI hardware initialization times out inside SDK on both versions; physical waveform and successful hardware recovery are not claimed.
Shared C3 published402670/68388 and control383802/65316. C6 published359834/18460; control359584/18460. Fresh starting-HEAD C6 control reproduced previous360168/18596 exactly, including keyed symbol sizes; measured control saves584/136, independently of published600/152. Source bytes verified; normal sketches restored. Fresh S3/STM/Uno Blink/Apa102/Tiny builds preserve prior sizes and applicable budgets pass.
Strict native acceptance passes315 rerun units plus4 previously strict-passed cached targets and95host examples. Full Python CI test inventory, lint and18-file manual review pass. Four pre-existing sanitizer defects fixed with focused strict RED/GREEN evidence and wave signed-amplitude/large-damping regressions. Existing budgets lowered, no relaxed ceiling/new workflow. Local sequential cached builds only; no worktrees or CI Full. Cumulative parent performance comment is prepared for publication after landing.
zackees commentedon Oct 7, 2026
Landed PR #4753 at
003083fa285de400e5fc1f52a547df338f066716; candidate/landed tree diff is empty. Fresh landed local ESP32 build310428/25892 and scoped budget313231 image/34489 attributedRAM PASS. Published savings452flash/144physicalRAM; matched control444/144. Remaining3.10.3 gap39178/2522 published,24890/2514 controlled.Complete measurements, shared effects, ledger and validation are in the PR and cumulative parent diff. Seven published rows now save2144flash/798RAM against matched implementation starts. All ordinary PR checks pass; CodeRabbit APPROVED without findings. Strict native, full Python, lint, real-SDK RMT/HTTP/SPI ownership checks pass with the documented matched SPI hardware-init QEMU limitation. No features removed, no relaxed budgets, no worktrees or CI Full.
All child checklist requirements are satisfied by the matched before/after bloat, focused RED/GREEN, landed optimization, lower flash/RAM ceilings and local behavior evidence. Parent #4737 remains OPEN. Next ESP32-S3 #4741.