Skip to content

META: LPC845 64 KB flash bloat hunt -- clear 11 KB overage to unblock FASTLED_LPC_RX_SCT_WS2812=1 #3079

Closed

Description

@zackees

2026-06-15 revision: original sub-issue list was based on a flawed map-parser methodology that overstated symbol sizes by 18-176×. Phantom sub-issues #3075 and #3078 have been closed as filed-in-error. The two surviving sub-issues (#3076 soft-FP, #3077 fl::function variant) are revised with real nm --print-size data. Two new sub-issues (#3081 RPC dispatch, #3082 JSON parser) cover the actual top contributors. The 11 KB overage figure and the goal are unchanged.

Goal

Claw back the 11 KB flash overage on LPC845-BRK that today blocks the FASTLED_LPC_RX_SCT_WS2812=1 config — the hardware WS2812 loopback verification RPC binding for the AutoResearch bring-up harness. Once the overage clears, examples/AutoResearch/AutoResearch.ino with that flag enabled fits in the 64 KB FLASH region and the WS2812 SCT-RX loopback (#3021 Phase 2) becomes the default validation path on bash autoresearch lpc845brk.

Baseline measurement (2026-06-15, real nm data)

Built examples/AutoResearch/AutoResearch.ino with FASTLED_AUTORESEARCH_LOW_MEMORY=1 + FASTLED_LPC_PWM_DMA=1 + FASTLED_LPC_RX_SCT_WS2812=1 against fbuild 2.2.25 / arm-none-eabi-gcc 15.2.1, then ran arm-none-eabi-nm --print-size --size-sort on the ELF (after a temporary LD-script bump per FastLED/fbuild#594):

Metric Value
Flash used 77,004 bytes (117.5% of 64 KB)
Linker-reported overage +11,112 bytes
Top 10 .text symbols dominated by RPC dispatch + JSON codec + soft-FP

Real top-10 .text contributors

3,124  fl::Rpc::handle(fl::json const&)
2,996  fl::Remote::processRpc(fl::json const&)
2,828  autoResearchLowMemorySetup()                              [sketch-side]
2,340  fl::(anonymous namespace)::JsonBuilder::on_token
2,196  fl::TypedRpcBinding<fl::string(int,int,int,int)>::invokeWithReturn
2,088  __aeabi_dadd                                              [soft-FP]
1,516  Reset_Handler                                             [startup; normal]
1,392  __aeabi_dmul                                              [soft-FP]
1,350  fl::JsonTokenizer::parse
1,172  __aeabi_fsub                                              [soft-FP]

Bucket totals

Bucket Bytes Sub-issue
RPC dispatch (Rpc::handle + processRpc + TypedRpcBinding + JsonArgConverter + rehash) ~12,600 #3081
Soft-FP / libgcc cascade ~8,300 #3076
fl::function variant clones (across signatures) ~6,260 #3077
JSON codec (JsonBuilder + JsonTokenizer + ieee754 + kPow10Mant) ~5,400 #3082
Sketch-side autoResearchLowMemorySetup + lambdas ~4,700 (no issue; user-side)

Sub-issues to fix

Sub-issue Symptom Target reduction
#3081 RPC dispatch monolith — Rpc::handle 3.1K + Remote::processRpc 3.0K + TypedRpcBinding 2.2K each ~7 KB
#3082 JSON codec — JsonBuilder::on_token 2.3K + JsonTokenizer 1.35K + ieee754 LUT path 1.9K ~3 KB
#3076 8.3 KB of soft-FP / libgcc cascade leaks past the no-soft-FP invariant ~7 KB
#3077 fl::function variant emits 6.3 KB of copy/move/destroy clones across RPC signatures ~3 KB

Total addressable: ~20 KB against an 11 KB deficit. Any one of #3081 or #3076 alone would clear the overage. #3081 has the largest leverage and the cleanest fix (de-templating dispatch glue).

Withdrawn sub-issues

Tooling dependency

FastLED/fbuild#594 — bash bloat lpc845brk cannot run today because ci/bloat.py's BOARD_CHIP_MAP has no arm-none-eabi entry, and fbuild build has no "emit ELF on region overflow" mode. The methodology error that produced #3075 / #3078 was a direct consequence of working around #594 by parsing the linker map by hand. Closing this meta should not block on #594, but the bloat work cannot iterate efficiently without it, and a repeat methodology mistake is very easy without proper tooling.

How to measure progress (until #594 lands)

# 1. Apply the proposed reduction
# 2. Edit platformio.ini [env:lpc845brk] to enable -DFASTLED_LPC_RX_SCT_WS2812=1
# 3. If still over-budget, temporarily bump FLASH 64K -> 128K in the cached LD script:
#    ~/.fbuild/prod/cache/platforms/zackees-ArduinoCore-LPC8xx/.../lpc845_flash.ld
# 4. Build:
#    PLATFORMIO_SRC_DIR=examples/AutoResearch fbuild build -e lpc845brk
# 5. 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
# 6. Revert the LD script and platformio.ini

Acceptance for closing the meta

Out of scope

Related work

Activity

  1. zackees commented on Jun 15, 2026

    @zackees
    MemberAuthor

    /clud-fix 3079 status report (2026-06-15)

    Investigation phase of /clud-fix complete. Per the skill's intake-gate logic, sub-issues that fail "scope sanity" (open-ended design questions rather than well-scoped bug fixes) require an investigation report rather than a drive-by PR. After deep investigation, three of the four surviving sub-issues fail scope-sanity and need explicit design discussion before PR work.

    Per-sub-issue gate status

    Sub-issue Scope check Estimated PRs Notes
    #3076 — soft-FP cascade FAIL — design 2-3 PRs Real fix requires dropping float from json_value::variant_t on Low-memory, OR replacing ieee754_format_decimal with int-only codec. Both touch public API.
    #3077 — fl::function variant PASS — bounded fix 1 PR Clean #if !FL_PLATFORM_HAS_LARGE_MEMORY to drop 3 dead alternatives. ~3 KB savings. Cannot ship alone (would not clear the 11 KB overage).
    #3081 — RPC dispatch FAIL — design 2-3 PRs De-templating TypedRpcBinding::invokeWithReturn reworks the core abstraction. Cross-platform risk on ESP32 / Teensy / WASM.
    #3082 — JSON codec CONDITIONAL depends on #3076 If #3076 drops the float variant alternative, most of this issue's bloat goes away as a side-effect. Re-measure after #3076 lands.

    Recommended path

    Phase 1 (quick, low-risk):

    Phase 2 (design discussion required, then PR sequence):

    Phase 3 (optional, only if budget still tight):

    What this means for the goal

    /clud-fix 3079 cannot ship as a single-session goal. The meta needs:

    1. A design decision on LPC845 bloat: 8.3 KB of soft-FP / integer-div leaks past the no-soft-FP invariant on LowMemory + RX_SCT_WS2812 #3076 (drop float alternative vs int-only decimal codec) — user input required
    2. Sequential PRs for LPC845 bloat: fl::function variant emits 6.3 KB of copy/move/destroy clones across RPC dispatch signatures #3077 + chosen LPC845 bloat: 8.3 KB of soft-FP / integer-div leaks past the no-soft-FP invariant on LowMemory + RX_SCT_WS2812 #3076 path
    3. Re-measure + acceptance verification

    I have not opened any PRs against this meta because the scope-sanity gate fails for three of four sub-issues. Per /clud-fix:

    If any box is missing → the deliverable for this run is an investigation report, not a PR.

    Investigation reports posted as comments on each sub-issue. Awaiting design direction.

    Caveats

    The bloat measurements behind this meta and its sub-issues were taken using a manual LD-script-patching workaround because FastLED/fbuild#594 (tooling gap — no bash bloat for arm-none-eabi) is still open. Every subsequent fix PR will need to repeat the LD-script-patch + nm-measurement dance to verify byte targets, OR fbuild#594 should land first to make iteration tractable. Recommend prioritizing fbuild#594 if multiple bloat PRs are coming.

  2. moved this from Triage to Done in FastLED Trackeron Jun 15, 2026
  3. added a commit that references this issue on Jun 15, 2026
    81bcaf3
  4. zackees commented on Jun 18, 2026

    @zackees
    MemberAuthor

    Phase 2 follow-on filed: #3224 — LPC845 flash-budget Phase 2 — grow headroom from 1.4 KB to ~6-10 KB for feature capacity

    Today's headroom after this meta closed is 1,420 B, which fits the WS2812 SCT-RX default-on binding but leaves no margin for new LowMemory feature work. The Phase 2 meta catalogs 8 outstanding reduction opportunities (Tier 1: single-prec soft-FP cascade, Remote::processRpc outlining, sketch-side lambda slimming; Tier 2: JSON codec slimming + unordered_map collapse; Tier 3: small wins + the deferred TypedRpcBinding de-templating).

    Also calls out the still-open FastLED/fbuild#594 tooling gap as the iteration-velocity multiplier it became during this meta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions