openocd
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOpenOCD 下载与调试
OpenOCD 下载与调试
本 skill 提供 OpenOCD 的探针探测、固件烧录、Flash 擦除、GDB Server 启动、目标复位、
Telnet 在线调试、GDB 源码级调试和 Semihosting 输出捕获能力。
本 skill 提供 OpenOCD 的探针探测、固件烧录、Flash 擦除、GDB Server 启动、目标复位、
Telnet 在线调试、GDB 源码级调试和 Semihosting 输出捕获能力。
配置
配置
环境级配置(skill/config.json)
环境级配置(skill/config.json)
skill 目录下的 包含环境级配置(工具路径、端口号等),首次使用前确认 路径正确:
config.jsonexejson
{
"exe": "openocd",
"scripts_dir": "",
"gdb_port": 3333,
"telnet_port": 4444,
"gdb_exe": "",
"operation_mode": 1
}- :openocd.exe 路径或命令名(必填)
exe - :OpenOCD 配置脚本目录,为空时使用 OpenOCD 内置路径
scripts_dir - :GDB Server 端口,默认 3333
gdb_port - :Telnet 端口,默认 4444
telnet_port - :arm-none-eabi-gdb 路径,GDB 调试子命令(run/backtrace/locals)需要
gdb_exe - :
operation_mode直接执行 /1输出风险摘要但不阻塞 /2执行前确认3
skill 目录下的 包含环境级配置(工具路径、端口号等),首次使用前确认 路径正确:
config.jsonexejson
{
"exe": "openocd",
"scripts_dir": "",
"gdb_port": 3333,
"telnet_port": 4444,
"gdb_exe": "",
"operation_mode": 1
}- :openocd.exe 路径或命令名(必填)
exe - :OpenOCD 配置脚本目录,为空时使用 OpenOCD 内置路径
scripts_dir - :GDB Server 端口,默认 3333
gdb_port - :Telnet 端口,默认 4444
telnet_port - :arm-none-eabi-gdb 路径,GDB 调试子命令(run/backtrace/locals)需要
gdb_exe - :
operation_mode直接执行 /1输出风险摘要但不阻塞 /2执行前确认3
工程级配置(.embeddedskills/config.json)
工程级配置(.embeddedskills/config.json)
board/interface/target 等工程参数统一在工作区的 中管理:
.embeddedskills/config.jsonjson
{
"openocd": {
"board": "",
"interface": "interface/stlink.cfg",
"target": "target/stm32f4x.cfg",
"adapter_speed": "4000",
"transport": "swd",
"tpiu_name": "stm32f4x.tpiu",
"traceclk": "168000000",
"pin_freq": "2000000"
}
}- :board 配置(如
board),优先级高于 interface+targetboard/stm32f4discovery.cfg - :interface 配置(如
interface)interface/stlink.cfg - :target 配置(如
target)target/stm32f4x.cfg - :调试速率 kHz
adapter_speed - :传输协议(swd/jtag)
transport - /
tpiu_name/traceclk:ITM/SWO 观测所需的 TPIU 参数pin_freq
参数解析优先级:CLI 参数 > 工程配置 > state.json > 默认值
成功执行后,确认过的参数会自动写回工程配置。
board/interface/target 等工程参数统一在工作区的 中管理:
.embeddedskills/config.jsonjson
{
"openocd": {
"board": "",
"interface": "interface/stlink.cfg",
"target": "target/stm32f4x.cfg",
"adapter_speed": "4000",
"transport": "swd",
"tpiu_name": "stm32f4x.tpiu",
"traceclk": "168000000",
"pin_freq": "2000000"
}
}- :board 配置(如
board),优先级高于 interface+targetboard/stm32f4discovery.cfg - :interface 配置(如
interface)interface/stlink.cfg - :target 配置(如
target)target/stm32f4x.cfg - :调试速率 kHz
adapter_speed - :传输协议(swd/jtag)
transport - /
tpiu_name/traceclk:ITM/SWO 观测所需的 TPIU 参数pin_freq
参数解析优先级:CLI 参数 > 工程配置 > state.json > 默认值
成功执行后,确认过的参数会自动写回工程配置。
子命令
子命令
基础操作
基础操作
| 子命令 | 用途 | 风险 |
|---|---|---|
| 验证 board 或 interface+target 组合,探测目标连通性 | 低 |
| 烧录固件(.elf / .hex / .bin) | 高 |
| 擦除目标 Flash | 高 |
| 复位目标芯片 | 高 |
| 查询底层 target / flash / adapter 信息 | 低 |
| 执行受控 OpenOCD 原生命令 | 高 |
| 子命令 | 用途 | 风险 |
|---|---|---|
| 验证 board 或 interface+target 组合,探测目标连通性 | 低 |
| 烧录固件(.elf / .hex / .bin) | 高 |
| 擦除目标 Flash | 高 |
| 复位目标芯片 | 高 |
| 查询底层 target / flash / adapter 信息 | 低 |
| 执行受控 OpenOCD 原生命令 | 高 |
GDB Server
GDB Server
| 子命令 | 用途 | 风险 |
|---|---|---|
| 启动 GDB Server,保持运行等待 GDB 连接 | 低 |
| 快捷获取调用栈和局部变量 | 低 |
| one-shot 执行流控制 | 低 |
| one-shot 源码级诊断 | 低 |
| 子命令 | 用途 | 风险 |
|---|---|---|
| 启动 GDB Server,保持运行等待 GDB 连接 | 低 |
| 快捷获取调用栈和局部变量 | 低 |
| one-shot 执行流控制 | 低 |
| one-shot 源码级诊断 | 低 |
Telnet 在线调试
Telnet 在线调试
| 子命令 | 用途 | 风险 |
|---|---|---|
| 暂停 CPU,返回 PC/xPSR | 低 |
| 恢复 CPU 运行 | 低 |
| 单步执行(支持 | 低 |
| 查看所有 CPU 寄存器 | 低 |
| 读内存( | 低 |
| 写内存( | 高 |
| 设置硬件断点 | 低 |
| 移除断点 | 低 |
| 运行到指定地址(设置断点 + resume + 等待命中) | 低 |
| 子命令 | 用途 | 风险 |
|---|---|---|
| 暂停 CPU,返回 PC/xPSR | 低 |
| 恢复 CPU 运行 | 低 |
| 单步执行(支持 | 低 |
| 查看所有 CPU 寄存器 | 低 |
| 读内存( | 低 |
| 写内存( | 高 |
| 设置硬件断点 | 低 |
| 移除断点 | 低 |
| 运行到指定地址(设置断点 + resume + 等待命中) | 低 |
Semihosting
Semihosting
| 子命令 | 用途 | 风险 |
|---|---|---|
| 启用 ARM Semihosting 并捕获目标 printf 输出 | 低 |
| 基于 TPIU/ITM 读取 SWO/ITM 观测数据 | 低 |
| 子命令 | 用途 | 风险 |
|---|---|---|
| 启用 ARM Semihosting 并捕获目标 printf 输出 | 低 |
| 基于 TPIU/ITM 读取 SWO/ITM 观测数据 | 低 |
执行流程
执行流程
- 读取 ,确认
skill/config.json路径有效exe - 读取 获取工程级配置(board/interface/target 等)
.embeddedskills/config.json - 读取 获取历史状态
.embeddedskills/state.json - 参数解析优先级:CLI 参数 > 工程配置 > state.json > 默认值
- 已知 时优先使用
board,否则组合-f board/*.cfg-f interface/*.cfg -f target/*.cfg - 、
board、interface同时缺失时,不自动拼接组合,直接要求用户补充target - 按 决定是否需要确认后执行
operation_mode - 根据子命令调用对应脚本
- 统一解析输出中的 、
Info和就绪日志,返回结构化结果Error - 成功执行后,将确认过的参数写回
.embeddedskills/config.json
- 读取 ,确认
skill/config.json路径有效exe - 读取 获取工程级配置(board/interface/target 等)
.embeddedskills/config.json - 读取 获取历史状态
.embeddedskills/state.json - 参数解析优先级:CLI 参数 > 工程配置 > state.json > 默认值
- 已知 时优先使用
board,否则组合-f board/*.cfg-f interface/*.cfg -f target/*.cfg - 、
board、interface同时缺失时,不自动拼接组合,直接要求用户补充target - 按 决定是否需要确认后执行
operation_mode - 根据子命令调用对应脚本
- 统一解析输出中的 、
Info和就绪日志,返回结构化结果Error - 成功执行后,将确认过的参数写回
.embeddedskills/config.json
脚本调用
脚本调用
skill 目录下有五个 Python 脚本,使用标准库实现,无额外依赖。
skill 目录下有五个 Python 脚本,使用标准库实现,无额外依赖。
openocd_run.py — 探测 / 烧录 / 擦除 / 复位
openocd_run.py — 探测 / 烧录 / 擦除 / 复位
bash
undefinedbash
undefined探测连通性(使用 board)
探测连通性(使用 board)
python <skill-dir>/scripts/openocd_run.py probe --board board/stm32f4discovery.cfg --json
python <skill-dir>/scripts/openocd_run.py probe --board board/stm32f4discovery.cfg --json
探测连通性(使用 interface + target)
探测连通性(使用 interface + target)
python <skill-dir>/scripts/openocd_run.py probe --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py probe --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
烧录 ELF 固件
烧录 ELF 固件
python <skill-dir>/scripts/openocd_run.py flash --file build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py flash --file build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
烧录 BIN 固件(必须提供地址)
烧录 BIN 固件(必须提供地址)
python <skill-dir>/scripts/openocd_run.py flash --file build/app.bin --address 0x08000000 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py flash --file build/app.bin --address 0x08000000 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
擦除 Flash(自动选择 mass/sector)
擦除 Flash(自动选择 mass/sector)
python <skill-dir>/scripts/openocd_run.py erase --mode auto --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py erase --mode auto --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
复位目标
复位目标
python <skill-dir>/scripts/openocd_run.py reset --mode halt --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py reset --mode halt --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
查询 target 列表
查询 target 列表
python <skill-dir>/scripts/openocd_run.py targets --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py targets --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
查询 flash bank
查询 flash bank
python <skill-dir>/scripts/openocd_run.py flash-banks --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_run.py flash-banks --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
执行受控 raw 命令
执行受控 raw 命令
python <skill-dir>/scripts/openocd_run.py raw --interface interface/stlink.cfg --target target/stm32f4x.cfg --command "init" "targets" --json
通用可选参数:`--board <cfg>`、`--search <目录>`、`--adapter-speed <kHz>`、`--transport <swd|jtag>`、`--exe <openocd路径>`python <skill-dir>/scripts/openocd_run.py raw --interface interface/stlink.cfg --target target/stm32f4x.cfg --command "init" "targets" --json
通用可选参数:`--board <cfg>`、`--search <目录>`、`--adapter-speed <kHz>`、`--transport <swd|jtag>`、`--exe <openocd路径>`openocd_gdb.py — GDB Server 启动与调试
openocd_gdb.py — GDB Server 启动与调试
bash
undefinedbash
undefined启动 GDB Server(保持运行)
启动 GDB Server(保持运行)
python <skill-dir>/scripts/openocd_gdb.py server --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_gdb.py server --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
无子命令时默认 server(向后兼容)
无子命令时默认 server(向后兼容)
python <skill-dir>/scripts/openocd_gdb.py --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_gdb.py --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
执行自定义 GDB 命令序列
执行自定义 GDB 命令序列
python <skill-dir>/scripts/openocd_gdb.py run --gdb-exe arm-none-eabi-gdb --elf build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --commands "break main" "continue" "backtrace" "info locals" --json
python <skill-dir>/scripts/openocd_gdb.py run --gdb-exe arm-none-eabi-gdb --elf build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --commands "break main" "continue" "backtrace" "info locals" --json
快捷获取调用栈
快捷获取调用栈
python <skill-dir>/scripts/openocd_gdb.py backtrace --gdb-exe arm-none-eabi-gdb --elf build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_gdb.py backtrace --gdb-exe arm-none-eabi-gdb --elf build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
快捷查看局部变量
快捷查看局部变量
python <skill-dir>/scripts/openocd_gdb.py locals --gdb-exe arm-none-eabi-gdb --elf build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
可选参数:`--gdb-port`、`--telnet-port`、`--search`、`--adapter-speed`、`--transport`、`--board`python <skill-dir>/scripts/openocd_gdb.py locals --gdb-exe arm-none-eabi-gdb --elf build/app.elf --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
可选参数:`--gdb-port`、`--telnet-port`、`--search`、`--adapter-speed`、`--transport`、`--board`openocd_telnet.py — Telnet 在线调试
openocd_telnet.py — Telnet 在线调试
bash
undefinedbash
undefined暂停 CPU
暂停 CPU
python <skill-dir>/scripts/openocd_telnet.py halt --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py halt --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
恢复运行
恢复运行
python <skill-dir>/scripts/openocd_telnet.py resume --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py resume --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
单步 5 次
单步 5 次
python <skill-dir>/scripts/openocd_telnet.py step --count 5 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py step --count 5 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
查看寄存器
查看寄存器
python <skill-dir>/scripts/openocd_telnet.py reg --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py reg --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
读内存(32bit x 16 个字)
读内存(32bit x 16 个字)
python <skill-dir>/scripts/openocd_telnet.py read-mem --address 0x20000000 --length 16 --width 32 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py read-mem --address 0x20000000 --length 16 --width 32 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
写内存
写内存
python <skill-dir>/scripts/openocd_telnet.py write-mem --address 0x20000000 --value 0xDEADBEEF --width 32 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py write-mem --address 0x20000000 --value 0xDEADBEEF --width 32 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
设置硬件断点
设置硬件断点
python <skill-dir>/scripts/openocd_telnet.py bp --address 0x08001234 --bp-length 2 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py bp --address 0x08001234 --bp-length 2 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
移除断点
移除断点
python <skill-dir>/scripts/openocd_telnet.py rbp --address 0x08001234 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_telnet.py rbp --address 0x08001234 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
运行到指定地址(设置断点 + resume + 等待)
运行到指定地址(设置断点 + resume + 等待)
python <skill-dir>/scripts/openocd_telnet.py run-to --address 0x08001234 --timeout-ms 3000 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
通用可选参数:`--board`、`--search`、`--adapter-speed`、`--transport`、`--gdb-port`、`--telnet-port`python <skill-dir>/scripts/openocd_telnet.py run-to --address 0x08001234 --timeout-ms 3000 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
通用可选参数:`--board`、`--search`、`--adapter-speed`、`--transport`、`--gdb-port`、`--telnet-port`openocd_semihosting.py — Semihosting 输出捕获
openocd_semihosting.py — Semihosting 输出捕获
bash
undefinedbash
undefined捕获 semihosting 输出(持续到 Ctrl+C)
捕获 semihosting 输出(持续到 Ctrl+C)
python <skill-dir>/scripts/openocd_semihosting.py --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_semihosting.py --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
捕获 30 秒
捕获 30 秒
python <skill-dir>/scripts/openocd_semihosting.py --timeout 30 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
undefinedpython <skill-dir>/scripts/openocd_semihosting.py --timeout 30 --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
undefinedopenocd_itm.py — ITM/SWO 观测
openocd_itm.py — ITM/SWO 观测
bash
undefinedbash
undefined使用配置中的 TPIU 参数持续读取 ITM
使用配置中的 TPIU 参数持续读取 ITM
python <skill-dir>/scripts/openocd_itm.py --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
python <skill-dir>/scripts/openocd_itm.py --interface interface/stlink.cfg --target target/stm32f4x.cfg --json
指定 TPIU 名称和端口
指定 TPIU 名称和端口
python <skill-dir>/scripts/openocd_itm.py
--interface interface/stlink.cfg --target target/stm32f4x.cfg
--tpiu-name stm32f4x.tpiu --traceclk 168000000 --pin-freq 2000000
--itm-port 0 --itm-port 1 --json
--interface interface/stlink.cfg --target target/stm32f4x.cfg
--tpiu-name stm32f4x.tpiu --traceclk 168000000 --pin-freq 2000000
--itm-port 0 --itm-port 1 --json
`openocd_itm.py` 会启动独立 OpenOCD Server,打开 TPIU/ITM 配置后,把 trace 输出统一包装成 JSON Lines。python <skill-dir>/scripts/openocd_itm.py
--interface interface/stlink.cfg --target target/stm32f4x.cfg
--tpiu-name stm32f4x.tpiu --traceclk 168000000 --pin-freq 2000000
--itm-port 0 --itm-port 1 --json
--interface interface/stlink.cfg --target target/stm32f4x.cfg
--tpiu-name stm32f4x.tpiu --traceclk 168000000 --pin-freq 2000000
--itm-port 0 --itm-port 1 --json
`openocd_itm.py` 会启动独立 OpenOCD Server,打开 TPIU/ITM 配置后,把 trace 输出统一包装成 JSON Lines。调试典型工作流
调试典型工作流
快速检查(Telnet)
快速检查(Telnet)
halt -> reg -> read-mem 0x20000000 -> step -> resume适合快速查看当前 CPU 状态和内存内容。
halt -> reg -> read-mem 0x20000000 -> step -> resume适合快速查看当前 CPU 状态和内存内容。
断点调试(Telnet)
断点调试(Telnet)
run-to 0x08001234 -> reg -> read-mem -> resume运行到指定地址后暂停,检查寄存器和内存。
run-to 0x08001234 -> reg -> read-mem -> resume运行到指定地址后暂停,检查寄存器和内存。
源码级调试(GDB)
源码级调试(GDB)
bash
gdb run --elf app.elf --commands "break main" "continue" "backtrace" "info locals"使用 ELF 文件提供符号信息,进行函数级断点和变量查看。
bash
gdb run --elf app.elf --commands "break main" "continue" "backtrace" "info locals"使用 ELF 文件提供符号信息,进行函数级断点和变量查看。
Semihosting 输出
Semihosting 输出
bash
semihosting捕获目标通过 (SVC 指令)输出的调试信息,类似 J-Link RTT。
printfbash
semihosting捕获目标通过 (SVC 指令)输出的调试信息,类似 J-Link RTT。
printf输出格式
输出格式
所有脚本以 JSON 格式返回,基础字段为 (ok/error)、、、,并可能附带 、、、、、。流式观测命令使用 JSON Lines,并统一输出 、、。
statusactionsummarydetailscontextartifactsmetricsstatenext_actionstimingsourcechannel_typestream_type成功示例:
json
{
"status": "ok",
"action": "halt",
"summary": "已暂停,PC=0x08000298",
"details": {
"pc": "0x08000298",
"xpsr": "0x01000000",
"msp": "0x20020000",
"halted": true
}
}GDB 调用栈示例:
json
{
"status": "ok",
"action": "backtrace",
"summary": "GDB backtrace 执行成功",
"details": {
"gdb_port": 3333,
"frames": [
{"frame": 0, "function": "main", "location": "src/main.c:42"}
]
}
}错误示例:
json
{
"status": "error",
"action": "halt",
"error": {
"code": "server_failed",
"message": "OpenOCD 启动失败或超时"
}
}所有脚本以 JSON 格式返回,基础字段为 (ok/error)、、、,并可能附带 、、、、、。流式观测命令使用 JSON Lines,并统一输出 、、。
statusactionsummarydetailscontextartifactsmetricsstatenext_actionstimingsourcechannel_typestream_type成功示例:
json
{
"status": "ok",
"action": "halt",
"summary": "已暂停,PC=0x08000298",
"details": {
"pc": "0x08000298",
"xpsr": "0x01000000",
"msp": "0x20020000",
"halted": true
}
}GDB 调用栈示例:
json
{
"status": "ok",
"action": "backtrace",
"summary": "GDB backtrace 执行成功",
"details": {
"gdb_port": 3333,
"frames": [
{"frame": 0, "function": "main", "location": "src/main.c:42"}
]
}
}错误示例:
json
{
"status": "error",
"action": "halt",
"error": {
"code": "server_failed",
"message": "OpenOCD 启动失败或超时"
}
}核心规则
核心规则
- 不自动猜测 、
board、interface的组合,缺失时必须询问用户target - 已知 时优先使用 board 配置,不再需要 interface+target
board - 参数解析优先级为:CLI 显式参数 > (工程级)>
.embeddedskills/config.json(环境级)>skill/config.json> 默认值/报错.embeddedskills/state.json - 文件必须显式提供烧录地址,缺失时报错
.bin - STM32F4 等已映射 target 在 下会先
erase --mode auto,再优先使用 mass erasereset halt - 在未命中映射时直接返回
erase --mode mass,避免误以为已做整片擦除mass_erase_unsupported - 检测到 Flash 锁保护时只提示,不自动解锁
- 连接失败时给出排查建议(检查连线、供电、驱动、cfg 路径),不自动尝试更激进参数
- 烧录、擦除、复位在参数完整且用户意图明确时直接执行
- 启动后返回端口和连接方式,进程保持运行
gdb-server - GDB 调试(run/backtrace/locals)需要配置 (arm-none-eabi-gdb 路径)
gdb_exe - Telnet 调试命令每次启动独立的 OpenOCD Server,执行完自动关闭
- Semihosting 通过 Telnet 启用后持续读取 OpenOCD stderr 输出
- 结果回显中始终包含 cfg 组合、端口和执行动作
- 产物路径(elf/file)不进入工程配置,仍只依赖
state.json - /
last_flash/last_debug等运行状态继续写入last_observestate.json
- 不自动猜测 、
board、interface的组合,缺失时必须询问用户target - 已知 时优先使用 board 配置,不再需要 interface+target
board - 参数解析优先级为:CLI 显式参数 > (工程级)>
.embeddedskills/config.json(环境级)>skill/config.json> 默认值/报错.embeddedskills/state.json - 文件必须显式提供烧录地址,缺失时报错
.bin - STM32F4 等已映射 target 在 下会先
erase --mode auto,再优先使用 mass erasereset halt - 在未命中映射时直接返回
erase --mode mass,避免误以为已做整片擦除mass_erase_unsupported - 检测到 Flash 锁保护时只提示,不自动解锁
- 连接失败时给出排查建议(检查连线、供电、驱动、cfg 路径),不自动尝试更激进参数
- 烧录、擦除、复位在参数完整且用户意图明确时直接执行
- 启动后返回端口和连接方式,进程保持运行
gdb-server - GDB 调试(run/backtrace/locals)需要配置 (arm-none-eabi-gdb 路径)
gdb_exe - Telnet 调试命令每次启动独立的 OpenOCD Server,执行完自动关闭
- Semihosting 通过 Telnet 启用后持续读取 OpenOCD stderr 输出
- 结果回显中始终包含 cfg 组合、端口和执行动作
- 产物路径(elf/file)不进入工程配置,仍只依赖
state.json - /
last_flash/last_debug等运行状态继续写入 state.jsonlast_observe
参考
参考
遇到 board/interface/target 配置问题时可查阅 。
references/common_targets.md遇到 board/interface/target 配置问题时可查阅 。
references/common_targets.md