Skip to content

refactor(autoresearch): delegate all deployment to fbuild (removes pyocd from FastLED) - #3550

Merged
zackees merged 4 commits into
masterfrom
feat/delegate-flash-to-fbuild
Jul 2, 2026
Merged

zackees merged 4 commits into
masterfrom
feat/delegate-flash-to-fbuild

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Rip out the direct pyocd load / pyocd commander reset calls from ci/autoresearch/phases.py (_build_and_flash_nxplpc → renamed _build_and_deploy_nxplpc). autoresearch no longer flashes anything — it delegates the deploy phase to fbuild deploy, the same layer that already owns fbuild build.
  • Codify "Deployment (flash / upload) is fbuild's job — ALWAYS" in three places so this policy doesn't regress: CLAUDE.md (Core Rules), agents/docs/build-system.md (full rule + rationale), and agents/docs/hardware-autoresearch.md (autoresearch-specific restatement).

Why

On 2026-07-01 the LPC-Link2 CMSIS-DAP v1.0.7 firmware (2013 vintage, shipped on the LPC845-BRK) wedged pyocd's Windows HID transport for the full 8-minute autoresearch timeout — pyocd list never returns, pyocd load never returns, and the LPC845 was left halted with its shared VCOM (COM10) silenced. That's a fbuild-owned platform-integration problem that was leaking into every FastLED script that wanted to flash a board. Consolidating deploy into fbuild is the only place that fix scales.

Good news that surfaced during this PR: fbuild already shipped the deployer — I just missed it before filing a redundant issue. The nxplpc LpcDeployer landed in fbuild#595 (2026-06-15), using lpc21isp UART ISP that never opens the CMSIS-DAP HID interface, so it structurally cannot hit the same wedge. Follow-ups #923 (path resolver + baud/hex safety nets) and #928 (-bin handling + \.\COM10 Windows prefix) refined it. This PR is the FastLED-side change needed to actually route autoresearch through that deployer — which is why our bash autoresearch lpc845 --pwm-dma-cl was still hitting pyocd's HID wedge despite fbuild having the fix in place for three weeks.

What NOT to do

The new function's error path deliberately says:

Deployment is fbuild's responsibility. Do not add a pyocd/lpc21isp fallback here.
nxplpc deployer landed in fbuild#595 (refined in #923, #928). If your pinned fbuild predates those, bump it. Report new gaps at https://github.com/FastLED/fbuild/issues

If a future PR is tempted to re-add a direct flash-tool call as a workaround, that comment is the reminder to fix it in fbuild instead.

Tracking

Test plan

  • bash lint passes (Python side clean; ruff verified locally).
  • bash autoresearch lpc845 --pwm-dma-cl runs fbuild build → fbuild deploy → RPC echo without touching pyocd or any CMSIS-DAP HID interface. First-attempt validation on the LPC845-BRK is a follow-up to this PR (blocked in this session by the pre-existing halted target from the last failed pyocd load).
  • Separate concern flagged in the PR-comment section: LPC845 DMA-to-GPIO may be silicon-blocked. Even after this PR + fbuild deploy work, silicon verification of the pwm-dma-cl driver is architecturally uncertain until NXP confirms via their forum.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Standardized LPC845/LPC8xx bring-up so flashing/uploading is done through the standard build+deploy flow (using the nxplpc deployer) for more consistent reset/flashing behavior.
    • Improved LPC watchdog handling for LPC845/804 by switching to vendor register structs, enhancing warning/NMI and reset-cause behavior.
    • Narrowed the LPC watchdog dispatcher to LPC845/804 targets to avoid unintended fallback usage on other LPC parts.
  • Documentation
    • Expanded deployment policy and autoresearch guidance: hardware deployment must use the standard deploy entrypoint, with clear instructions for missing deploy backends and fail-loud behavior.

…ocd)

`ci/autoresearch/phases.py::_build_and_flash_nxplpc` was invoking `pyocd
load` + `pyocd commander reset` directly. On this Windows box with the
on-board LPC-Link2 (CMSIS-DAP v1.0.7 firmware, 2013 vintage), `pyocd`
wedges on the Windows HID transport indefinitely — `pyocd list` never
returns, `pyocd load` never returns, and the LPC845 is left halted with
its shared VCOM silenced. An 8-minute wall-clock timeout is required to
unstick each invocation.

Fix: rip out the direct pyocd path. autoresearch is a bench-orchestration
tool; it is not a flasher. Rename the helper to
`_build_and_deploy_nxplpc` and route the deploy phase through `fbuild
deploy` — the same layer that owns the build. If fbuild lacks a deploy
backend for the target (nxplpc as of today), the call fails loudly with
a pointer to the tracking issue instead of wedging the probe again. The
error message explicitly forbids re-adding a fallback here.

Also codify the rule so it doesn't regress:
- `CLAUDE.md` — new "Deployment is fbuild's job — ALWAYS" section under
  Core Rules.
- `agents/docs/build-system.md` — full rule + rationale, tools blocklist,
  and what to do when fbuild is missing a backend.
- `agents/docs/hardware-autoresearch.md` — restates the rule at the
  autoresearch-doc level for agents landing there directly.

Deployment wedge-proofing (timeout guards, probe preflight, UART ISP
fallback, Windows CMSIS-DAP v1 warning, VCOM unwedge) belongs in one
place with proper hardening, not scattered across every FastLED script
that wants to flash a board. That work is tracked at
FastLED/fbuild#921 (supersedes fbuild#551, extends fbuild#565).

Refs: FastLED/fbuild#921, FastLED/fbuild#565, FastLED/fbuild#551

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Documentation now requires fbuild deploy for flashing, autoresearch threads LPC compile defines into staging, LPC deploys through fbuild deploy, and the LPC watchdog code moves to vendor register structs with a narrower dispatch path.

Changes

