简体   繁体   English

JTAG适配器ULINK-ME和openocd(在ArchLinux上)

[英]JTAG adapter ULINK-ME and openocd (on ArchLinux)

I installed Openocd from opfficial Arch Linux repositories today and am now trying to use it with my JTAG adapter ULINK-ME . 我今天从opfficial Arch Linux存储库安装了Openocd,现在正尝试将它与我的JTAG适配器ULINK-ME一起使用 I found out that ULINK-ME uses CMSIS-DAP debugging firmware. 我发现ULINK-ME使用CMSIS-DAP调试固件。 Openocd has CMSIS-DAP drivers and should therefore be able to communicate with my adapter but after I wrote the command below I got an error. Openocd有CMSIS-DAP驱动程序,因此应该能够与我的适配器通信,但在我写下面的命令后,我收到了一个错误。

I am connecting ULINK-ME to the board EA3141 which integrates microcontroller LPC3141 - a close relative to LPC3131 for whom I load the configuration file. 我正在将ULINK-ME连接到电路板EA3141 ,它集成了微控制器LPC3141 - 与我加载配置文件的LPC3131相近。

sudo openocd -f /usr/local/share/openocd/scripts/interface/cmsis-dap.cfg -f /usr/local/share/openocd/scripts/target/lpc3131.cfg -d3

Open On-Chip Debugger 0.8.0-dev-00175-g8b7acca-dirty (2014-10-14-19:53)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
User : 13 1 command.c:549 command_print(): debug_level: 3
Debug: 14 1 configuration.c:45 add_script_search_dir(): adding /root/.openocd
Debug: 15 1 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/site
Debug: 16 1 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/scripts
Debug: 17 1 configuration.c:86 find_file(): found /usr/local/share/openocd/scripts/interface/cmsis-dap.cfg
Debug: 18 1 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_interface cmsis-dap
Debug: 19 2 command.c:145 script_debug(): command - interface ocd_interface cmsis-dap
Debug: 21 2 command.c:369 register_command_handler(): registering 'ocd_cmsis-dap'...
Debug: 22 2 command.c:369 register_command_handler(): registering 'ocd_cmsis_dap_vid_pid'...
Debug: 23 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 24 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 25 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 26 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 27 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 28 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 29 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 30 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 31 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Info : 32 2 transport.c:118 allow_transports(): only one transport option; autoselect 'cmsis-dap'
Debug: 33 2 adi_v5_cmsis_dap.c:246 cmsis_dap_select(): CMSIS-ADI: cmsis_dap_select
Debug: 34 2 command.c:404 register_command(): command 'cmsis-dap' is already registered in '<global>' context
Debug: 35 2 command.c:369 register_command_handler(): registering 'ocd_cmsis-dap'...
Error: 36 7 cmsis_dap_usb.c:175 cmsis_dap_usb_open(): unable to open CMSIS-DAP device
Error: 37 7 adi_v5_cmsis_dap.c:266 cmsis_dap_select(): unable to init CMSIS-DAP driver
Error: 38 7 transport.c:83 transport_select(): Error selecting 'cmsis-dap' as transport
Debug: 39 7 command.c:631 run_command(): Command failed with error code -4
User : 40 7 command.c:669 command_run_line(): Runtime Error: /usr/local/share/openocd/scripts/interface/cmsis-dap.cfg:7: 
in procedure 'script' 
at file "embedded:startup.tcl", line 58
in procedure 'interface' called at file "/usr/local/share/openocd/scripts/interface/cmsis-dap.cfg", line 7

Does anyone know why I get the errors? 有谁知道我为什么会得到这些错误?


I allso tried to start it in another way but again it prints errors. 我也尝试以另一种方式启动它,但它再次打印错误。 A bit difrently this time. 这次有点不同。

sudo openocd -c "interface cmsis-dap" -f /usr/local/share/openocd/scripts/target/lpc3131.cfg -d3

Open On-Chip Debugger 0.8.0-dev-00175-g8b7acca-dirty (2014-10-14-19:53)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
User : 13 2 command.c:549 command_print(): debug_level: 3
Debug: 14 2 configuration.c:45 add_script_search_dir(): adding /root/.openocd
Debug: 15 2 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/site
Debug: 16 2 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/scripts
Debug: 17 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_interface cmsis-dap
Debug: 18 2 command.c:145 script_debug(): command - interface ocd_interface cmsis-dap
Debug: 20 2 command.c:369 register_command_handler(): registering 'ocd_cmsis-dap'...
Debug: 21 2 command.c:369 register_command_handler(): registering 'ocd_cmsis_dap_vid_pid'...
Debug: 22 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 23 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 24 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 25 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 26 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 27 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 28 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 29 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 30 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Info : 31 2 transport.c:118 allow_transports(): only one transport option; autoselect 'cmsis-dap'
Debug: 32 2 adi_v5_cmsis_dap.c:246 cmsis_dap_select(): CMSIS-ADI: cmsis_dap_select
Debug: 33 2 command.c:404 register_command(): command 'cmsis-dap' is already registered in '<global>' context
Debug: 34 2 command.c:369 register_command_handler(): registering 'ocd_cmsis-dap'...
Error: 35 7 cmsis_dap_usb.c:175 cmsis_dap_usb_open(): unable to open CMSIS-DAP device
Error: 36 7 adi_v5_cmsis_dap.c:266 cmsis_dap_select(): unable to init CMSIS-DAP driver
Error: 37 7 transport.c:83 transport_select(): Error selecting 'cmsis-dap' as transport
Debug: 38 7 command.c:631 run_command(): Command failed with error code -4
User : 39 7 command.c:669 command_run_line(): in procedure 'interface'

