svd

A command-line tool that reads CMSIS-SVD files, which describe a chip's peripherals, registers, and bit fields. It can list register addresses and decode the current register values while the device is running.

In plain words
What is it for?
Use it to discover a chip's peripherals, inspect individual registers and bit fields, and read live values through OpenOCD or J-Link.
Why use it?
It avoids searching through long chip reference manuals to find register locations or understand which bits are set.

Command

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.

agentmods
npx agentmods add commands/jzl-maker/ea-skill/svd
Clone the repo
git clone --depth 1 https://github.com/jzl-maker/EA-SKILL
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,848 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.01848
Opus 5 $0.00000 $0.00924
Sonnet 5 $0.00000 $0.00370
Haiku 4.5 $0.00000 $0.00185

Measured 2d ago against content hash 8afb25685d6e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

svd 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 2d ago.

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.

commands/svd.md · 94 lines

How it starts

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

命令: /ea svd (寄存器地图)

功能

解析芯片 SVD 寄存器描述文件(CMSIS-SVD,Keil Pack 自带),把「门牌号(外设基地址)+ 住户名单(寄存器/位域)」查出来,还能免查手册读寄存器当前值并解码位域含义。

能力 说明 数据来源
发现 SVD 从 Keil Pack 目录自动扫描全部芯片 SVD ARM\PACK\*\*\svd\*.svd
外设清单 列出某外设下所有寄存器 + 地址偏移 SVD peripheral/registers
寄存器详情 地址、大小、读写属性、位域(bit 范围/含义/枚举) SVD register/fields/field
位域解码 读当前值后按位域展开:GPIOx_PL_CFG[1:0]=01 SVD enumeratedValues
读当前值 免断点直接读寄存器(OpenOCD TCL mdw,运行中读,不 halt) OpenOCD / J-Link

用途:调试时"这个寄存器现在是什么值 / 某位是不是置位 / 这个外设怎么配置的"——不必翻 1500 页参考手册,/ea svd 直接给出寄存器地图 + 实时值。

调用方式

py ~/.claude/skills/ea-skill/tools/svd/scripts/svd_tool.py --detect
# → 发现 59 个 SVD(N32G4FR、STM32F4x1 等),用 --chip 匹配

# ① 外设下所有寄存器(门牌号)
py .../svd_tool.py --chip N32G4FR --periph GPIOA
# → GPIOA base 0x40010800 + 9 个寄存器(GPIOx_PL_CFG/PID/POD/… 各带偏移)
#   ⚠️ N32 寄存器命名与 STM32 不同(如 GPIO 是 GPIOx_PL_CFG 而非 MODER),以 SVD 输出为准

# ② 单个寄存器详情(住户名单:位域)
py .../svd_tool.py --chip N32G4FR --reg GPIOA GPIOx_PL_CFG
# → 0x40010800,位域 PMODE0[1:0]/PCFG0[3:2]… 各带 mask,可查枚举含义

# ③ 读当前值 + 位域解码(接好 ST-Link/DAP,免断点)
py .../svd_tool.py --chip N32G4FR --read RCC CR --backend openocd
# → RCC.CR = 0x0100XX00,按位域展开 HSEON/HSEONRDY…

# ④ 模糊搜索(记不全名字时)
py .../svd_tool.py --chip N32G4FR --find timer
py .../svd_tool.py --chip N32G4FR --find PID

# AI 解析用 JSON
py .../svd_tool.py --chip N32G4FR --reg RCC CR --json

--chip 省略时自动尝试唯一匹配;多个候选时交互选择。--svd <路径> 可显式指定文件。

参数表

参数 必须 说明
--detect 是(动作) 列出可用 SVD 文件
--periph <外设> 是(动作) 列出外设下所有寄存器
--reg <外设> <寄存器> 是(动作) 寄存器详情(地址/位域/枚举)
--read <外设> <寄存器> 是(动作) 读当前值 + 位域解码
--find <关键词> 是(动作) 模糊搜索外设/寄存器名
--svd <file> 显式指定 SVD 文件
--chip <型号> 按芯片名匹配 SVD(如 N32G4FR)
--backend {jlink,openocd} 读值后端,默认 openocd(无停机)
--ocd-port OpenOCD TCL 端口(默认 6666)
--json 结构化 JSON 输出

工作流程(AI 执行闭环)

1. 找 SVD      --detect 看有哪些芯片;--chip N32G4FR 选中(自动发现 Keil Pack)
2. 查外设      --periph GPIOA → 看有哪些寄存器、基地址
3. 查位域      --reg GPIOA GPIOx_PL_CFG → 哪几位控制什么、枚举值含义
4. 读实时值    --read RCC CR --backend openocd → 免断点读 + 按位域解码
5. 对照排查    把实时值与参考手册/代码意图对照 → 判断配置是否正确、位是否就位

Read the full file on GitHub · 94 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. 2d ago First seen · 94 lines · 0 tokens per session scan A 8afb25685d6e

Subscribe to this mod's changes

svd is a command published in the GitHub repository jzl-maker/EA-SKILL (6 stars, last pushed 5d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,848 tokens. 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.