You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用OpenOCD通过ST-Link调试APM32F003失败求助

环境与配置

  • 开发环境:CLion
  • 调试器:ST-Link
  • 目标芯片:APM32F003
  • OpenOCD版本:极海(Geehy)定制编译版

当前使用的OpenOCD配置文件内容:

source [find interface/stlink.cfg]

transport select hla_swd

set WORKAREASIZE 0x2000
set CPUTAPID 0x0bc11477
source [find target/apm32f003.cfg]
reset_config srst_only

问题现象

尝试过使用apm32f003.cfg和apm32f0xx.cfg两种目标配置文件,输出信息有差异,但均出现openocd.exe: unknown option -- interpreter=mi2错误。

使用apm32f003.cfg时的输出

openocd-geehy\bin\openocd.exe: unknown option -- interpreter=mi2
    ght differ compared to plain JTAG/SWD
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    
    
    Process finished with exit code 0
    Info : clock speed 100 kHz
    Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
    Info : Target voltage: 3.270417
    Info : [apm32f003.cpu] Cortex-M0+ r0p1 processor detected
    Info : [apm32f003.cpu] target has 4 breakpoints, 2 watchpoints
    Info : starting gdb server for apm32f003.cpu on 3333
    Info : Listening on port 3333 for gdb connections
    [apm32f003.cpu] halted due to breakpoint, current mode: Thread
    xPSR: 0xf1000000 pc: 0xfffffffe msp: 0xfffffffc
    GDB Server stopped, exit code 1

使用apm32f0xx.cfg时的输出

openocd-geehy\bin\openocd.exe -c "tcl_port disabled" -c "gdb_port 3333" -c "telnet_port 4444" -s \openocd-geehy\share\openocd\scripts -f geehy_apm32f00x.cfg -c "program Production.elf" -c "init;reset run;" -c "echo (((READY)))"
Open On-Chip Debugger 0.12.0-rc2+dev-00019-g9d925776b-dirty (2022-11-22-17:13)
Licensed under GNU GPL v2
For bug reports, read
        
Info : The selected transport took over low-level target control. The results mi
ght differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.269266
Info : [apm32f0xx.cpu] Cortex-M0+ r0p1 processor detected
Info : [apm32f0xx.cpu] target has 4 breakpoints, 2 watchpoints
Error: read_memory: read at 0x40015804 with width=32 and count=1 failed
Open On-Chip Debugger 0.12.0-rc2+dev-00019-g9d925776b-dirty (2022-11-22-17:13)
Error executing event examine-end on target apm32f0xx.cpu:
\openocd-geehy\share\openocd\scripts/mem_helper.
tcl:7: Error: read_memory: failed to read memory
in procedure 'program'
in procedure 'apm32f0xx_default_examine_end' called at file "\openocd-geehy\share\openocd\scripts/target/apm32f0xx.cfg", line 92

in procedure 'mmw' called at file "\openocd-geeh
y\share\openocd\scripts/target/apm32f0xx.cfg", line 73
in procedure 'mrw' called at file "\openocd-geeh
y\share\openocd\scripts/mem_helper.tcl", line 32
at file "\openocd-geehy\share\openocd\scripts/me
m_helper.tcl", line 7
Info : starting gdb server for apm32f0xx.cpu on 3333
Info : Listening on port 3333 for gdb connections
Licensed under GNU GPL v2
[apm32f0xx.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0xf1000000 pc: 0xfffffffe msp: 0xfffffffc
Info : Unable to match requested speed 1000 kHz, using 950 kHz

Process finished with exit code 0
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Error: read_memory: read at 0x40015804 with width=32 and count=1 failed
For bug reports, read
Error executing event examine-end on target apm32f0xx.cpu:
\openocd-geehy\share\openocd\scripts/mem_helper.
tcl:7: Error: read_memory: failed to read memory
in procedure 'program'
    
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", li
ne 1193\openocd-geehy\bin\openocd.exe: unknown option -- interpreter=mi2

in procedure 'apm32f0xx_default_examine_end' called at file "openocd-geehy\share\openocd\scripts/target/apm32f0xx.cfg", line 92

in procedure 'mmw' called at file "\openocd-geeh
y\share\openocd\scripts/target/apm32f0xx.cfg", line 73
in procedure 'mrw' called at file "\openocd-geeh
y\share\openocd\scripts/mem_helper.tcl", line 32
at file "openocd-geehy\share\openocd\scripts/me
m_helper.tcl", line 7
GDB Server stopped, exit code 1

待解决问题

  1. 消除openocd.exe: unknown option -- interpreter=mi2错误
  2. 解决apm32f0xx.cfg配置下的内存读取失败问题

内容的提问来源于stack exchange,提问作者ReasonX

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 04:53:11