OpenOCD无法执行MI命令:-target-select远程localhost:3333

时间:2019-03-28 03:51:18

标签: arm cortex-m openocd swd

我曾经在工作中使用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(): 

1 个答案:

答案 0 :(得分:0)

我知道了,它主要是ftdi驱动程序,但也有一些配置。我概述了我在博客上所做的事情。 https://mitchjonesengineering.us/?p=18