Skip to content

fix(memory): shrink AVR show bookkeeping and ratchet size budgets - #4752

Merged
zackees merged 1 commit into
masterfrom
fix/memory-4743-attiny85
Oct 7, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/memory-4743-attiny85

Conversation

@zackees

@zackees zackees commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Refs #4743 and #4737. Narrow CFastLED::show controller bookkeeping to fl::u8 only when sizeof(int) == 2 and MAX_CLED_CONTROLLERS <= 255. Larger configured capacities and 32-bit targets retain int. All three controller passes, callbacks, driver choices, correction/dithering, white-channel modes and power limiting remain intact. No public API or ABI changes.

Local measurements

All values below are fbuild board flash / physical RAM bytes. One existing checkout, sequential builds, no worktrees, fbuild 2.5.37. ATtiny85 uses GCC 7.3.0-atmel3.6.1-arduino7, ATTinyCore 1.5.2, 8 MHz, normal -Os/LTO. Base master is d9cc468; 3.10.3 is 20667c3.

Workload 3.10.3 starting master candidate
ATtiny85 published Blink 3338 / 131 2640 / 161 2628 / 161
ATtiny85 controlled RGB 3338 / 131 2640 / 161 2628 / 161
Uno published Blink 3784 / 131 5138 / 443 5130 / 443
Uno published Apa102 3178 / 187 3650 / 324 3642 / 324
Uno controlled RGB 3784 / 131 3922 / 266 3914 / 266

ATtiny85 CFastLED::show shrinks 582 -> 570 B, accounting for all 12 B. Pre-Uno master 28a41d6 measures 2640 / 163; #4751 already landed the two-byte selector RAM saving. This PR preserves it and beats the parent's original 2638-byte flash reference by 10 B. The two-byte difference between that frozen reference and the freshly reproduced starting flash is recorded, not attributed to this change.

Remaining ATtiny85 gap versus 3.10.3: -710 B flash / +30 B physical RAM. RAM ledger: controller +10, unique vtables +12, FastLED object +2, configurable wait-spin budget +4, timer counter +4, old correction accumulator -1 and old dither phase -1. Vtable aliases share addresses; attributed RAM is 189 B while physical RAM is 161 B (historical 153 vs 131). No fields or virtual features were removed to erase the gap.

Shared published builds remain exact: STM32 26324 / 3472, C3 403182 / 68524, C6 360434 / 18612; existing budgets pass. An initial byte-index experiment on all targets regressed STM32 by 12 B and was discarded. The final 16-bit-int restriction restores the prior 32-bit results.

Regression gates and behavior evidence

  • Before implementation: starting ATtiny85 2640 B exceeds the original 2638-byte ceiling; pre-Uno attributed RAM 191 B exceeds 189. Final 2628 / 189 scoped budget is GREEN. Tighten the existing ATtiny85 workflow Blink ceiling 9500 -> 2628 and Uno ceilings 5138 -> 5130 / 3650 -> 3642, with matching registry/docs/scoped budgets. No new workflows or raised ceilings.
  • bash compile <board> --examples <example> then bash bloat <board> --budget <scoped JSON>; generated-TU static assertions plus the existing fbuild clean wrapper were used for concrete stale-output risks. Toolchain/dependency caches retained. Historical source uses the compatibility ::delay(0) stub; current uses normal fl::delay(0). Controlled RGB sketches are measured separately; default published sketches restored afterward.
  • bash test --cpp: final 319 native units pass. The earlier full gate also passed 95 host examples; the final unit gate reused their cache. bash test fastled_core --debug passes sanitizers.
  • Actual ATtiny85 ELF link tests: FL_REQUIRE_TINY_ELF=1 PYTEST_ADDOPTS='-k tiny_links_no_float --junitxml=.build/memory-4737/attiny85/tiny-links.junit.xml' bash test --py: 3 passed, 0 skipped; actual FastLED present, no soft-float helpers, no pipeline solver.
  • Separate explicit correction/dithering (NO_CORRECTION=0,NO_DITHERING=0), RGBW/RGBWW switching, show, showColor and power-limiter workload links and fits: 7054 / 177. Validation only; excluded from default savings. No hardware waveform execution claimed. The final default build is restored and passes its budget.
  • AVR logging audit: existing warnings identify errors/unsupported operations and compile out on the default tiny tier; no logging fl::printf remains in the measured AVR path. Preserve explicitly enabled feature behavior; no UART peripheral was fabricated for ATtiny85.
  • bash lint passes. Manual /code-review: all nine changed files reviewed, bounded counter cannot wrap at the terminating 255 limit, larger limits retain prior type; no findings. Production path is every AVR sketch calling FastLED.show(); flash saving is confirmed in actual linked examples.

All platform validation is local. CI Full was not invoked. Parent #4737 must remain open; child completion follows landed verification and a cumulative parent performance comment. Artifacts retained in .build/memory-4737/attiny85/.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99532988-4da3-4ae1-b5bc-ae3f686557ea
📥 Commits

Reviewing files that changed from the base of the PR and between d9cc468 and 0da2467.

📒 Files selected for processing (9)
  • .github/workflows/check_attiny85.yml
  • .github/workflows/check_uno_size.yml
  • agents/tasks/todo.md
  • ci/lint/check_size_thresholds.py
  • docs/SIZE_THRESHOLD_HISTORY.md
  • src/FastLED.cpp.hpp
  • tests/data/attiny85_bloat_budget.json
  • tests/data/uno_apa102_bloat_budget.json
  • tests/data/uno_blink_bloat_budget.json
 ________________________
< EV: Electric Verifier. >
 ------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@zackees
zackees merged commit 8d8207f into master Oct 7, 2026
118 of 119 checks passed
@zackees
zackees deleted the fix/memory-4743-attiny85 branch November 5, 2026 05:52
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.

1 participant