UPDATE: 更新:

Output of the `sudo lsusb -v command for ULINK-ME is: ULINK-ME的`sudo lsusb -v命令的输出是:

Bus 005 Device 018: ID c251:2721 Keil Software, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0xc251 Keil Software, Inc.
  idProduct          0x2721
  bcdDevice            1.00
  iManufacturer           4 Keil Software
  iProduct               32 Keil ULINK-ME
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      25
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

Because there is no string "CMSIS-DAP" in it I guess it means that I have an older ULINK-ME (bought before 2013) adapter which didn't have CMSIS-DAP firmware. 因为其中没有字符串“CMSIS-DAP”,我想这意味着我有一个较旧的ULINK-ME(2013年之前购买)适配器,它没有CMSIS-DAP固件。 I hope Keil offers some way of flashing CMSIS-DAP to my older ULINK-ME. 我希望Keil能为我的旧版ULINK-ME提供一些闪存CMSIS-DAP的方法。


SOLUTION: 解:

I wrote to Keil and they claimed that ULINK-ME's firmware can be updated and it is true. 我写信给Keil,他们声称ULINK-ME的固件可以更新,这是真的。 They pointed me to these three links: 他们向我指出了这三个环节:

1. - check serial number 1. - 检查序列号

2. - upgrade if Keil uVision hasn't done this by itself in point 1. 2. - 升级如果Keil uVision在第1点没有自己做到这一点。

3. - manipulate your ULINK-ME even further 3. - 进一步操纵你的ULINK-ME

I had to install MDK-ARM v5 on a Windows machine and then click on a very hidden icon (a magic wand) on a toolbar. 我必须在Windows机器上安装MDK-ARM v5,然后在工具栏上单击一个非常隐藏的图标(魔术棒)。 There under debugging I chose the ULINK2/ME option and it updated my firmware by itself. 在调试中我选择了ULINK2 / ME选项,它自己更新了我的固件。 Now I have a CMSIS-DAP on my ULINK-ME (older model) and I can confirm this with sudo lsusb -v : 现在我在我的ULINK-ME(旧型号)上有一个CMSIS-DAP,我可以用sudo lsusb -v确认这个:

Bus 005 Device 026: ID c251:2723 Keil Software, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0xc251 Keil Software, Inc.
  idProduct          0x2723 
  bcdDevice            1.00
  iManufacturer           1 Keil Software
  iProduct                2 Keil ULINK-ME CMSIS-DAP
  iSerial                 3 M0489MAE
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              4 CMSIS-DAP
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      33
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

I tried to do this using Wine, but it wasn't possible. 我尝试用Wine做到这一点,但这是不可能的。 At least now I don't need Windows any more. 至少现在我不再需要Windows了。

0.8.0-dev-00175-g8b7acca-dirty This does not look like an official OpenOCD. 0.8.0-dev-00175-g8b7acca-dirty这看起来不像官方的OpenOCD。 Where did you get it ? 你在哪里得到它 ?

Note: Your version should say 0.9.0 and definitely not 'dirty' . 注意:您的版本应该说0.9.0并且绝对不是'dirty'

Your version of OpenOCD might have problems with CMSIS-DAP. 您的OpenOCD版本可能与CMSIS-DAP有问题。 I highly recommend you to clone the current HEAD from here: 我强烈建议你从这里克隆当前的HEAD:

git clone git://git.code.sf.net/p/openocd/code openocd

(remember to do ./bootstrap , before you ./configure ... after cloning) (记得做./bootstrap ,在你./configure ...克隆之后)

-Or download from Freddie Chopin's site if you're running it under Windows. - 如果您在Windows下运行它,请从Freddie Chopin的网站下载。

sudo openocd Something is wrong here too. sudo openocd这里也有问题。 You should not have to 'sudo' each time you want to use OpenOCD. 每次要使用OpenOCD时都不应该“sudo”。

Anyway, you should be able to use JTAG (LPC3141 seems to be too old to support SWD). 无论如何,你应该能够使用JTAG(LPC3141似乎太旧了,无法支持SWD)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM