最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]Error: J-Link command 0xde failed (-1)

Embedded crifan 4061浏览 0评论

【问题】

用OpenOCD + Jlink,打算去调试TQ2440的板子,但是,按照这两个帖子:

【转】ubuntu linux下openocd + gdb-insight 用Jlink调试arm程序
【转】最低成本的ARM调试解决方案——有关于Wiggler、H-Jtag、OpenOCD、GDB、Insight

去编译了Insight和OpenOCD后,再弄个openocd.cfg配置文件放到二进制的openocd所在的目录下,然后硬件都连接好后,执行openocd,出现错误:

crifan@ubuntu904:bin$ openocd
Open On-Chip Debugger 0.2.0 (2009-10-23-23:02) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
jtag_speed: 0
jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
Info : J-Link initialization started / target CPU reset initiated
Error: J-Link command 0xde failed (-1)
Error: J-Link command 0xdc failed (-1)
Error: J-Link command 0x01 failed (-1)
Error: J-Link command EMU_CMD_VERSION failed (-1)

Info : J-Link JTAG Interface ready
Error: J-Link command 0xdd failed (-1)
Error: J-Link command 0xdf failed (-1)
Error: J-Link setting speed failed (-1)
Error: usb_bulk_write failed (requested=6, result=-1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: There are no enabled taps?
Error: J-Link command 0xdd failed (-1)
Error: J-Link command 0xde failed (-1)
Error: J-Link command 0xdc failed (-1)
Error: J-Link command 0xde failed (-1)
Error: J-Link command 0xdc failed (-1)
Error: J-Link command 0xdf failed (-1)
Error: usb_bulk_write failed (requested=6, result=-1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: J-Link command 0xdd failed (-1)
Error: J-Link command 0xdf failed (-1)
Error: usb_bulk_write failed (requested=6, result=-1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: There are no enabled taps?
Warn : no gdb ports allocated as no target has been specified

【解决过程】

1。第一个反应,是不是我的硬件连接有问题?Jlink供电不正常?

因为我的是淘宝买的盗版的Jlink,虽然说之前在Windows下试过,但是也不能保证一定就完全好用的。

而且,由于板子上的JTAG口是10pin的小口,所以买的Jlink V7,还带了个小的转接板,支持4种不同的接口,我就想,是不是那个转接口的小板接反了?因为小板上有指示哪个是第一个pin,但是Jlink上没有指示,虽然通过正常的那个接线可以推测出那个是第一个pin,但是也不能完全确定。不过,觉得,好像不应该是这个问题。Jlink的硬件连接,应该是对的。

2。又怀疑是不是Jlink插到Ubuntu 9.04中,Ubuntu没能及时识别阿?所以,去用lsusb试了试。

插入Jlink之前和之后的的输出不同,多了一个,那就应该是Jlink了,是正常识别的了:

crifan@ubuntu904:~$ lsusb

Bus 002 Device 004: ID 064e:a111 Suyin Corp.

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 003: ID 1a86:7523

Bus 006 Device 002: ID 058f:9254 Alcor Micro Corp. Hub

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 002: ID 09da:000a A4 Tech Co., Ltd Port Mouse

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 002: ID 148f:2573 Ralink Technology, Corp. RT2501USB Wireless Adapter

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

crifan@ubuntu904:~$ lsusb

Bus 002 Device 004: ID 064e:a111 Suyin Corp.

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 003: ID 1a86:7523

Bus 006 Device 002: ID 058f:9254 Alcor Micro Corp. Hub

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 007: ID 1366:0101 

Bus 005 Device 002: ID 09da:000a A4 Tech Co., Ltd Port Mouse

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 002: ID 148f:2573 Ralink Technology, Corp. RT2501USB Wireless Adapter

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

3。去网上找到,也有人遇到类似问题的,一个是去Openocd开发版的:

http://lists.berlios.de/pipermail/openocd-development/2009-July/009137.html

结果也没解决。

另一个是:

http://forum.sparkfun.com/viewtopic.php?t=15922

他太牛了,直接去改了Openocd里面的Jlink相关的源码,自己搞定了。。。

偶暂时实在没法去这么弄。。。

4。最后,无意间找到的这个:

http://logs.nslu2-linux.org/livelogs/openjtag/openjtag.20090311.txt

<jerroome> Beeing new to the openocd usage, I’m trying to configure it for a tms470 card

Mar 10 10:08:29 <jerroome> and I don’t really know where it’s hanging

Mar 10 10:09:57 <jerroome> My resets don’t pass during the init

Mar 10 10:10:09 <jerroome> Info : J-Link JTAG Interface ready

Mar 10 10:10:09 <jerroome> Error: J-Link command 0xdd failed (-1)

Mar 10 10:10:09 <jerroome> Error: J-Link command 0xdf failed (-1)

Mar 10 10:10:09 <jerroome> Error: usb_bulk_write failed (requested=6, result=-1)

Mar 10 10:10:12 <jerroome>

Mar 10 10:10:19 <jerroome> does anyone has a hint for it ?

Mar 10 10:11:00 <jerroome> when establishing a telnet connection to openocd, and trying the halt command, I get target not examined yet

Mar 10 12:17:37 <keesj> jerroome: I don’t know about J-Link but this sounds like a problem between J-Link and openoce (access rights?)

Mar 10 12:19:24 <jerroome> hi keesj

Mar 10 12:19:36 <jerroome> I just discoverded that

Mar 10 12:20:10 <jerroome> I searched for so long that I forgot to execute openocd as root

Mar 10 12:20:30 <jerroome> but thank you for your help

看到说是root权限的事情,所以回来自己试了试,由于sudo去执行openocd的时候,由于我只是安装在自己建的/usr/local/arm/openocd下,所以sudo里面还找不到openocd,只能去/usr/loca/下建了个软链接,这样才能用sudo执行openocd,而且还必须去其openocd.cfg所在的路径下,然后才能正常找到配置文件并运行,此时,终于可以看到找到Jlink的正常的信息了:

crifan@ubuntu904:bin$ sudo openocd
[sudo] password for crifan:
Open On-Chip Debugger 0.2.0 (2009-10-23-23:02) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
jtag_speed: 0
jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
Info : J-Link initialization started / target CPU reset initiated
Info : J-Link ARM V7 compiled Jun 30 2009 11:05:27
Info : JLink caps 0xb9ff7bbf
Info : JLink hw version 70000
Info : JLink max mem block 9152
Info : Vref = 3.319 TCK = 1 TDI = 0 TDO = 1 TMS = 0 SRST = 0 TRST = 0

Info : J-Link JTAG Interface ready
Error: jlink_usb_message failed with result=1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: There are no enabled taps?
Error: jlink_usb_message failed with result=1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: jlink_usb_message failed with result=1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: There are no enabled taps?
Warn : no gdb ports allocated as no target has been specified

至于后面的错,那继续再慢慢折腾吧。。。



因此,解决办法就是:

要具有root用户权限去运行openocd才能正常执行。。。

[总结]

此处的openocd是利用libusb去访问USB接口的Jlink的,由于没有权限而导致访问不到Jlink,所以出错。

此问题,和我前段时间遇到的,dnw使用的时候,也是类似,dnw也是利用usblib去实现对于usb的操作,但是由于不是sudo去运行的,所以也就出错,无法正常运行。

到这里,真想说一句,这些不同的软件搭配使用,真是兼容性做得不够好,

至少你错误的时候,要报告权限错误,这样,才能让人知道具体原因,才能去解决阿,否则,直接只是返回-1的错误,我怎么知道错在哪了。。。 估计是必要去看代码,去深入跟踪,也许才可能找到问题在哪。。。

那变成我去调试openocd了,而不是用openocd去调式我的tq2440的板子了。。。汗。。。不过,最后还是要感谢一下google,以及那些贴出问题的人们。。。

转载请注明:在路上 » [已解决]Error: J-Link command 0xde failed (-1)

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

    91 queries in 0.176 seconds, using 22.17MB memory