Can't connect ST-Link with APM32F003 through OpenOCD

33 Views Asked by At

I'm using CLion and try to debug my APM32F003 base project with ST-Link.

I cannot determine what the problem is with ST-Link.

I'm using Geehy's OpenOCD build with APM32F003 config files.

My project cfg code is

source [find interface/stlink.cfg]

transport select hla_swd

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

Also, I have tried apm32f0xx.cfg too, the outputs are different, but both have openocd.exe: unknown option -- interpreter=mi2 error.

The apm32f003.cfg is:

   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

And for 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
        http://openocd.org/doc/doxygen/bugs.html
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'
    http://openocd.org/doc/doxygen/bugs.html
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

There are 1 best solutions below

1
ReasonX On

The problem was at my side (Im was a bit confused by another SO Answer and also set openocd as GDB debuger for IDE. That causes this ungooglable issues.

For now it works fine. Geehy's OpenOCD + ST-Link + APM32F003.