Skip to content

fix(autoresearch): reduce LPC845 low-memory RAM use - #3207

Merged
zackees merged 1 commit into
masterfrom
codex/fix-lpc845-autoresearch-hardfault
Jun 17, 2026
Merged

zackees merged 1 commit into
masterfrom
codex/fix-lpc845-autoresearch-hardfault

Conversation

@zackees

@zackees zackees commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #3200.

AutoResearch on LPC845-BRK was hardfaulting during early init because the low-memory sketch had grown too close to the 16 KB SRAM ceiling. Two static 512-entry fl::EdgeTime diagnostic buffers consumed about 4 KB of .bss, leaving too little room for startup stack/heap before setup() could run.

This keeps the #3125 stack fix intact, but reduces the static diagnostic buffers to 64 entries and bounds the WS2812 low-memory capture reserve to 192 edges. The larger WS2812 diagnostic case now fails by truncation instead of starving setup/loop memory on LPC845.

Validation

  • ./compile lpc845brk --examples AutoResearch
    • Flash: 62.47 KB / 64.00 KB
    • RAM: 10.99 KB / 16.00 KB
  • Flashed to LPC845-BRK with pyOCD after chip erase.
  • Live SWD halt after reset:
    • pc = 0x00000b98 / sp = 0x10003e98
    • no longer stuck at issue-reported HardFault handler 0x0000093a
  • Serial RPC echo on COM10 returned:
    • FL_WARN: echo invoked
    • REMOTE: {"id":1,"result":4242,"jsonrpc":"2.0"}

Summary by CodeRabbit

  • Chores
    • Optimized memory usage in low-memory example handlers by adjusting buffer allocations to reduce SRAM consumption.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9dcb372c-f52e-4eea-a0c2-2da51fc34d5a

📥 Commits

Reviewing files that changed from the base of the PR and between fe5c638 and 7806a4f.

📒 Files selected for processing (1)
  • examples/AutoResearch/AutoResearchLowMemory.h

📝 Walkthrough

Walkthrough

In examples/AutoResearch/AutoResearchLowMemory.h, static .bss buffer sizes for the LPC low-memory JSON-RPC handlers are reduced: pinToggleRx drops its edge capture buffer floor to 64, ws2812SctTest replaces its edge cap bounds with a new 192-element constant, and the diagnostic probe buffer is reduced from 512 to 64.

Changes

LPC Low-Memory Buffer Size Reduction

Layer / File(s) Summary
pinToggleRx edge buffer and cap reduction
examples/AutoResearch/AutoResearchLowMemory.h
Introduces kLowMemEdgeBufSize = 64u to replace the prior larger static edge capture allocation, lowers the minimum cap floor, and updates the .bss comment to reflect the new sizing constraint.
ws2812SctTest edge capacity and probe buffer reduction
examples/AutoResearch/AutoResearchLowMemory.h
Replaces the prior 256–2048 edge cap bounds with kLowMemWs2812EdgeCapacity = 192u, adjusts the minimum cap check, and reduces the diagnostic probe buffer size from 512u to 64u with updated comments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3133: Directly precedes this PR — it moved the same pinToggleRx and ws2812SctTest edge buffers off the stack into static .bss at ~512 entries; this PR reduces those static sizes to reclaim the SRAM that move consumed.
  • FastLED/FastLED#3041: Modifies the same AutoResearchLowMemory.h LPC RPC handlers and their internal buffer/telemetry parameters.

Poem

🐇 Hop hop, the buffers shrink today,
Sixty-four is plenty, I say!
No more HardFault in early init,
The LPC boots — a perfect fit.
Less .bss, more room to play! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: reducing LPC845 low-memory RAM usage by shrinking static buffers to fix a hardfault regression.
Linked Issues check ✅ Passed The code changes directly address all core requirements from issue #3200: reducing static buffer sizes from 512 to 64 entries (edges_buf and probe) and constraining WS2812 capacity to 192 edges, fixing the RAM-ceiling regression that caused hardfault during early initialization.
Out of Scope Changes check ✅ Passed All changes are within scope: buffer size reductions and WS2812 capacity constraints directly target the identified RAM pressure, with comment updates reflecting new constraints. No unrelated code modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-lpc845-autoresearch-hardfault

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 and usage tips.

@zackees
zackees merged commit 00a081b into master Jun 17, 2026
7 checks passed
@zackees
zackees deleted the codex/fix-lpc845-autoresearch-hardfault branch June 17, 2026 22:45
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 17, 2026
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.

LPC845-BRK: AutoResearch firmware HardFaults during early init (regression since b468ed7)

1 participant