openocd-mcu-debug

openocd-mcu-debug is a skill for Codex from royforlinux/openocd-mcu-mcp. It costs 81 tokens per session (1,378 once invoked), scanned A, original, MIT.

An embedded-hardware debugging guide for microcontrollers, using OpenOCD to connect to chips and CMSIS-SVD files to explain their registers. It covers Cortex-M and RISC-V targets.

In plain words
What is it for?
Connecting to an MCU, identifying the chip, reading or writing registers and memory, decoding register fields, and diagnosing HardFaults or other failures.
Why use it?
It gives developers a defined way to inspect a connected chip and investigate crashes, hangs, memory problems, clocks, and peripherals.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Connecting to an MCU, identifying the chip, reading or writing registers and…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/royforlinux/openocd-mcu-mcp/openocd-mcu-debug
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add royforlinux/openocd-mcu-mcp --skill openocd-mcu-debug
Clone the repo
git clone --depth 1 https://github.com/royforlinux/openocd-mcu-mcp

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for openocd-mcu-debug

README.md
[![agentmods](https://agentmods.dev/badge/skills/royforlinux/openocd-mcu-mcp/openocd-mcu-debug.svg)](https://agentmods.dev/skills/royforlinux/openocd-mcu-mcp/openocd-mcu-debug)
Your own site
<a href="https://agentmods.dev/skills/royforlinux/openocd-mcu-mcp/openocd-mcu-debug"><img src="https://agentmods.dev/badge/skills/royforlinux/openocd-mcu-mcp/openocd-mcu-debug.svg" alt="Measured on agentmods" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,378 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00081 $0.01378
Opus 5 $0.00041 $0.00689
Sonnet 5 $0.00016 $0.00276
Haiku 4.5 $0.00008 $0.00138

Measured 6d ago against content hash 135e5275110e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

openocd-mcu-debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 7 executable files (scripts/decode_register.py, scripts/elf_lookup.py, scripts/fetch_svd.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

openocd-mcu-debug/SKILL.md · 114 lines

How it starts

The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenOCD MCU Debug - 芯片探测与寄存器解读

连接目标 MCU 后,通过 OpenOCD 读取 CPU/芯片 ID,加载本地 SVD 文件,解读外设寄存器,并辅助 HardFault、挂死、外设、时钟、内存和 ELF 源码级调试。

前置要求

硬件操作依赖一个正在运行的 OpenOCD 会话。若当前环境已安装 openocd-mcu MCP,优先调用 MCP 工具;否则使用 scripts/openocd_client.py 连接默认 telnet 端口 4444

python .\scripts\openocd_client.py connect

如果 OpenOCD 尚未启动,先读 openocd-debugging-workflow.md

OpenOCD MCP

本技能带一个无第三方依赖的 stdio MCP server:

python .\tools\openocd-mcu-mcp\server.py

工具名:

  • connect
  • halt
  • resume
  • reset_halt
  • register_read
  • registers
  • memory_read
  • memory_write
  • raw_command
  • probe_chip
  • find_svd
  • decode_register

按用户要求,MCP 工具会真实执行 resumereset_haltmemory_write 等操作,不再做二次确认拦截。脚本 CLI 仍保留确认参数,适合作为手工保护层。

核心流程

OpenOCD MCP connect 或 openocd_client.py connect/start
    ↓
halt
    ↓
probe_chip.py 读取 CPUID/DBGMCU/FICR/CSR
    ↓
find_svd.py 或 fetch_svd.py 找到 SVD
    ↓
openocd_client.py mdw 读取寄存器
    ↓
decode_register.py 按 SVD 位域解码

工作流路由

场景 参考流程 可执行工具
启动/连接 OpenOCD openocd-debugging-workflow.md scripts/openocd_client.py
连接后识别芯片 chip-probing-workflow.md scripts/probe_chip.py
查看/解读寄存器 register-decoding.md scripts/find_svd.py, scripts/decode_register.py
芯片ID速查 chip-id-reference.md 人工核对表
ELF符号/源码调试 elf-debugging-workflow.md scripts/elf_lookup.py

芯片探测与寄存器

现象 诊断流程 核心策略
HardFault/崩溃/异常 hardfault-diagnosis.md 读CFSR+栈回溯+Fault地址
程序挂死/跑飞/不响应 hang-diagnosis.md 多次PC采样+死循环定位
外设不工作 peripheral-diagnosis.md 时钟→GPIO→外设寄存器逐层排查
时钟/波特率异常 clock-diagnosis.md RCC时钟树分析+频率计算
栈溢出/内存踩踏 memory-diagnosis.md SP检查+栈canary+内存填充对比

Read the full file on GitHub · 114 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 114 lines · 81 tokens per session scan A 135e5275110e

Subscribe to this mod's changes

openocd-mcu-debug is a skill published in the GitHub repository royforlinux/openocd-mcu-mcp (5 stars, last pushed 3mo ago), licensed MIT. It adds 81 tokens to every session and 1,378 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

embedded-debugger

Embedded hardware debugging workflow for probe-rs targets using embedded-debugger-mcp. Use when Codex or Claude Code needs to inspect debug probes, validate embedded debugger setup, start the MCP server, guide a user through ARM Cortex-M/RISC-V flashing/debugging/RTT workflows, or operate without installing an MCP…

Adancurusul/embedded-debugger-mcp · 75 tokens

embedded-debugging

Debug embedded firmware on real hardware through the jlink-mcp server — crashes, hangs, peripheral misconfiguration, silent devices. Covers loading ELF symbols for source-level backtraces, supplying an SVD for named peripheral fields, and the halt/read/resume discipline. Use whenever debugging a microcontroller over a…

Klievan/jlink-mcp · 77 tokens

kicad-review

Design review and validation workflow for KiCAD projects via MCP tools. Triggers on: "review my design", "check for errors", "audit", "DRC", "ERC", "find problems", "design review", "is this ready", "validate", "check my schematic", "check my PCB", "what's wrong", "run checks", "pre-fab review".

mixelpixx/Konnect · 83 tokens

8051-mcu-debug

Use when debugging 8051-compatible microcontrollers, 51 MCU firmware, STC download issues, Keil C51 projects, interrupts, timers, UART, or startup failures.

easyzoom/aix-skills · 41 tokens

cortex-m-debug

Use when debugging Cortex-M microcontrollers, firmware bring-up, SWD/JTAG sessions, faults, startup code, or flashing failures.

easyzoom/aix-skills · 31 tokens

cortex-r5-debug

Use when debugging Cortex-R5 or Cortex-R firmware — TCM, MPU, caches, DFSR/DFAR aborts, exceptions, GIC/VIC interrupts, lockstep or split mode, ECC, or JTAG bring-up.

easyzoom/aix-skills · 53 tokens