8051-mcu-debug
Use when debugging 8051-compatible microcontrollers, 51 MCU firmware, STC download issues, Keil C51 projects, interrupts, timers,…
Use when embedded firmware crashes, traps, faults, resets unexpectedly, jumps to default handlers, corrupts stack, or executes invalid instructions
Claude Code
$ npx -y skills add easyzoom/aix-skills --skill embedded-fault-debug --agent claude-code
Codex
$ npx skills add easyzoom/aix-skills --skill embedded-fault-debug -a codex -y
Cursor
$ npx skills add easyzoom/aix-skills --skill embedded-fault-debug -a cursor -y
Gemini CLI
$ npx skills add easyzoom/aix-skills --skill embedded-fault-debug -a gemini-cli -y
GitHub Copilot
$ npx skills add easyzoom/aix-skills --skill embedded-fault-debug -a github-copilot -y
OpenCode
$ npx skills add easyzoom/aix-skills --skill embedded-fault-debug -a opencode -y
Windsurf
$ npx skills add easyzoom/aix-skills --skill embedded-fault-debug -a windsurf -y
name: embedded-fault-debug description: Use when embedded firmware crashes, traps, faults, resets unexpectedly, jumps to default handlers, corrupts stack, or executes invalid instructions
Use this skill to preserve crash evidence and find the first failing instruction. The agent should read architecture-specific fault state before reset, map addresses to symbols, and separate root cause from secondary symptoms.
Use this skill when:
Do not use this skill when the target cannot yet connect or flash; use `mcu-flashing-debug` first.
Ask for:
1. Preserve state. Do not reset or reflash until fault registers, PC, LR/RA, SP, and stack frame are captured.
1. Confirm image-symbol match. Ensure the ELF/MAP file matches the firmware currently running on target.
1. Identify the faulting address. Map PC, exception return address, `mepc`, stacked PC, or return address to a symbol and source line.
1. Classify the cause. Separate invalid memory access, illegal instruction, stack overflow, alignment, bus/peripheral access, watchdog, assert, and default handler cases.
1. Walk backward to the first bad state. Inspect caller, input pointers, stack bounds, interrupt context, DMA/cache interactions, and recent initialization.
1. Add a focused verification. Use a watchpoint, assertion, guard pattern, stack watermark, or minimal repro to prove the suspected cause.
Read SCB fault registers before reset:
CFSR = 0xE000ED28 HFSR = 0xE000ED2C MMFAR = 0xE000ED34 BFAR = 0xE000ED38
Decode stacked `r0-r3`, `r12`, `lr`, `pc`, and `xpsr` from MSP or PSP.
Read:
mcause, mepc, mtval, mtvec, mstatus, sp
Check whether `mcause` is interrupt or exception, and map `mepc` to source/disassembly.
Use available evidence:
Before claiming a fault is understood:
User:
程序跑一会儿就进 HardFault。
Agent:
1. Asks for chip, ELF, register dump, CFSR/HFSR, stacked PC, and whether reset happened. 1. Maps stacked PC to source. 1. Checks stack bounds, caller, interrupt context, and invalid memory access evidence. 1. Suggests a focused watchpoint or stack watermark before changing code.
AIX Skills is a public collection of Agent Skills, templates, and references for building repeatable AI workflows.
Use when debugging 8051-compatible microcontrollers, 51 MCU firmware, STC download issues, Keil C51 projects, interrupts, timers,…
Use when integrating, evaluating, configuring, or debugging Avem embedded C framework modules, event-driven components, drivers,…
Use when integrating or debugging Li-ion charger/fuel gauge ICs (BQ24295, BQ27441, MAX17048) over I2C, covering charge start,…
Use when integrating, designing, or debugging BLE GATT services, characteristics, descriptors, MTU, notifications, indications,…
Use when debugging embedded bootloaders, application jumps, vector table offsets, firmware upgrade flow, OTA state, image…
Use when integrating, porting, configuring, or debugging CAN bus libraries, CANBus-Triple, MCP2515, CAN frames, bit timing,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.