Repository navigation
Description
Context
Predecessor: meta #3079 (closed 2026-06-15) shipped a 6-PR arc that cleared an 11,112-byte FLASH overage on LPC845-BRK and turned -DFASTLED_LPC_RX_SCT_WS2812=1 default-on. Today's LPC845 state with that flag enabled:
Flash: 62.61 KB / 64.00 KB (97.8%) — 1,420 B headroom
RAM: 10.50 KB / 16.00 KB (65.6%) — 5.5 KB free
The 1,420 B headroom is enough to ship the WS2812 SCT-RX loopback RPC binding by default, but it's too narrow to absorb any meaningful new feature work on the LPC8xx surface (debug logging, additional RPC methods, expanded JSON-RPC contracts). This meta tracks the Phase 2 reductions that would grow that headroom toward ~6-10 KB so the LowMemory build can carry comfortable feature-add capacity again.
This is not a regression hunt — the budget is technically met. It's a deliberate margin-expansion effort.
Headroom growth target
| Stage | Headroom |
|---|---|
| Today (post-#3079) | 1,420 B |
After Tier 1 (#3092 single-prec soft-FP elim) |
~5,500 B |
| After Tier 1 + Tier 2 (RPC/JSON outlining) | ~9,000 B |
| Aspirational ceiling (all 8 sub-issues) | ~13,000 B |
Sub-issues to file (in priority order)
Each row below should be filed as its own sub-issue once this meta lands. Numbers are based on arm-none-eabi-nm --print-size --size-sort on the LPC845 ELF as of 2026-06-15, after meta #3079 closed.
Tier 1 — cleanest wins (file first)
| # | Target | Current | Potential | Effort | Notes |
|---|---|---|---|---|---|
| A | Single-precision soft-FP cascade (__aeabi_fsub 1,172 + __aeabi_fadd 1,110 + __aeabi_fmul 660 + __aeabi_fdiv ~550 + __clzdi2 828) |
~4,500 B | -3 to -4 KB | medium | Drop the float alternative from json_value::variant_t on Low-memory. All reachable operator()(const float&) visitor overloads become unreachable → DCE. Same pattern as #3076 / #3082. Semantic change: json(3.14f) either fails to compile or silently stores 0; LPC8xx integer-only RPC contract never sends floats so this is unobservable. |
| B | fl::Remote::processRpc |
5,808 B | -1 to -2 KB | medium | Outline ACK + error-emit paths. Today after merge with Rpc::handle the function is monolithic; the JSON-RPC envelope validation + async-ACK emit + error-formatting cluster outlines cleanly. |
| C | autoResearchLowMemorySetup + lambdas |
4,626 B | -1 to -2 KB | low | Sketch-side. Reduce captured state in the 2 large lambdas (1,080 + 812 B); they currently capture the entire RPC context by value. |
Tier 2 — bigger structural changes
| # | Target | Current | Potential | Effort | Notes |
|---|---|---|---|---|---|
| D | fl::(anonymous).JsonBuilder::on_token |
2,328 B | -800 B | medium | Outline the variant emplace paths. The SAX visitor's branch bodies are small; the multiplier is inlined variant<>::emplace<T> per alternative. Replace with a single non-template emit_value(json_value& dst, TokenType tag, span<char> raw). |
| E | fl::(anonymous).JsonTokenizer::parse |
1,258 B | -1 KB | medium | Hand-write a minimal RFC-7159 subset tokenizer for the LowMemory integer-only RPC contract. Accepts only {"jsonrpc":"2.0","id":N,"method":"foo","params":[1,2,3,4]}. The full general tokenizer is overkill on a 3-method RPC surface. |
| F | 3× unordered_map<string, T>::rehash_inline_no_resize instantiations |
~1,800 B | -1 KB | medium | Collapse RpcEntry / AsyncRequest / shared_ptr<StringHolder> variants into a single non-template rehash that takes a per-entry-stride parameter. |
Tier 3 — small wins (file last)
| # | Target | Current | Potential | Effort | Notes |
|---|---|---|---|---|---|
| G | fl::basic_string::write |
762 B | -300 B | small | Outline format-string handling. |
| H | fl::TypedRpcBinding<Sig>::invokeWithReturn |
2,140 B/sig | -1 KB/sig | invasive | De-template the heavy Converter::convert + make_tuple + TypeToJson lifting. Affects every registered RPC signature across ESP32 / Teensy / WASM. Was deferred during meta #3079 because it's a multi-PR architectural change. File this last; only pursue if Tier 1+2 don't grow the budget enough. |
Tooling dependency: FastLED/fbuild#594
The companion tooling-gap issue (bash bloat / fbuild symbols: no arm-none-eabi path) is still open and is the single biggest velocity multiplier for this meta. Three independent gaps cataloged there:
ci/bloat.py'sBOARD_CHIP_MAPhas noarm-none-eabientry (Xtensa + RISC-V ESP32 only).fbuild buildhas no "emit ELF on region overflow" mode — when measuring degenerate over-budget configs, the link errors fatally and no ELF /.lto-tmp/*.ltrans*.ois preserved.bash bloatdoesn't look at.fbuild/build/<env>/release/firmware.elfeven on green builds.
Every PR in meta #3079 had to repeat the LD-script-patch + manual nm dance (12+ build-and-measure cycles). It also produced a real correctness bug: a one-off Python firmware.map parser misattributed byte gaps and overstated 4 phantom issues by 18-176× (the #3075 / #3078 retraction story in #3079). bash bloat lpc845brk would have caught that immediately.
This meta does not block on fbuild#594 — sub-issues can still be measured the manual way — but landing #594 first would compress per-PR iteration from ~10 minutes to seconds and remove the methodology-error footgun.
How to measure progress (until fbuild#594 lands)
# 1. Apply the proposed reduction on a feature branch
# 2. Temporarily bump FLASH 64K -> 128K in fbuild's cached LD script:
# ~/.fbuild/prod/cache/platforms/zackees-ArduinoCore-LPC8xx/.../lpc845_flash.ld
# 3. Build:
# PLATFORMIO_SRC_DIR=examples/AutoResearch fbuild build -e lpc845brk
# 4. CANONICAL bloat measurement (NOT linker map address-delta):
# NM=~/.fbuild/prod/cache/toolchains/developer-gnu/.../arm-none-eabi-nm.exe
# "$NM" --print-size --size-sort --demangle .fbuild/build/lpc845brk/release/firmware.elf | \
# awk '$3=="t" || $3=="T"' | tail -25
# 5. Revert the LD script
Once fbuild#594 lands this collapses to:
bash bloat lpc845brk --example AutoResearch
Acceptance for closing this meta
- LPC845 LowMemory +
RX_SCT_WS2812=1build flash headroom is ≥6 KB (today: 1,420 B) - At least Tier 1 sub-issues (A, B, C) closed via merged PRs
- Tier 2 sub-issues (D, E, F) either closed or explicitly deferred with rationale
- Tier 3 sub-issues (G, H) filed as separate trackers (H may stay deferred indefinitely)
Out of scope
- New LED-protocol matrix support on LPC8xx (Low-memory targets stay RX-only + bit-bang/SCT-DMA TX)
- LPC11Uxx / LPC15xx hardware bring-up (tracked under fbuild#456)
- RAM reductions — 5.5 KB free, not constrained
- ESP32 / Teensy / WASM bloat hunts (different cost model; full-fat targets have huge flash budgets)
Related work
- Predecessor: META: LPC845 64 KB flash bloat hunt -- clear 11 KB overage to unblock FASTLED_LPC_RX_SCT_WS2812=1 #3079 — LPC845 64 KB flash bloat hunt (closed 2026-06-15, -12,888 B across 6 PRs)
- Tooling dependency: bash bloat / fbuild symbols: no arm-none-eabi path; can't measure LPC845 bloat from FastLED's wrapper fbuild#594 —
bash bloat / fbuild symbols: no arm-none-eabi path - Same family: fl::json: custom 64-bit packed tagged-number type (replaces variant<i64, float, double> in #3002) #3022 / feat(json): integer-only IEEE 754 codec replaces soft-FP cascade (refs #3022) #3038 / LPC845 bloat: 8.3 KB of soft-FP / integer-div leaks past the no-soft-FP invariant on LowMemory + RX_SCT_WS2812 #3076 / LPC845 bloat: JSON tokenizer/builder/ieee754 path is 5.4 KB (JsonBuilder::on_token 2.3K + JsonTokenizer::parse 1.35K + kPow10Mant LUT 824) #3082 — JSON soft-FP / float-codec elimination
- AutoResearch harness: Retire AutoResearchLpc.ino — fold into AutoResearch.ino low-memory mode #3030 / feat(autoresearch): retire AutoResearchLpc.ino, fold into AutoResearch.ino low-memory mode (closes #3030) #3041 — LowMemory mode in main sketch
- LPC RX path: feat(lpc): RX backend for LPC8xx via SCT input-capture — two-phase rollout #3021 — LPC SCT-RX two-phase rollout (this meta protects the headroom Phase 2 default-on depends on)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
perf(json): gate float arithmetic paths on Low-memory; -4.3 KB on LPC…
fix(ci/ty): annotate sorted-by-length lists as list[str] for ty infer…
perf(remote): gate scheduled-RPC + result-tracking paths on Low-memor…
perf(remote): gate async-tracking + ACK detection on Low-memory; -2.9 KB
perf(rpc): gate async + response-aware + warnings paths in Rpc::handl…
perf(json): gate packed-array tokens + float-number store in JsonBuil…
perf(json): gate JsonTokenizer array-lookahead on Low-memory; -0.6 KB
perf(string): narrow int64/uint64 write to i32/u32 on Low-memory; -0.…
perf(remote): drop scheduler + result-vector + async-map fields on Lo…
perf(rpc): use short error message constants on Low-memory; tiny
fix(ci/ty): annotate sorted-by-length lists as list[str] for ty infer…
perf(remote): gate scheduled-RPC + result-tracking paths on Low-memor…
perf(remote): gate async-tracking + ACK detection on Low-memory; -2.9 KB
perf(rpc): gate async + response-aware + warnings paths in Rpc::handl…
perf(json): gate packed-array tokens + float-number store in JsonBuil…
perf(json): gate JsonTokenizer array-lookahead on Low-memory; -0.6 KB
perf(string): narrow int64/uint64 write to i32/u32 on Low-memory; -0.…
perf(remote): drop scheduler + result-vector + async-map fields on Lo…
perf(rpc): use short error message constants on Low-memory; tiny
perf(lpc): close meta #3224 -- Tier 1B/2D/2E/3G + RAM gate (-10.3 KB …
zackees commentedon Jun 18, 2026
Forward link: ongoing memory/flash reduction tracked at Phase 3 meta #3244 (which carries the Tier 3H
RuntimeRpcBindingthread from this meta forward).perf(json): collapse JsonToType<T> visitor dispatch into non-template…