fbuild Deployment Policy and Autoresearch Flow

Layer / File(s) Summary
Deployment policy documentation
CLAUDE.md, agents/docs/build-system.md, agents/docs/hardware-autoresearch.md
New docs sections forbid direct flash/upload tools and require fbuild deploy as the only deployment entrypoint.
LPC bench define plumbing
ci/autoresearch/staging.py, ci/autoresearch/phases.py
Staging accepts extra compile defines, and LPC autoresearch passes DMA-related defines through both early and deferred synthesis paths.
LPC deploy helper
ci/autoresearch/phases.py
The LPC bring-up path now calls _build_and_deploy_nxplpc, and the helper uses fbuild build plus fbuild deploy instead of pyocd flash/reset.

LPC Watchdog Vendor-Struct Migration

Layer / File(s) Summary
LPC watchdog register rewrite
src/platforms/arm/lpc/watchdog_lpc.impl.hpp, src/platforms/arm/lpc/rx_sct_capture.cpp.hpp
The LPC watchdog implementation now uses vendor WWDT/SYSCON structs, with updated feed, reset-cause, and NMI backtrace handling plus comment updates.
ARM LPC watchdog dispatch
src/platforms/watchdog.impl.cpp.hpp
The ARM LPC watchdog dispatcher is narrowed to LPC845/LPC804, with other LPC variants falling back to noop.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • FastLED/FastLED#3009: Introduced the _build_and_flash_nxplpc(...) flow that this PR replaces with _build_and_deploy_nxplpc(...).
  • FastLED/FastLED#3014: Overlaps with the LPC watchdog implementation and ARM LPC dispatcher changes in this PR.
  • FastLED/FastLED#3438: Also migrates LPC watchdog code toward vendor CMSIS register structs and away from hand-rolled register access.
🚥 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 main change: autoresearch deployment is delegated to fbuild and direct pyocd flashing is removed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 feat/delegate-flash-to-fbuild

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ci/autoresearch/phases.py (1)

2147-2179: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove the implicit lpc845brk fallback for environment.

Lines 2151, 2166, and 2179 silently substitute lpc845brk when environment is missing. That masks caller bugs and can deploy the wrong board instead of surfacing the broken contract; ci/util/fbuild_runner.py:654 already treats environment as mandatory for deploy. Fail fast before launching either subprocess. As per coding guidelines, "Never use silent fallbacks for missing critical resources - always fail fast with descriptive errors".

Suggested fix
 def _build_and_deploy_nxplpc(
     build_dir: Path,
     *,
     environment: str | None,
     upload_port: str | None,
     verbose: bool,
 ) -> bool:
@@
-    env = dict(os.environ)
+    if not environment:
+        print(f"{Fore.RED}❌ nxplpc deployment requires an explicit environment{Style.RESET_ALL}")
+        return False
+
+    resolved_environment = environment
+    env = dict(os.environ)
@@
     build_cmd = [
         "fbuild",
         "build",
         "--environment",
-        environment or "lpc845brk",
+        resolved_environment,
     ]
@@
         build_dir
         / ".fbuild"
         / "build"
-        / (environment or "lpc845brk")
+        / resolved_environment
         / "release"
         / "firmware.bin"
     )
@@
     deploy_cmd = [
         "fbuild",
         "deploy",
         "--environment",
-        environment or "lpc845brk",
+        resolved_environment,
     ]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/autoresearch/phases.py` around lines 2147 - 2179, The build-and-deploy
flow in phases.py is silently falling back to lpc845brk when environment is
missing, which can hide caller bugs and target the wrong board. Update the
fbuild build/deploy setup in the relevant helper to require environment
explicitly, fail fast with a descriptive error before either subprocess runs,
and remove the repeated environment or "lpc845brk" substitutions in the build
command, firmware path, and deploy command. Use the existing build/deploy helper
symbols in this block to keep the check centralized and consistent with
ci/util/fbuild_runner.py’s mandatory environment contract.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/autoresearch/phases.py`:
- Around line 2129-2135: The LPC helper was renamed from _build_and_flash_nxplpc
to _build_and_deploy_nxplpc, so the downstream test mock is still patching the
old symbol and won’t intercept the call. Update the patch target in
ci/tests/test_autoresearch_phases.py to use _build_and_deploy_nxplpc, and make
sure any assertions around the LPC path still reference the renamed helper so
the test continues to stub the subprocess flow correctly.

---

Outside diff comments:
In `@ci/autoresearch/phases.py`:
- Around line 2147-2179: The build-and-deploy flow in phases.py is silently
falling back to lpc845brk when environment is missing, which can hide caller
bugs and target the wrong board. Update the fbuild build/deploy setup in the
relevant helper to require environment explicitly, fail fast with a descriptive
error before either subprocess runs, and remove the repeated environment or
"lpc845brk" substitutions in the build command, firmware path, and deploy
command. Use the existing build/deploy helper symbols in this block to keep the
check centralized and consistent with ci/util/fbuild_runner.py’s mandatory
environment contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 454b8fcc-1adf-4b54-890d-c3dccff337d0

📥 Commits

Reviewing files that changed from the base of the PR and between 0422e72 and b0a8090.

📒 Files selected for processing (4)
  • CLAUDE.md
  • agents/docs/build-system.md
  • agents/docs/hardware-autoresearch.md
  • ci/autoresearch/phases.py

Comment thread ci/autoresearch/phases.py Resolved
@zackees

zackees commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Related silicon concern: LPC845 DMA-to-GPIO may not be supported

Parking this here because it affects what "deploy works" actually validates — even after fbuild#921 lands.

The finding (surfaced from a community observation; awaiting NXP confirmation):

Damn, seems that P0_0 (and any GPIO) can't be a DMA target on this chip. I can't find that in the datasheet or user manual. I did find some references which are not definitive but hint that this might be the case: https://community.nxp.com/t5/LPC-Microcontrollers/Lpc-824-DMA-to-GPIO/m-p/650903

