bakesheep/emberprobe-mcu-flash-debug/mcu-fault-analyzer
Claude Code and agent skill by bakesheep/emberprobe-mcu-flash-debug
- community
Checking that the SKILL.md file is still in the repository.
Read and decode Cortex-M fault status registers (CFSR/HFSR/DFSR/MMFAR/BFAR) through EmberProbe and symbolize PC/LR against the ELF. Use when the user reports a crashed, frozen, or HardFault-ed MCU, asks why the firmware stopped responding, or wants a fault/exception diagnosis of the attached target.
Install
npx vskill@latest install bakesheep/emberprobe-mcu-flash-debug/mcu-fault-analyzerSKILL.md
MCU Fault Analyzer
Use scripts/analyze-fault.js from this skill directory.
Before you run
- MCP first: if this session provides EmberProbe MCP tools (such as
fault_read), use them; the scripts here are the fallback. The authorization and hardware rules on this page apply to both. - Applies to: reading and decoding Cortex-M fault status registers (CFSR/HFSR/DFSR/MMFAR/BFAR) and symbolizing PC/LR against the ELF for a crashed, frozen, or HardFault-ed target.
- Requires: the EmberProbe Agent Bridge, OpenOCD, a connected probe, and a powered target.
- Preconditions: the probe is free — otherwise
PROBE_BUSYis returned; wait or let the user stop the current owner. - Side effects: reads the SCB fault registers non-intrusively, briefly halts the core to capture PC/SP/LR/xPSR and the interrupt masks, and, when it was running, halts it four more times about 10 ms apart to sample PC; it then restores the original run state.
- Success evidence:
faultDetectedplus decoded faults and symbolized PC/LR. No fault flags means none is pending — not that the program runs correctly.
For failure handling, retry limits, cross-skill routing, and result scoping, read ../_emberprobe/agent-workflow.md.
EmberProbe reads the SCB fault registers non-intrusively (they are readable while the core runs), briefly halts the core only to capture PC/SP/LR/xPSR and PRIMASK/BASEPRI/FAULTMASK, samples PC a few more times when the core was running, then restores the original run state. The probe must be free (not downloading, sampling, or debugging), otherwise PROBE_BUSY is returned.
Interpreting the result
The JSON on stdout contains faultDetected, faults (decoded flag list), exception (active exception from ICSR), raw registers, and pc/lr with pcSymbol/lrSymbol (function+0xOFFSET resolved from the ELF).
- If
faultDetectedis true, lead with a one-line conclusion combining the strongest evidence, e.g. "Precise bus error at 0x60000000 (faultAddress), executinguart_send+0x12(pcSymbol)". Then list the decoded flags with their descriptions. HFSR.FORCEDmeans a lower-priority fault escalated to HardFault — the root cause is in the CFSR flags, not the HardFault itself.CFSR.IMPRECISERRmeans PC has already moved past the faulting store; say the reported PC is only approximate.exception.nametells which handler the core is currently in (e.g.HardFault);Threadwith no fault flags means no fault exception is active — not that the application logic or hardware peripherals are functioning normally.executiondescribes the halted core:mode(threadorhandler),exceptionfrom IPSR withhandler(the vector table entry named from the ELF, such asUART7_IRQHandler;namebecomesUART7_IRQnfor such handlers) andmasks(primask,basepri,faultmaskwhere the core has them).stallappears only when the target was running:sampleslists the first PC and the sampled PCs with symbols.verdictistightLoop(all within 64 bytes: a busy-wait or endless loop),sameFunction(still inside one function),progressing(different functions), orunknown(not enough symbols to tell).- If
faultDetectedis false, lead withexecutionandstall: for example "No fault; the core is stuck inUART7_IRQn(UART7_IRQHandler), looping inHAL_DMA_Abort+0x1C". AhandlerofDefault_Handlermeans an enabled interrupt has no handler. While in a handler, lower-priority interrupts and the RTOS tick cannot run; a nonzerobasepriorprimaskin thread mode also blocks them. - If
faultDetectedis false andstall.verdictisprogressing, state that no fault is pending and the core is executing — the problem is elsewhere (e.g. waiting on a state; suggest mcu-variables to inspect variables). - For a full call stack and locals at the stuck point, use mcu-debug-control
--start --attach, which halts the running firmware without reset. - After regenerating initialization code, the project must be rebuilt; after rebuilding, do not assume the target is running the new firmware until programmed.
- If
symbolicationisunavailableor symbols are empty, the ELF is missing or stripped; report raw addresses and suggest a Debug build.
Failure diagnostics
On failure, parse the JSON diagnostic on stderr and act on error.code (PROBE_BUSY, TARGET_NOT_CONNECTED, TARGET_UNPOWERED, CONFIG_INCOMPLETE, OPENOCD_NOT_READY).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mcu-fault-analyzer/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bakesheep/emberprobe-mcu-flash-debug/mcu-fault-analyzer)