8051-mcu-debug
Use when debugging 8051-compatible microcontrollers, 51 MCU firmware, STC download issues, Keil C51 projects, interrupts, timers, UART, or startup failures
Use when debugging Cortex-M microcontrollers, firmware bring-up, SWD/JTAG sessions, faults, startup code, or flashing failures
$ npx -y skills add easyzoom/aix-skills --skill cortex-m-debug --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/cortex-m-debugContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when debugging Cortex-M microcontrollers, firmware bring-up, SWD/JTAG sessions, faults, startup code, or flashing failures
name: cortex-m-debug description: Use when debugging Cortex-M microcontrollers, firmware bring-up, SWD/JTAG sessions, faults, startup code, or flashing failures
Use this skill to debug ARM Cortex-M firmware systematically. Start by identifying the exact MCU, board state, debug probe, toolchain, and failure phase, then choose the safest inspection path before changing flash, option bytes, clocks, or startup code.
Use this skill when:
Do not use this skill when:
Ask for the minimum context needed:
1. Classify the failure phase. Use these buckets: probe cannot connect, flash/download fails, reset/startup fails, runtime fault, peripheral bring-up fails, or low-power/wakeup fails.
1. Establish a non-destructive debug connection. Prefer connect-under-reset when firmware may reconfigure SWD pins, enter low power, or crash immediately.
1. Confirm target identity. Read the MCU ID, core type, flash size, RAM size, and debug probe target report before trusting assumptions.
1. Load symbols before changing target state. In GDB, load the ELF symbols first so addresses, functions, and sections are meaningful.
1. Collect baseline evidence. Record reset PC, SP, vector table address, fault registers if applicable, and whether the image in flash matches the expected build.
1. Pick the narrowest next check. Do not jump from "no boot" directly to rewriting startup code. Verify reset vector, memory map, clock assumptions, and fault state first.
1. Ask before destructive actions. Chip erase, option byte changes, mass erase, readout protection changes, boot mode changes, and flash loader changes require explicit user approval.
For SWD/JTAG connection issues, check:
Useful command patterns:
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg arm-none-eabi-gdb build/firmware.elf JLinkGDBServer -device <device> -if SWD -speed 4000 pyocd list pyocd gdbserver --target <target>
After GDB connects, collect evidence before editing code:
target extended-remote :3333 monitor reset halt info registers x/8wx 0x00000000 x/8wx 0x08000000 info files bt
For Cortex-M, pay special attention to:
When the target hits HardFault, BusFault, UsageFault, or MemManage:
1. Stop and preserve the fault state. Do not reset before reading fault registers.
1. Read core fault registers. Common System Control Block addresses:
SCB_CFSR = 0xE000ED28 SCB_HFSR = 0xE000ED2C SCB_DFSR = 0xE000ED30 SCB_MMFAR = 0xE000ED34 SCB_BFAR = 0xE000ED38 SCB_AFSR = 0xE000ED3C SCB_SHCSR = 0xE000ED24
1. In GDB, read them:
x/wx 0xE000ED28 x/wx 0xE000ED2C x/wx 0xE000ED34 x/wx 0xE000ED38 info registers bt
1. Decode the stacked frame. Determine whether MSP or PSP was active, then inspect stacked `r0-r3`, `r12`, `lr`, `pc`, and `xpsr`.
1. Map the faulting PC.
info symbol <pc> list *<pc> disassemble /m <function>
Common causes:
If the target fails before `main()`:
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, UART, or startup failures
Use when integrating, evaluating, configuring, or debugging Avem embedded C framework modules, event-driven components, drivers, middleware, or application…
Use when integrating or debugging Li-ion charger/fuel gauge ICs (BQ24295, BQ27441, MAX17048) over I2C, covering charge start, watchdog host mode, NTC/JEITA…
Use when integrating, designing, or debugging BLE GATT services, characteristics, descriptors, MTU, notifications, indications, pairing, connection parameters,…
Use when debugging embedded bootloaders, application jumps, vector table offsets, firmware upgrade flow, OTA state, image validation, rollback, or boot…
Use when integrating, porting, configuring, or debugging CAN bus libraries, CANBus-Triple, MCP2515, CAN frames, bit timing, filters, or embedded automotive…