Edit: asked on the NXP forum: https://community.nxp.com/t5/LPC-Microcontrollers/LPC845-DMA-write-to-GPIO-fails/m-p/2389301#M59636

Why this matters for the LPC845 work:

The current pwm-dma-cl clockless engine architecture (scaffold in closed #3468, tracked in closed meta #3517) uses:

RAM buffer → DMA0 → GPIO PORT register → physical pin

If DMA-to-GPIO doesn't work on real LPC845 silicon, this data path silently fails or bus-faults — no LED output regardless of how well deploy succeeds. Same class of bug as the reverted LPC804 phantom DMA cascade (#3505 / peripheral-existence guardrail), but subtler: DMA does exist on LPC845, just possibly can't target this specific destination register family.

Workaround if NXP confirms the gap — SCT-drives-pin + DMA feeds SCT match:

RAM buffer → DMA0 → SCT->MATCHREL[duty]   (peripheral reg, standard DMA target)
                        │
                        ▼ (SCT internal comparator + match action)
                    CTOUT_x → SWM → physical pin
  • DMA target becomes the SCT peripheral register (mainstream, documented NXP DMA use).
  • SCT hardware toggles the pin natively via SWM — pin toggle never involves DMA.
  • Zero CPU per bit, same behavioural contract as the current design.
  • Requires redesigning the driver around SCT-match reload triggered by SCT0_DMAREQ0/_DMAREQ1 events instead of the current DMA-to-GPIO scheme.

Immediate implications for #3550:

  1. This PR (delegate deploy to fbuild) is still correct and worth landing — deploy needs to be fbuild's job regardless of what driver runs on the chip.
  2. But the closed meta META: LPC845 DMA driver completion — clockless + SPI, silicon-verified in one burn-down session #3517 acceptance criteria ("silicon-verified" for pwm-dma-cl) may be architecturally invalid until either NXP confirms DMA-to-GPIO works, or the driver is redesigned around DMA-to-SCT-match.
  3. Silicon verification for the meta should be blocked until the NXP forum thread lands a definitive answer. Do NOT reopen and mark META: LPC845 DMA driver completion — clockless + SPI, silicon-verified in one burn-down session #3517 verified based on any autoresearch pass that hasn't been byte-sniffed on a scope — the failure mode here is "DMA appears to run, no data reaches pin, no error surfaces" and it will spoof a green run.

Suggested follow-up (once NXP answers):

  • If DMA-to-GPIO works → no action needed on the driver; the current architecture stands.
  • If DMA-to-GPIO doesn't work → file a fresh FastLED issue "LPC845 pwm-dma-cl: redesign around DMA-to-SCT-match (silicon workaround)" referencing this comment and the NXP thread; revert AutoResearch: PWM+DMA clockless validation harness for LPC845 (paired sibling of #3456) #3468's DMA-to-GPIO scheme in favor of the SCT-match reload architecture; update agents/docs/peripheral-existence.md with the new anti-example ("peripheral exists but destination register family is silicon-blocked — halt-on-phantom pattern extends beyond peripheral existence to peripheral capability").

Cross-refs: #3517 (closed meta), #3468 (closed scaffold), #3505 (LPC804 phantom precedent), fbuild#921 (deploy hardening).

zackees and others added 2 commits July 1, 2026 20:06
…921

Filed FastLED/fbuild#921 without spotting that fbuild#595 already shipped
the exact deployer being requested. #921 is now closed as redundant.

Updated references throughout to point at the actual merged work:

- **#595** — LpcDeployer Phase 1 (lpc21isp UART ISP path). Wires the
  `Platform::NxpLpc` arm in fbuild-daemon's deploy dispatch. Sidesteps
  the CMSIS-DAP HID wedge entirely because lpc21isp uses the CDC/VCOM
  UART, not the HID interface.
- **#923** — path resolver + baud/hex safety nets.
- **#928** — `-bin` handling + `\.\COM10` prefix for Windows serial ports.

Files:
- `ci/autoresearch/phases.py::_build_and_deploy_nxplpc` — docstring +
  error path reference the shipped PR chain instead of the closed issue.
- `CLAUDE.md`, `agents/docs/build-system.md`,
  `agents/docs/hardware-autoresearch.md` — same substitution in the
  "Deployment is fbuild's job" rule text.

No behavioral change; comments/docs only.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
First live run against fbuild 2.3.24 failed with
"error: unexpected argument '--upload-port' found" — fbuild's deploy
CLI flag is -p/--port. Verified end-to-end on LPC845-BRK hardware:
build → fbuild deploy (probe-rs SWD, ~2 s, touchless) → VCOM reopens →
freshly-flashed firmware answers JSON-RPC.

Co-Authored-By: Claude Fable 5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ci/autoresearch/phases.py (1)

2158-2158: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle missing fbuild with the existing failure path. Both subprocess.run(...) calls can raise FileNotFoundError before returncode is checked, so a missing or non-executable fbuild still ends in a traceback instead of the descriptive deploy error message.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/autoresearch/phases.py` at line 2158, The build invocation in the deploy
flow can raise FileNotFoundError before the returncode check, so a missing or
non-executable fbuild bypasses the existing error handling. Update the
subprocess.run path in phases.py so the build_cmd execution is wrapped by the
same failure handling used for other deploy/build failures, and ensure the code
that reports the descriptive deploy error message is reached for
FileNotFoundError as well. Use the build execution logic around subprocess.run
and the existing deploy failure path in this phase as the reference point.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@ci/autoresearch/phases.py`:
- Line 2158: The build invocation in the deploy flow can raise FileNotFoundError
before the returncode check, so a missing or non-executable fbuild bypasses the
existing error handling. Update the subprocess.run path in phases.py so the
build_cmd execution is wrapped by the same failure handling used for other
deploy/build failures, and ensure the code that reports the descriptive deploy
error message is reached for FileNotFoundError as well. Use the build execution
logic around subprocess.run and the existing deploy failure path in this phase
as the reference point.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e2907de8-87bd-43fc-a194-1a0e16e41bca

📥 Commits

Reviewing files that changed from the base of the PR and between 5873e32 and 38044b2.

📒 Files selected for processing (1)
  • ci/autoresearch/phases.py

…+ bench defines

Three coordinated fixes, all silicon-validated on the LPC845-BRK today:

1. **Watchdog never armed — MOD/TC registers were swapped.** The
   hand-rolled WWDT map in watchdog_lpc.impl.hpp had TC at offset 0x0
   and MOD at 0x4; the vendor CMSIS PAL (and UM11029) say MOD=0x0,
   TC=0x4. begin() therefore wrote the tick count into MOD (WDEN never
   set) and the mode bits into TC — the watchdog silently did nothing.
   Diagnosed on silicon: a deliberately wedged RPC handler ran forever
   with a 3 s watchdog "armed". Rewrote the file to use vendor
   WWDT_Type/SYSCON_Type structs per the #3437 no-hand-rolled-maps
   policy (the file's old "vendor header only has IRQ enums" rationale
   was stale since framework#33/#34 shipped the full PAL). Also gated
   the impl selector to LPC845/LPC804 only — the old code poked LPC84x
   addresses on LPC11xx/15xx, which have different SYSCON layouts;
   those now take the no-op backend.

2. **Wedge backtrace via WWDT warning → NMI.** begin() programs
   WARNINT (~8 ms before reset) and routes the WDT interrupt to the
   Cortex-M0+ NMI via SYSCON->NMISRC. The ACLPC core's NMI_Handler
   (strong alias of HardFault_Handler) already prints the stacked
   PC/LR/xPSR of the interrupted context and resets — so a wedge now
   emits `FAULT: HardFault PC=<wedged addr> ...` live over USART0 and
   the chip self-recovers. Validated: wedge at t=0 → backtrace line at
   t=+3.0 s → PC symbolicated against firmware.map to the exact static
   object (`autoresearch::dma_spi::harnessDriver()::drv`) the SPI+DMA
   driver had jumped into → boot banner → RPC echo alive again with no
   physical intervention. Opt out: -DFL_LPC_WDT_NMI_BACKTRACE=0.

3. **autoresearch injects the bench gate defines.** `--dma-spi` now
   adds FASTLED_LPC_SPI_DMA=1 (and FASTLED_LPC_SPI_DMA_MAX_BYTES=512)
   to the synthesised build_flags; `--pwm-dma-cl` adds
   FASTLED_LPC_PWM_DMA=1. Without the gate macro the harness compiles
   out and every bench RPC reports "no reply" against healthy firmware.
   The 512-byte cap matters: at the driver default (2048) the u16
   encode buffer (4 KB) + u8 harness buffer (2 KB) pushed static RAM
   to 15.10/16 KB (94%) and the first RPC HardFaulted at PC=0 when
   heap/stack collided. Capped: 10.60 KB (66%), firmware stable.

Known remaining (tracked separately): the SPI+DMA driver itself still
wedges on first use — control flow jumps into the driver's static
object during lazy init. The new backtrace pinpointed it; fix follows.

Refs: #3456, #3453, #3437, #3300 (this explains the suspected-HardFault
empty-RX blocker: RAM exhaustion + never-armed watchdog).

Co-Authored-By: Claude Fable 5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
ci/autoresearch/phases.py (1)

899-917: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Factor the LPC bench define selection into one helper.

The parse-time and deferred-synthesis paths now duplicate the same define list; a small helper avoids future drift where one path compiles the bench handlers and the auto-detected path does not.

Proposed refactor
+def _lpc_bench_defines_from_args(args: Args) -> list[str]:
+    lpc_bench_defines: list[str] = []
+    if getattr(args, "dma_spi", False):
+        lpc_bench_defines.append("FL_LPC_SPI_DMA=1")
+        lpc_bench_defines.append("FL_LPC_SPI_DMA_MAX_BYTES=512")
+    if getattr(args, "pwm_dma_cl", False):
+        lpc_bench_defines.append("FL_LPC_PWM_DMA=1")
+    return lpc_bench_defines

Then call it from both synthesis paths.

Also applies to: 1193-1208

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/autoresearch/phases.py` around lines 899 - 917, The LPC bench define
selection is duplicated between the parse-time and deferred-synthesis paths,
which can drift and cause the wrong bench handlers to be compiled. Extract the
shared logic into a single helper near the existing lpc_bench_defines setup in
phases.py, use it in both synthesis paths, and ensure the helper preserves the
current args checks for dma_spi and pwm_dma_cl along with
FASTLED_LPC_SPI_DMA_MAX_BYTES.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/autoresearch/phases.py`:
- Around line 899-917: The new LPC compile flags in lpc_bench_defines still use
the запрещён legacy FASTLED_* prefix; rename them to the required FL_LPC_*
equivalents here and in the matching C++ preprocessor checks. Update the flag
strings added under args.dma_spi and args.pwm_dma_cl, including the SPI DMA
max-bytes define, and make sure every corresponding `#if` defined(...) site in the
same PR uses the new identifiers consistently.

In `@ci/autoresearch/staging.py`:
- Around line 46-49: The example in the staging docs uses an outdated FASTLED_*
build flag name; update the `extra_defines` description to use the new `FL_*`
macro vocabulary instead. In the `staging.py` comment/example, replace the
`FASTLED_LPC_SPI_DMA` reference with the matching `FL_LPC_SPI_DMA` define and
keep the wording aligned with what `phases.py` actually emits. Use the
`extra_defines` docstring text and the `--dma-spi` example as the place to fix.

In `@src/platforms/arm/lpc/watchdog_lpc.impl.hpp`:
- Around line 53-55: Rename the new configuration macro in watchdog_lpc.impl.hpp
from FL_LPC_WDT_NMI_BACKTRACE to the spelled-out FL_WATCHDOG_LPC_NMI_BACKTRACE,
and update every related reference consistently. Make sure the documentation
text and all conditional compilation checks in the watchdog implementation use
the same FL_WATCHDOG_* vocabulary, including the places covered by the later
occurrences in the file.
- Around line 175-178: The watchdog tick calculation in watchdog_lpc.impl.hpp
overflows in the timeout_ms * kTickHz multiplication before clamping, so the
computed window can be too short. Update the tick computation in the watchdog
programming path to use 64-bit arithmetic first, then clamp to the hardware
minimum and 24-bit ceiling before assigning to WWDT->TC. Keep the fix localized
around the tick calculation and the watchdog initialization logic in the
relevant function.

---

Nitpick comments:
In `@ci/autoresearch/phases.py`:
- Around line 899-917: The LPC bench define selection is duplicated between the
parse-time and deferred-synthesis paths, which can drift and cause the wrong
bench handlers to be compiled. Extract the shared logic into a single helper
near the existing lpc_bench_defines setup in phases.py, use it in both synthesis
paths, and ensure the helper preserves the current args checks for dma_spi and
pwm_dma_cl along with FASTLED_LPC_SPI_DMA_MAX_BYTES.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d222a9c-355c-4cd8-bc04-dfc8ed03140c

📥 Commits

Reviewing files that changed from the base of the PR and between 38044b2 and a49ecc0.

📒 Files selected for processing (5)
  • ci/autoresearch/phases.py
  • ci/autoresearch/staging.py
  • src/platforms/arm/lpc/rx_sct_capture.cpp.hpp
  • src/platforms/arm/lpc/watchdog_lpc.impl.hpp
  • src/platforms/watchdog.impl.cpp.hpp
✅ Files skipped from review due to trivial changes (1)
  • src/platforms/arm/lpc/rx_sct_capture.cpp.hpp

Comment thread ci/autoresearch/phases.py Resolved
Comment thread ci/autoresearch/staging.py Resolved
@zackees
zackees merged commit a684d27 into master Jul 2, 2026
15 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 2, 2026
zackees added a commit that referenced this pull request Jul 2, 2026
## ISR-refillable drivers (#3453 follow-up)

- **`lpc_dma_isr.h`** — shared DMA0 interrupt hub: one strong
  `DMA0_IRQHandler` (the LPC845 has a single DMA IRQ line for all 25
  channels) dispatching `INTA` completion bits to per-channel callbacks
  registered via `fl::lpc::registerDmaChannelIsr()`. Opt-in via
  `FASTLED_LPC_DMA_ISR=1`; requires the ACLPC core with named weak IRQ
  vector slots (framework-arduino-lpc8xx#38, merging alongside).

- **SPI streaming** — `ARMHardwareSPIOutputDMA::kickDmaStreamAsync()`:
  ping-pong halves of the encode buffer; the completion ISR arms the
  pre-encoded other half (~2 µs wire gap) and refills the freed one, so
  frames larger than the buffer stream without blocking the main
  thread. Bench RPC `dmaSpiStreamOverlap` (gated on the ISR build)
  beacon-toggles across a 1024-byte multi-chunk stream.

- **UART async TX** — new `ARMHardwareUARTOutputDMA<TX_PIN, BAUD>`
  (`uart_arm_lpc_dma.h`): USART1 (or 2) TX paced by its fixed DMA
  request channel (ch3/ch5 per UM11029 Table 296), chunks chained from
  the ISR, DMA reading the caller's buffer in place (no staging copy).
  Owns its full plumbing (clock, reset, FCLKSEL, SWM, OSR/BRG baud
  search) per the #3580 lesson. USART0 stays free as the console —
  the "drive a data lane and keep printing" capability.

- **Bench**: `bash autoresearch lpc845 --dma-uart` — new harness
  (`AutoResearchUartDma.h`, `uartDmaStreamOnce`/`Overlap` RPCs, 2048-
  byte streams = two descriptors so completion REQUIRES the ISR chain),
  host runner `test_lpc_uart_dma.py`, args/phases wiring, define
  injection (`FASTLED_LPC_UART_DMA=1` + `FASTLED_LPC_DMA_ISR=1`).

## CodeRabbit review fixes (PR #3550)

- `test_autoresearch_phases.py`: mock patches the renamed
  `_build_and_deploy_nxplpc` (was silently missing the LPC path).
- Watchdog tick math: u64 intermediate — `60000 ms * 125 kHz` wraps
  u32 above ~34.3 s and programmed a much shorter window.
- `FL_LPC_WDT_NMI_BACKTRACE` → `FL_LPC_WATCHDOG_NMI_BACKTRACE`
  (spelled-out vocabulary; macro is new in this PR).

Silicon status: SPI sync bench remains green (rebuilt, RAM 11.41 KB);
the ISR paths await the ACLPC weak-alias core (framework#38) + fbuild
pin bump before on-device validation.

Refs #3453, #3580, framework-arduino-lpc8xx#38.

Co-Authored-By: Claude Fable 5 <[email protected]>
zackees added a commit that referenced this pull request Jul 5, 2026
…n AutoResearch (#3601)

* fix(lpc): SPI+DMA driver works on silicon — 6 stacked hardware bugs (closes #3580)

`bash autoresearch lpc845 --dma-spi` is now fully green on the
LPC845-BRK: build → fbuild deploy (probe-rs SWD) → all four bench RPCs
PASS, including the async proof (978 CPU beacon toggles during a
512-byte DMA stream) and a throughput measurement matching the
FIFO-less-IP physical model.

Six independent silicon bugs, each masking the next, bisected with the
WWDT NMI backtrace + breadcrumb prints + bounded-spin register
snapshots:

1. **DMA0->SRAMBASE never programmed.** The driver "punted to the SDK
   conventional address" that nothing ever set — the DMA engine fetched
   channel descriptors from the FLASH VECTOR TABLE at address 0 and
   wrote through garbage pointers, corrupting .bss (the original
   PC=<static object> wedge). New shared `lpc_dma_descriptor_table.h`
   owns a FL_ALIGNAS(512) 25-channel table; both the SPI driver and the
   SCT+DMA runtime call `fl::lpc::ensureDmaSramBase()` at init, and
   `configureChannelDescriptor()` now returns bool so SETVALID can
   never arm an unwritten descriptor.

2. **SPI peripheral never clocked.** init() assumed "the user's startup
   enables the SPI clock + SWM routing" — nothing did, and reading an
   unclocked LPC peripheral stalls the AHB bus forever (no fault; the
   load never retires). init() now owns SYSAHBCLKCTRL0 (SPI0/1 + SWM),
   PRESETCTRL0 reset release, and SWM PINASSIGN routing of SCK/MOSI to
   the template pins.

3. **Wrong DMA channel.** Default was 4, citing a nonexistent
   "UM11029 Table 80". Ground truth (UM11029 §16.3.3 Table 296):
   channel 4 is USART2_RX; SPI0_TX is channel 11, SPI1_TX is 13. The
   armed channel sat waiting for a request line that never fires.

4. **Channel never TRIGGERED.** XFERCFG.SWTRIG was 0 on the belief that
   "the SPI TXRDY hardware-triggers it" — but PERIPHREQEN requests only
   PACE transfers; the channel must first be triggered (CTLSTAT.TRIG),
   and with HWTRIGEN=0 only software can do that. Register snapshot
   showed CFGVALID=1, TXRDY=1, TRIG=0, XFERCOUNT frozen. SWTRIG=1.

5. **SPI function clock unselected.** SYSCON->FCLKSEL[9] (SPI0) resets
   to "none": the register bus worked but the shift engine had no
   clock — first DMA write accepted, then STAT=0 and frozen mid-shift.
   init() selects main_clk.

6. **Frame never closed after a stream.** DMA writes plain TXDAT (no
   per-unit EOT), so the master held the frame open and MSTIDLE never
   re-asserted — every handler call after a completed stream wedged in
   its entry waitFully() (bench alternated PASS/WEDGE via watchdog
   reboots). Per-byte sticky EOT fixed it but cost 39% throughput in
   SSEL gaps (4 MHz → 2.46 MHz effective, measured); final fix closes
   the frame once in waitFully() via STAT.ENDTRANSFER after the DMA
   drains.

Bench-side changes:
- `AutoResearchSpiDma.h`: bounded spin (2M iters) returns a DMA/SPI
  register snapshot CSV instead of wedging into the watchdog; stale
  "fbuild SystemInit configures SPI0" comment corrected.
- `test_lpc_dma_spi.py`: SCK check remodeled as effective throughput.
  The LPC845 SPI is FIFO-less — each byte costs 8/SCK shift + ~0.76 us
  DMA refill (measured), so wire SCK 4 MHz yields ~2.9 MHz effective.
  The old ±25%-of-wire-SCK band was physically unattainable.
- `phases.py`: channel-override hints corrected (SPI1=13, SPI0=11).

Acceptance (LPC845-BRK, COM10, 2026-07-02):
    dmaSpiTransferOnce(32)   PASS — 109 us (theoretical 64)
    dmaSpiTransferOnce(256)  PASS — 716 us (theoretical 512)
    dmaSpiTransferOverlap    PASS — 1411 us, 978 CPU toggles during DMA
    dmaSpiMeasureSck         PASS — 2.894 MHz effective vs 2.76 model
    PASS — #3456 SPI+DMA async bench green.

Closes #3580. Refs #3456, #3453 (Phase 1 silicon gate), #3517 (Phase
B.1 acceptance — now genuinely met), #3437 (vendor-PAL policy).

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(lpc): polled SPI driver owns its LPC845 peripheral plumbing too

Port the silicon-validated init block from the DMA sibling (#3580) to
ARMHardwareSPIOutput<>: SYSAHBCLKCTRL0 (SPI0/1 + SWM), PRESETCTRL0
reset release, FCLKSEL function-clock select, and SWM SCK/MOSI routing.
Without it the first spi->STAT read stalls the AHB bus forever — the
polled driver had the identical "user's startup does the plumbing"
contract that nothing honors. LPC845-gated; LPC804 keeps the old
contract until it gets vendor-PAL bring-up of its own.

Compile-verified in the lpc845 AutoResearch build (the DMA harness
includes this header).

Refs #3580, #3453.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(lpc): ISR-refillable async streaming (SPI + UART) + review fixes

## ISR-refillable drivers (#3453 follow-up)

- **`lpc_dma_isr.h`** — shared DMA0 interrupt hub: one strong
  `DMA0_IRQHandler` (the LPC845 has a single DMA IRQ line for all 25
  channels) dispatching `INTA` completion bits to per-channel callbacks
  registered via `fl::lpc::registerDmaChannelIsr()`. Opt-in via
  `FASTLED_LPC_DMA_ISR=1`; requires the ACLPC core with named weak IRQ
  vector slots (framework-arduino-lpc8xx#38, merging alongside).

- **SPI streaming** — `ARMHardwareSPIOutputDMA::kickDmaStreamAsync()`:
  ping-pong halves of the encode buffer; the completion ISR arms the
  pre-encoded other half (~2 µs wire gap) and refills the freed one, so
  frames larger than the buffer stream without blocking the main
  thread. Bench RPC `dmaSpiStreamOverlap` (gated on the ISR build)
  beacon-toggles across a 1024-byte multi-chunk stream.

- **UART async TX** — new `ARMHardwareUARTOutputDMA<TX_PIN, BAUD>`
  (`uart_arm_lpc_dma.h`): USART1 (or 2) TX paced by its fixed DMA
  request channel (ch3/ch5 per UM11029 Table 296), chunks chained from
  the ISR, DMA reading the caller's buffer in place (no staging copy).
  Owns its full plumbing (clock, reset, FCLKSEL, SWM, OSR/BRG baud
  search) per the #3580 lesson. USART0 stays free as the console —
  the "drive a data lane and keep printing" capability.

- **Bench**: `bash autoresearch lpc845 --dma-uart` — new harness
  (`AutoResearchUartDma.h`, `uartDmaStreamOnce`/`Overlap` RPCs, 2048-
  byte streams = two descriptors so completion REQUIRES the ISR chain),
  host runner `test_lpc_uart_dma.py`, args/phases wiring, define
  injection (`FASTLED_LPC_UART_DMA=1` + `FASTLED_LPC_DMA_ISR=1`).

## CodeRabbit review fixes (PR #3550)

- `test_autoresearch_phases.py`: mock patches the renamed
  `_build_and_deploy_nxplpc` (was silently missing the LPC path).
- Watchdog tick math: u64 intermediate — `60000 ms * 125 kHz` wraps
  u32 above ~34.3 s and programmed a much shorter window.
- `FL_LPC_WDT_NMI_BACKTRACE` → `FL_LPC_WATCHDOG_NMI_BACKTRACE`
  (spelled-out vocabulary; macro is new in this PR).

Silicon status: SPI sync bench remains green (rebuilt, RAM 11.41 KB);
the ISR paths await the ACLPC weak-alias core (framework#38) + fbuild
pin bump before on-device validation.

Refs #3453, #3580, framework-arduino-lpc8xx#38.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(lpc): DMA ISR hygiene — stale-INTA clear, end-of-stream quiesce, trace hooks

Silicon-hardening from the first ISR-streaming bring-up session:

- **Hub (`lpc_dma_isr.h`)**: `registerDmaChannelIsr` now W1C-clears any
  stale INTA and NVIC pending before enabling — a prior synchronous
  transfer (XFERCFG.SETINTA) left INTA pending and the callback fired
  before the caller finished initializing its stream state.
- **Single-TU handler**: `DMA0_IRQHandler` moved from the hub header to
  `lpc_dma_isr.cpp.hpp` (unity slot) — a non-inline extern "C"
  definition in a header emitted one copy per TU and failed the link
  with 10+ "multiple definition" errors.
- **End-of-stream quiesce (both drivers)**: the ISR's final branch now
  INTENCLRs its channel. Leaving the gate open let a residual
  completion fire into post-stream state and HardFault the RPC reply
  path (deterministic PC in the stack region; gone with the quiesce).
- **SPI INTENSET.TXRDYEN removed**: a leftover from the failed pacing
  hypothesis (#3580 — SWTRIG was the real fix). A pending-but-disabled
  TXRDY line is a live grenade the moment anything enables SPI0_IRQn.
- **Opt-in ISR trace** (`-DFASTLED_LPC_SPI_DMA_ISR_TRACE=1`): polled
  breadcrumbs from IRQ context — this is what bisected all of the above.
- `--dma-spi` now also injects `FASTLED_LPC_DMA_ISR=1`.
- Test helper Args factory gains the pwm_dma_cl/dma_spi/dma_uart fields
  (pre-existing construction failure).

Silicon status (LPC845-BRK, 2026-07-02):
- UART async bench: green ×3 runs including back-to-back 2048-byte
  streams (20,511 µs vs 20,480 theoretical; 8,455 toggles).
- SPI sync bench: green (unchanged).
- SPI ISR stream: FIRST stream green ("1,2577,1358" — 1024 B, 4 chained
  chunks, 1358 main-thread toggles); repeat-kick corrupts memory —
  tracked with full evidence at #3585.

Refs #3453, #3580, #3585, framework-arduino-lpc8xx#38, fbuild#944.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(autoresearch): route LPC bench serial through fbuild's Rust monitor, not pyserial

The LPC845 SPI/UART bench runners hand-rolled raw pyserial request/reply
loops. On Windows these dropped replies ~one-per-session — `in_waiting`
under-reports, a pre-write `reset_input_buffer()` races the reply,
byte-at-a-time reads straddle the port timeout. The firmware answered
every RPC correctly (verified with a tight manual loop); the pyserial
*transport* lost them.

Fix: both runners now use `ci.rpc_client.RpcClient` over
`ci.util.serial_interface.create_serial_interface()` — fbuild's native
(Rust) serial monitor, the same path ble/decode/driver_sweep/coroutine
tests already use. Mandatory JSON-RPC id correlation + correct framing
make the bench 100% deterministic (SPI: 5/5 cases green run after run;
UART: 2/2). A thin `SpiBench`/`UartBench` sync facade wraps the async
client so the run_* helpers are unchanged.

Two supporting changes this required:
- The bench C++ handlers were `(int, int)` positional — the raw-pyserial
  convention. RpcClient wraps args as a single JSON param, so the
  handlers now take `(const fl::json& args)` and read `args[N].as_int()`
  (the house convention every `-> fl::json` handler already uses).
  Handler logic is unchanged; only the bind adapter differs.
- The handlers return a CSV *string*; RpcClient coerces non-dict results
  to {} but preserves the full line in `raw_line`, so the facade
  recovers the CSV there. (A later cleanup could return fl::json objects.)

Docs: new "Device serial: fbuild's Rust monitor ONLY — NEVER raw
pyserial" rule in agents/docs/hardware-autoresearch.md, plus a "Device
serial - No raw pyserial" entry in agents/docs/python-standards.md.

Also folds in the #3585 RAM fix: the SPI ISR-stream harness buffer
defaults to 512 B (was 1024) so the DMA ISR's deep preemption of the
RPC stack can't collide with the heap on the 16 KB part — that was the
"repeat-kick corruption", a stack/heap collision, not a driver bug (the
ping-pong logic is correct: 5 back-to-back streams green with headroom).

Refs #3456, #3453, #3585.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(lint): PYS001 — ban raw pyserial in AutoResearch; migrate all offenders

## The checker

`ci/lint_python/pyserial_checker.py` (PYS001) bans `import serial` /
`from serial import ...` anywhere under `ci/autoresearch/`. No allowlist:
device serial must go through fbuild's native (Rust) serial monitor via
`ci.rpc_client.RpcClient` + `ci.util.serial_interface.create_serial_interface`.
The genuinely-exceptional site (e.g. a not-yet-migrated BLE bridge) uses
an inline `# noqa: PYS001` with a justification. Wired into the Python
lint pipeline (`ci/lint/stage_impls.py`). The low-level pyserial plumbing
under `ci/util/` (the backend that create_serial_interface(use_pyserial=
True) selects) is out of scope — that is where pyserial legitimately lives.

Why: hand-rolled pyserial request/reply loops drop replies ~one-per-
session on Windows (`in_waiting` under-reports, a pre-write
`reset_input_buffer()` races the reply, byte-at-a-time reads straddle the
port timeout). The firmware answers every RPC; pyserial loses them.
Silicon-diagnosed 2026-07-04 on the LPC845 SPI/UART benches.

## All 14 offenders across 12 files migrated

- **Shared facade** `ci/autoresearch/rpc_bench.py` — `RpcBench`, a sync
  wrapper over the async fbuild-backed RpcClient (context-manager +
  CSV-result recovery, since RpcClient coerces non-dict results to {}).
- **7 RPC test runners** (test_lpc_pwm_dma_cl / _ws2812_loopback /
  _pin_toggle_rx, test_flexio_rx_objectfled / _rx_squarewave /
  _spi_smoke, test_objectfled_spi_smoke) → RpcBench.
- **3 debug scripts** → RpcBench (find_pins, object_fled_small) / raw
  SerialInterface firehose (object_fled_capture).
- **ota.py + 2 phases.py port polls** → new sanctioned
  `port_utils.port_exists()` (OS-level list_ports enumeration, no device
  open).
- **phases.py bring-up echo** → SerialInterface write/read_lines.
  Hardware-verified on LPC845: echo sentinel round-trip + REMOTE prefix
  + FL_WARN pipeline all PASS.

Docs: "Device serial: fbuild's Rust monitor ONLY" in
agents/docs/hardware-autoresearch.md + agents/docs/python-standards.md
(committed earlier). KeyboardInterrupt handlers added to every new
connect block (KBI001).

Verified: ruff, PYS001 (0), KBI001 (0), AST all clean; the two
already-migrated runners (test_lpc_dma_spi, test_lpc_uart_dma) stay green
over the same transport.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(agents): mandate `fbuild port scan` before any "board not attached" claim

Strengthens the "Check if the target hardware might already be attached"
rule (cpp-standards.md) with a MANDATORY, unconditional first step: never
write "board X is not attached" / "static-verified only" without first
enumerating what is physically connected via `fbuild port scan` — fbuild's
native scanner that resolves each port's vendor/product from the FastLED
boards DB (two rows per port). Cross-referenced from
hardware-autoresearch.md with example output.

History: on 2026-07-04 an agent declared the flexio/objectfled bench
runners "static-verified only, target ESP32/Teensy boards not attached"
without ever scanning — an ESP32-WROOM (COM11), three ESP32-S3s, and a
Teensy were attached the whole time. When it then reached for raw
pyserial `list_ports`, the developer corrected it to `fbuild port scan`.
Both corrections are now the rule: enumerate, don't infer; use the fbuild
scanner, not pyserial.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(autoresearch): drop sys.path bootstrap (SPI001), launch runners via `-m`

The pyserial→RpcBench migration added a `sys.path.insert(_REPO_ROOT)`
bootstrap to each runner so `from ci.autoresearch.rpc_bench import …`
would resolve when run by script path. That trips the SPI001
sys-path-modification ban. Correct fix: remove the bootstrap and launch
the runners as modules (`uv run python -m ci.autoresearch.<name>`), which
puts the repo root on sys.path[0] so `ci.*` resolves with no hack.

- Removed the `_REPO_ROOT`/`sys.path.insert` block from all 12 runners
  (+ dropped now-unused Path imports, obsolete E402 noqas).
- phases.py: switched all 5 subprocess invocations from
  `"ci/autoresearch/test_lpc_*.py"` to `"-m", "ci.autoresearch.test_lpc_*"`.
- Updated each runner's docstring "Usage:" to the `-m` form.

Verified: SPI001=0, PYS001=0, KBI001=0, ruff clean; `-m` import
resolution confirmed for the runners.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(autoresearch): satisfy ty — dict-arg RPCs + drop stale serial annotation

`bash lint` ty pass flagged 3 type errors from the pyserial→RpcBench
migration:

- RpcBench.call typed `args: list[Any] | None`, but the flexio/objectfled
  runners pass a dict (object-param handlers). Widened to
  `list[Any] | dict[str, Any] | None`, and correspondingly widened
  RpcClient.send's `args` at the source — send wraps `[args]` opaquely as
  the single `fl::json` RPC parameter, so a dict was always valid at
  runtime; the annotation was just too narrow. Backward-compatible
  widening; existing list callers unaffected.
- test_lpc_pwm_dma_cl.py: a run_* helper still annotated `s: "serial.Serial"`
  (leftover from the pre-migration raw-pyserial version) → `s: "RpcBench"`.

Verified: ty clean, ruff clean, SPI001/PYS001/KBI001 = 0.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
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