Skip to content

fix(memory): cut Uno Blink static RAM 168 -> 136 B (#4788) - #4789

Merged
zackees merged 2 commits into
masterfrom
fix/uno-blink-ram-4788
Oct 8, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/uno-blink-ram-4788

Conversation

@zackees

@zackees zackees commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #4788 (partial parity, see remaining bytes).

Matched Uno Blink (dashboard sketch, fbuild 2.5.37, AVR GCC 7.3.0, core 5.4.0)

3.10.3 master 619b776 this PR
Physical static RAM 131 168 136
Allocated flash 3784 3762 3730

Measured with fbuild build and fbuild symbols. These are physical bytes, with aliased vtables counted once.

Change RAM saved
Controller slots back to 3.10.3 policy: 8 on 328P family, 16 on larger ATmegas, overridable 16 B
setSpiBus is virtual only on ESP32, where all of its overrides live 4 B (2 vtables)
Fixed-white chipset policy is a bit beside mEnabled, not a virtual 4 B (2 vtables)
constexpr AtomicFake ctors: the wait-spin budget no longer needs a startup ctor 4 B
No weak timer_millis on classic ATmega: MS_COUNTER uses timer0_millis 4 B

5 B remain above 3.10.3, and closing them needs a maintainer decision.

Both are supported, caller-visible features. This PR does not remove them.

Budgets tightened to observed values:

  • Uno Blink: 3770/194 → 3738/158
  • Uno APA102: 3642/290 → 3458/194
  • ATtiny85: 2628/189 → 2574/160

Validation

  • bash test --cpp: 319/319 unit and 95/95 examples pass. This includes the WS2814/LC8816E fixed-white rejection tests.
  • bash lint is clean.
  • All three bash bloat --budget gates pass.
  • bash compile esp32s3 --examples Apa102 passes; on ESP32, setSpiBus stays virtual.
  • agents/docs/binary-size-analysis.md gains a section on AVR physical vs attributed RAM, with this ledger.

Summary by CodeRabbit

  • New Features
    • AVR boards other than ATmega328P-family boards can now support up to 16 LED controllers by default; the limit remains configurable.
  • Bug Fixes
    • Improved timer support for classic ATmega boards.
    • Fixed white-channel configuration handling for supported RGBW chipsets.
  • Documentation
    • Clarified how to interpret AVR memory reports and compare build sizes.
    • Updated recorded memory measurements for several AVR examples.

- Restore 3.10.3 controller-slot policy: 16 only on Mega/Leonardo, 8 on Uno.
- setSpiBus is virtual only on ESP32, where its sole overrides live.
- Fixed-white chipset policy is a bit beside mEnabled, not a virtual.
- constexpr AtomicFake ctors: wait-spin budget needs no startup ctor.
- No weak timer_millis on classic ATmega; MS_COUNTER uses timer0_millis.
- Tighten Uno Blink, Uno APA102 and ATtiny85 bloat budgets to observed.
- Document AVR physical vs attributed RAM in binary-size-analysis.md.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a0882d5-f553-4eb2-a156-560ae431c91d
📥 Commits

Reviewing files that changed from the base of the PR and between 619b776 and 6de32be.

📒 Files selected for processing (10)
  • agents/docs/binary-size-analysis.md
  • src/FastLED.cpp.hpp
  • src/chipsets.h
  • src/cled_controller.cpp.hpp
  • src/fl/channels/cled_controller.h
  • src/fl/stl/atomic.h
  • src/platforms/avr/avr_millis_timer_source.cpp.hpp
  • tests/data/attiny85_bloat_budget.json
  • tests/data/uno_apa102_bloat_budget.json
  • tests/data/uno_blink_bloat_budget.json
💤 Files with no reviewable changes (1)
  • src/chipsets.h

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The AVR changes adjust controller limits, controller state, virtual methods, and timer selection. Size budgets are updated, and the Uno analysis documents distinguish attributed RAM from physical static RAM.

Changes

AVR memory footprint

Layer / File(s) Summary
Adjust AVR controller footprint
src/FastLED.cpp.hpp, src/fl/channels/cled_controller.h, src/cled_controller.cpp.hpp, src/chipsets.h
ATmega328P-family boards now default to 8 controller slots; other ATmega boards use 16. Controller constructors initialize the enabled and fixed-white policy flags. Fixed-white policy checks use the flag instead of a virtual chipset-name method. setSpiBus is virtual only on ESP32.
Change initialization and AVR timer selection
src/fl/stl/atomic.h, src/platforms/avr/avr_millis_timer_source.cpp.hpp
AtomicFake constructors are now constexpr. ATmega builds disable the weak timer symbol.
Update AVR size records and analysis guidance
tests/data/*_bloat_budget.json, agents/docs/binary-size-analysis.md
The recorded budgets decrease for the ATtiny85 Blink, Uno APA102, and Uno Blink builds. The Uno guidance distinguishes attributed RAM from physical static RAM and records the reported before-and-after measurements.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 6de32

This change reduces AVR flash and RAM use without an identified behavioral regression. It reuses an existing timer configuration name, and ATmega4809 builds are unaffected by the new timer branch. It appears ready to merge, with the documented remaining RAM gap still open against the issue target.

🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 5 files. (4 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR implements the reported #4788 reductions: 8 controller slots for the 328P family with an override, non-ESP32 non-virtual setSpiBus, bit-based fixed-white policy, constexpr AtomicFake cons… Provide the missing reviewable regression evidence, retained measurement artifacts and provenance, compatibility evidence, and maintainer decision on the explicit 5 B gap. Without that evidence, compliance with all #4788 coding acceptance c…
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: reducing Uno Blink static RAM from 168 B to 136 B. It is concise, specific, and related to issue #4788.
Out of Scope Changes check ✅ Passed The changed source, budget references, and agents/docs/binary-size-analysis.md all support #4788. The ATtiny, APA102, ESP32, fixed-white, and timer changes address the issue's requested affected-pla…
Full details: Linked Issues check

Explanation

The PR implements the reported #4788 reductions: 8 controller slots for the 328P family with an override, non-ESP32 non-virtual setSpiBus, bit-based fixed-white policy, constexpr AtomicFake constructors, and no classic-ATmega weak timer_millis. The PR reports matched 136 B RAM and 3730 B flash, and it explicitly records the remaining 5 B instead of claiming parity. The reviewable evidence does not establish focused RED-to-GREEN evidence for each fix, retained ELF/map/report artifacts with full provenance, or compatibility checks for all required lifecycle, settings, RGBW/RGBWW, status, and timer behavior. The issue permits an unmet 131 B target only when the gap remains explicit and receives maintainer agreement; the PR requests that decision but does not provide evidence of it.

Resolution

Provide the missing reviewable regression evidence, retained measurement artifacts and provenance, compatibility evidence, and maintainer decision on the explicit 5 B gap. Without that evidence, compliance with all #4788 coding acceptance criteria cannot be determined.

Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 5 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 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.

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.

fix(memory): account for and reduce remaining Uno Blink RAM gap versus 3.10.3 (+37 B)

1 participant