mcu-fault-analyzer

Decode Cortex-M fault registers and symbolize PC/LR against the ELF.

5|1|Updated Jul 12, 2026
One-click install
npx skills add https://github.com/BakeSheep/EmberProbe-MCU-Flash-Debug --skill mcu-fault-analyzer-bakesheep
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mcu-fault-analyzer
Source: https://github.com/BakeSheep/EmberProbe-MCU-Flash-Debug/tree/main/skills/mcu-fault-analyzer
Command: npx skills add https://github.com/BakeSheep/EmberProbe-MCU-Flash-Debug --skill mcu-fault-analyzer-bakesheep

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? When a Cortex-M microcontroller crashes, freezes, or enters a HardFault, developers need to know which fault occurred and where in the code it happened. This Skill reads and decodes the SCB fault status registers (CFSR/HFSR/DFSR/MMFAR/BFAR) through EmberProbe and symbolizes PC/LR against the current ELF, turning raw register dumps into an actionable diagnosis. ## Core Features & Use Cases - Fault Register Decoding: Reads CFSR, HFSR, DFSR, MMFAR, and BFAR non-intrusively and decodes each flag into a human-readable fault list. - Crash Location Symbolization: Briefly halts the core to capture PC/SP/LR/xPSR, resolves PC/LR to function+0xOFFSET symbols from the ELF, then restores the original run state. - Exception Context: Reports the active exception from ICSR (e.g. HardFault) and explains escalations such as HFSR.FORCED and imprecise bus errors. - Use Case: Your firmware stops responding in the field test. Run the analyzer to learn that a precise bus error occurred at address 0x60000000 while executing uart_send+0x12, then jump straight to the offending code. ## Quick Start Ask the agent to read the fault registers and explain why the attached MCU crashed, including the decoded flags and symbolized PC/LR.

Frequently Asked Questions about mcu-fault-analyzer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose a HardFault on a Cortex-M microcontroller?▼

Run the fault analyzer script with the workspace path; it reads the SCB fault registers (CFSR/HFSR/MMFAR/BFAR) through OpenOCD, decodes each flag, and symbolizes PC/LR against your ELF. The JSON output identifies the fault type and the crashing function.

How to find which function caused an MCU crash?▼

The analyzer briefly halts the core to capture PC and LR, then resolves them to `function+0xOFFSET` symbols using the current ELF file. If symbols are unavailable, the ELF is missing or stripped, so use a Debug build.

Does reading fault registers stop the running target?▼

The SCB fault registers are read non-intrusively while the core runs. The core is halted only briefly to capture PC/SP/LR/xPSR, then the original run state is restored automatically.

Why does the fault analyzer return PROBE_BUSY?▼

PROBE_BUSY means the debug probe is occupied by another operation such as firmware download, variable sampling, or an active debug session. Wait for it to finish or stop the current owner, then retry the analysis.

What does HFSR.FORCED mean in a HardFault diagnosis?▼

HFSR.FORCED indicates a lower-priority fault escalated to HardFault because its handler was not enabled. The actual root cause is in the CFSR flags, not the HardFault itself, so inspect the decoded CFSR bits.