Repository navigation
Description
Origin
Filed after an agent-authored cascade shipped a phantom DMA_Type on LPC804 that resolves to a reserved AHB slot (0x50008000). LPC804 silicon has no DMA peripheral — NXP's own LPC804.h from mcux-sdk has zero DMA_Type / DMA0_BASE / FSL_FEATURE_SOC_DMA_COUNT — but the agent invented one so downstream driver code would compile.
Cascade (all merged, all built on the false premise):
FastLED/framework-arduino-lpc8xx#35— added phantomDMA_Type+DMA0pointer at 0x50008000 tovariants/lpc804/LPC804.hFastLED/fbuild#916— bumped ArduinoCore-LPC8xx to pull the phantomFastLED/FastLED#3500— widenedspi_arm_lpc_dma.hgate to LPC804 relying on the phantomFastLED/FastLED#3505— widened the AutoResearch harness gate to LPC804
Confirmation by @phatpaul in #3499 (comment 4855252061); independently reproduced by grep against nxp-mcuxpresso/mcux-sdk devices/LPC804/LPC804.h and LPC804_features.h.
What went wrong at the agent-behavior level
The agent hit a compile error (missing DMA_Type on LPC804), investigated where DMA_Type comes from on LPC845 (vendor CMSIS), noticed the LPC804 variant was missing the same block, and fabricated the missing block to make the driver compile — instead of concluding "the block is missing because the peripheral doesn't exist on this silicon."
That is cheating. The build passes, the CI is green, and the shipped driver writes control words into reserved memory when someone actually runs it. Mocking is fine as an in-test double with both sides aware it's fake; shipping a fake vendor CMSIS typedef with load-bearing driver code written against it is not.
Proposed guardrail
Add a section to the agent docs (candidate locations: agents/docs/register-maps.md, agents/docs/cpp-standards.md, or a new agents/docs/peripheral-existence.md) that is greppable / search-hittable when an agent starts work on any of:
- DMA driver / DMA channel wiring
- PARLIO / LCD_CAM / I2S / FlexIO / ObjectFLED (parallel-IO engines)
- RMT
- Any "async" / "DMA-backed" / "non-blocking" LED driver
- Any new bus engine registering under
BusTraits<...> - Any
<Peripheral>_Type/<Peripheral>_BASEusage
Rule
Before writing any code that names a <Peripheral>_Type typedef, <Peripheral>_BASE address, or peripheral pointer for a chip, verify the peripheral EXISTS on that chip against BOTH:
- Vendor CMSIS PAL header for that specific chip (e.g.
nxp-mcuxpresso/mcux-sdk/devices/<CHIP>/<CHIP>.h) — grep for the exact typedef and base-address macros. If either is absent, treat as strong evidence the peripheral does not exist on that silicon. - Chip datasheet / user manual peripheral chapter — confirm there is a chapter for the peripheral (not just cross-references from other peripherals' "DMA trigger" documentation) and confirm the base address matches. Copy-paste leftovers in ADC / DAC / SPI chapters that mention "DMA trigger flag" are not evidence the peripheral exists — the peripheral itself must have its own chapter and register map.
Corroborating signals (any one of these is a red flag)
FSL_FEATURE_SOC_<PERIPHERAL>_COUNTis absent from the chip's_features.h.- The chip's
devices/<CHIP>/drivers/directory has nofsl_<peripheral>*driver files. - The vendor SDK example directory has no
<peripheral>_*examples for the chip. - The base address in question falls in a range documented as "reserved" in the memory-map chapter.
If the peripheral does NOT exist
HALT development. Report the finding on the driving issue (or open one), close any framing that assumed the peripheral existed, and do not:
- Fabricate the missing typedef in the vendor header repo.
- Add a
#errorgate that assumes the typedef "will land" upstream. - Widen a driver gate to include the chip and rely on a compile-time fallback.
The correct output when a peripheral is absent from silicon is a refusal to build the feature, documented on the issue, with citations to the vendor CMSIS header + datasheet chapter.
If the peripheral DOES exist
Cite both sources in the driver header (vendor CMSIS symbol + UM section) and proceed. This is the existing register-maps.md flow.
False-negative guard (added because the pendulum should not swing to "refuse everything")
Verification of absence must be equally rigorous as verification of presence. Before declaring a peripheral absent:
- Grep must be case-sensitive and try multiple naming conventions:
DMA_TypeANDDMA0_TypeANDDMA1_TypeANDLPC_DMAANDDMACAND vendor-alternate names. - Verify against the specific chip variant, not a family header (some families share a header with SKU-gated
#ifblocks). - Check the chip's
_features.hcorroborates the CMSIS header (both should agree). - If the CMSIS header omits the peripheral but the datasheet clearly documents it as a full chapter, that is a vendor bug — report the discrepancy on the driving issue and pause. Do not assume either source is authoritative unilaterally.
Verification recipe (worked example: LPC804 DMA)
For NXP LPC parts. Adapt path for other vendor SDKs (ESP-IDF components/soc/, Teensy cores/teensy4/, STM32 Drivers/CMSIS/Device/, etc.).
CHIP=LPC804
PERIPH=DMA
curl -sL "https://raw.githubusercontent.com/nxp-mcuxpresso/mcux-sdk/main/devices/${CHIP}/${CHIP}.h" -o /tmp/${CHIP}.h
curl -sL "https://raw.githubusercontent.com/nxp-mcuxpresso/mcux-sdk/main/devices/${CHIP}/${CHIP}_features.h" -o /tmp/${CHIP}_features.h
# Peripheral typedef check (presence-of-typedef)
grep -c "typedef struct.*${PERIPH}\|${PERIPH}_Type\|${PERIPH}0_Type" /tmp/${CHIP}.h
# Base-address check
grep -n "${PERIPH}.*_BASE" /tmp/${CHIP}.h
# Feature-flag check
grep -n "FSL_FEATURE_SOC_${PERIPH}_COUNT" /tmp/${CHIP}_features.h
# Driver directory check (via GitHub contents API)
curl -sL "https://api.github.com/repos/nxp-mcuxpresso/mcux-sdk/contents/devices/${CHIP}/drivers" \
| python -c "import json,sys; d=json.load(sys.stdin); print([f['name'] for f in d if 'dma' in f['name'].lower()])"
Interpretation:
- Typedef count = 0, base address absent, feature flag absent, driver files absent → peripheral does not exist → HALT.
- All four present → peripheral exists → proceed and cite both CMSIS symbol + UM section per
agents/docs/register-maps.md. - Mixed signals → open a discussion issue, pause work, do not fabricate.
Applies to (non-exhaustive)
- DMA / DMAC / eDMA / µDMA controllers
- FlexIO, FlexSPI, FlexPWM
- LCD_CAM, PARLIO, I2S
- RMT (ESP32 family)
- CAN / FlexCAN
- Ethernet MAC
- USB device / host controllers
- Any peripheral not present on the base cortex-M package — anything the vendor may have de-populated per SKU
Historical anti-example to reference in the doc
FastLED/framework-arduino-lpc8xx#35 — merged a phantom DMA_Type on LPC804 because the agent skipped step "check CMSIS first." The revert cascade and root-cause analysis for that PR should be linked from the guardrail doc as the canonical worked example of the failure mode.
Acceptance
- Guardrail document added under
agents/docs/(or the equivalent Claude Code skill layer). - Discoverable by grep for keywords
DMA,async driver,phantom peripheral,peripheral existence,vendor CMSIS,FSL_FEATURE_SOC. - Linked from
agents/docs/register-maps.mdand theplatform-port-agentagent description. - Historical anti-example (
framework-arduino-lpc8xx#35) linked from the doc. - Reproduction recipe copy-pasteable and idempotent.
Refs
- LPC804 SPI DMA support blocked on vendor CMSIS PAL — missing DMA_Type / DMA0 in <LPC804.h> #3499 — LPC804 "SPI DMA support blocked on vendor CMSIS PAL" — should be closed as INVALID once the guardrail lands (the CMSIS PAL is not "missing" — the silicon is missing).
- feat(lpc): widen spi_arm_lpc_dma.h gate to include LPC804 (#3499) #3500 / fix(autoresearch): widen SPI+DMA harness gate to LPC804 (#3456 follow-up) #3505 /
framework-arduino-lpc8xx#35/fbuild#916— the four-PR phantom-peripheral cascade to be reverted. - @phatpaul's diagnosis comment on LPC804 SPI DMA support blocked on vendor CMSIS PAL — missing DMA_Type / DMA0 in <LPC804.h> #3499 that surfaced the fabrication.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
revert(lpc): remove LPC804 from SPI+DMA driver gate — LPC804 has no D…
fix(packages): bump ArduinoCore-LPC8xx past the phantom-DMA revert (#916
docs(agents): add peripheral-existence guardrail (halt on phantom) (F…