我在工作中习惯使用 Segger,但我不想花那种钱在家使用,所以这是我第一次使用 OpenOCD 进行调试。我有 Olimex ARM-USB-TINY-H。
我的操作系统是 Ubuntu。我正在使用带有 OpenOCD 插件的 MCUXpresso (Eclipse)。我在 gdb 连接到 OpenOCD 时遇到问题。任何指针都会非常有帮助。
我已将配置选项设置为
-s /usr/local/share/openocd/scripts/ -f /usr/local/share/openocd/scripts/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /home/username/Documents/Code/kl27z-ARM_USB_TINY.cfg
控制台输出:
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
none separate
Info : add flash_bank kinetis kl27.flash
adapter speed: 1000 kHz
none separate
cortex_m reset_config sysresetreq
Started by GNU MCU Eclipse
Info : clock speed 1000 kHz
in procedure 'init'
in procedure 'ocd_bouncer'
Eclipse 弹出这个错误:
Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: Connection timed out.
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: Connection timed out.
localhost:3333: Connection
这是 .cfg 文件
# inteface: olimex arm usb tiny h
# transport: swd
# adapter/interface
#interface ftdi
#source [find interface/ftdi/olimex-arm-usb-tiny-h.cfg]
transport select swd
# increase working area to 16KB
# set WORKAREASIZE 0x4000
set CHIPNAME kl27
#reset_config srst_only srst_nogate connect_assert_srst
reset_config none separate
source [find target/klx.cfg]
ftdi_layout_signal SWD_EN -data 0
$CHIPNAME.cpu configure -event examine-end {
kinetis mdm check_security
}
#gdb_memory_map disable
$_TARGETNAME configure -event gdb-attach {
echo "Halting Target"
reset init
}
更新,运行 --debug 0 控制台的最后一部分是
Debug: 272 20 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 273 20 ftdi.c:1223 ftdi_swd_switch_seq(): JTAG-to-SWD
Debug: 274 20 ftdi.c:1077 ftdi_swd_run_queue(): Executing 2 queued transactions
Debug: 275 20 ftdi.c:1109 ftdi_swd_run_queue(): JUNK DP read reg 0 = 00000000
Debug: 276 20 command.c:626 run_command(): Command failed with error code -4
User : 277 21 command.c:687 command_run_line(): in procedure 'init'
in procedure 'ocd_bouncer'
Debug: 278 21 command.c:626 run_command(): Command failed with error code -4
User : 279 21 command.c:687 command_run_line():