Repository navigation
docs(agents): add peripheral-existence guardrail (halt on phantom) - #3507
Conversation
Adds `agents/docs/peripheral-existence.md` requiring agents to verify any `<Peripheral>_Type` typedef / `<Peripheral>_BASE` address is actually present in BOTH the vendor CMSIS PAL header for the specific chip variant AND the chip datasheet chapter before writing driver code against it. If either source is absent, halt development and report on the driving issue; do NOT fabricate the missing typedef in the vendor header repo to make the build compile. Cross-linked from: - `agents/docs/register-maps.md` (pre-flight before shim tier decisions) - `.claude/agents/platform-port-agent.md` (description + Step 5 + Key Rules) - `.claude/skills/platform-port/SKILL.md` (LED Output Drivers section) - `CLAUDE.md` "Read the Right File for Your Task" table row Discoverable by grep for: DMA, async driver, phantom peripheral, peripheral existence, vendor CMSIS, FSL_FEATURE_SOC. Canonical anti-example is the four-PR LPC804 phantom-`DMA_Type` cascade (framework-arduino-lpc8xx#35, fbuild#916, #3500, #3505) — LPC804 silicon has no DMA peripheral; NXP's own `LPC804.h` has zero `DMA_Type` / `DMA0_BASE` / `FSL_FEATURE_SOC_DMA_COUNT`, but an agent fabricated one at reserved AHB slot `0x50008000` so downstream driver code would compile. Doc includes copy-pasteable verification recipe (grep vendor CMSIS header + features + drivers dir) plus a false-negative guard so verification of absence is as rigorous as verification of presence. Closes #3506. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds a new agent documentation file, ChangesPeripheral existence guardrail
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…MA silicon (#3513) Reverts the FastLED-side of the phantom LPC804 DMA cascade (PRs #3500 + #3505). LPC804 silicon has no DMA peripheral. Empirical evidence: - NXP's own `mcux-sdk/devices/LPC804/LPC804.h`: zero `DMA_Type` typedef, zero `DMA0_BASE` macro. Only `CRC_BASE = 0x50000000` in the 0x5000_xxxx AHB range; 0x50008000 is a reserved slot. - `LPC804_features.h`: no `FSL_FEATURE_SOC_DMA_COUNT`. LPC845's file has `FSL_FEATURE_SOC_DMA_COUNT = 1` and `FSL_FEATURE_DMA_NUMBER_OF_CHANNELS = 25`. - `devices/LPC804/drivers/`: no `fsl_inputmux_connections.h`. LPC845's driver dir has it (INPUTMUX exists to route peripheral requests to DMA channels — no DMA, no INPUTMUX). - UM11065 has only 3 DMA references, all copy-paste leftovers in ADC / DAC / CAPT / I2C / SPI comment blocks referring to "DMA trigger flags" for a peripheral that does not exist on this die. Diagnosis credit @phatpaul (#3499 comment 4855252061). The revert follows the guardrail landed in #3506 / #3507 (`agents/docs/peripheral-existence.md`). ## Changes - `src/platforms/arm/lpc/spi_arm_lpc_dma.h` — narrow build gate back to `FL_IS_ARM_LPC_845` only. Add a compile-time `#error` that fires with a clear "LPC804 has no DMA" diagnostic + link to peripheral-existence guardrail if a user tries to opt into `FASTLED_LPC_SPI_DMA` on LPC804. Delete the earlier "LPC804 vendor CMSIS PAL prerequisite" text and the LPC804-specific `FASTLED_LPC_SPI_DMA_CHANNEL` default (0 → dropped; the LPC845 default of 4 stands). - `examples/AutoResearch/AutoResearchSpiDma.h` — narrow harness gate back to LPC845 only. - `examples/AutoResearch/AutoResearchLowMemory.h` — narrow include + bind gates back to LPC845 only. - `ci/autoresearch/phases.py` — collapse `LPC_DMA_SPI_ENVS` back to `LPC_WS2812_ENVS` (LPC845 environments only). Drop the `is_lpc804 → core_hz = 15_000_000` branch (always 24 MHz now). - `ci/autoresearch/args.py` — update `--dma-spi` `--help` text: drop LPC804 mention + fbuild prerequisite; note LPC804 not supported. - `src/platforms/arm/lpc/README.md` — LPC804 row now clearly documents "no DMA-async SPI" with citation to the guardrail. `spi_arm_lpc_dma.h` files entry marked LPC845-only. Feature-defines section corrected. References/Shipped entry for #3500 strikethrough-annotated with "REVERTED — see peripheral-existence.md." Follow-up (out of scope for this PR): - Revert `framework-arduino-lpc8xx#35` (the fabricated `DMA_Type` in `variants/lpc804/LPC804.h`). - Revert or supersede `fbuild#916` (bumped ArduinoCore-LPC8xx pin for the fabricated typedef). - Close FastLED #3499 as INVALID. ## Verification - `bash compile wasm --examples AutoResearch` — clean - `bash lint` — python_pipeline passes; cpp_linting fails only on the same pre-existing Rust-binary silent-fail this Windows environment has (unrelated to this diff; see #3510) Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
agents/docs/peripheral-existence.md— a greppable guardrail that requires agents to verify a peripheral EXISTS on the target chip (against BOTH the vendor CMSIS PAL header AND the datasheet peripheral chapter) before writing any code that names a<Peripheral>_Type/<Peripheral>_BASE.agents/docs/register-maps.md,.claude/agents/platform-port-agent.md(description + Step 5 + Key Rules),.claude/skills/platform-port/SKILL.md, and theCLAUDE.mdtask table.Why
Filed against the LPC804 phantom-
DMA_Typecascade documented in #3506. LPC804 silicon has no DMA peripheral — NXP's ownLPC804.hfrommcux-sdkhas zeroDMA_Type/DMA0_BASE/FSL_FEATURE_SOC_DMA_COUNT— but an agent invented one at reserved AHB slot0x50008000so downstream driver code would compile. The shipped driver would write control words into reserved memory at runtime.Four-PR cascade the guardrail is designed to prevent recurring:
FastLED/framework-arduino-lpc8xx#35— phantomDMA_Typeon LPC804FastLED/fbuild#916— bumped ArduinoCore-LPC8xx to pull the phantomFastLED/FastLED#3500— widenedspi_arm_lpc_dma.hgate to LPC804FastLED/FastLED#3505— widened AutoResearch harness gate to LPC804What's in the doc
<CHIP>.h,<CHIP>_features.h, drivers dir, feature flag).FSL_FEATURE_SOC_<PERIPH>_COUNTabsent, nofsl_<peripheral>*indevices/<CHIP>/drivers/, base address in reserved range).Acceptance items from #3506
agents/docs/.DMA,async driver,phantom peripheral,peripheral existence,vendor CMSIS,FSL_FEATURE_SOC.agents/docs/register-maps.md.platform-port-agentagent description.framework-arduino-lpc8xx#35) linked.Scope
Docs and agent-config only. No source code, build system, or driver changes. The four-PR cascade revert is intentionally out of scope for this PR — it is tracked separately in the refs on #3506.
Closes #3506.
Test plan
grepconfirms all six discoverability keywords appear inperipheral-existence.md.register-maps.mdheader note + cross-references section;platform-port-agent.mddescription + Step 5 body + Key Rules;platform-port/SKILL.mdLED Output Drivers;CLAUDE.mdtask table.🤖 Generated with Claude Code
Summary by CodeRabbit