打印
[资料分享与下载]

K60(Cortex-M4)开源开发探索(六)—— OpenOCD的配置

[复制链接]
1079|18
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
沙发
niuyaliang|  楼主 | 2015-2-28 17:13 | 只看该作者
1、Daemon
         主要是配置openocd对外的通讯所使用的本地TCP/IP端口,如gdb、telnet所使用的端口。 接口Port的定义一般如下(非特殊情况,无需修改,定义了一些端口号)

使用特权

评论回复
板凳
niuyaliang|  楼主 | 2015-2-28 17:13 | 只看该作者

使用特权

评论回复
地板
niuyaliang|  楼主 | 2015-2-28 17:13 | 只看该作者
在用telnet或gdb进行调试时,将会根据定义的端口号连接到服务程序openocd上。     

使用特权

评论回复
5
niuyaliang|  楼主 | 2015-2-28 17:14 | 只看该作者
   2、Interface
          就是openocd所操作的连接开发板的调试器。

使用特权

评论回复
6
niuyaliang|  楼主 | 2015-2-28 17:14 | 只看该作者
[plain] view plaincopy
# type of debug adapter  
interface ft2232   
# Provides the USB device description (the iProduct string) of the FTDI FT2232 device. If not specified, the FTDI default value is used.  
ft2232_device_desc "USB<=>JTAG&RS232"   
# Each vendor’s FT2232 device can use different GPIO signals to control output-enables, reset signals, and LEDs  
ft2232_layout jtagkey   
# The vendor ID and product ID of the FTDI FT2232 device  
ft2232_vid_pid 0x1457 0x5118   

使用特权

评论回复
7
niuyaliang|  楼主 | 2015-2-28 17:14 | 只看该作者
  注: 查看ID的方法:
           lsusb //查看设备的相关简要信息

使用特权

评论回复
8
niuyaliang|  楼主 | 2015-2-28 17:15 | 只看该作者
获取如下:
Bus 006 Device 030: ID 1457:5118 First International Computer, Inc. OpenMoko Neo1973 Debug board (V2+)  

使用特权

评论回复
9
niuyaliang|  楼主 | 2015-2-28 17:15 | 只看该作者
  获取更详细的信息:
sudo lsusb -v -D /dev/bus/usb/006/030  

使用特权

评论回复
10
niuyaliang|  楼主 | 2015-2-28 17:16 | 只看该作者
详细信息如下:
 Device: ID 1457:5118 First International Computer, Inc. OpenMoko Neo1973 Debug board (V2+)  
   Device Descriptor:  
   bLength                18  
   bDescriptorType         1  
   bcdUSB               2.00  
   bDeviceClass            0 (Defined at Interface level)  
   bDeviceSubClass         0   
   bDeviceProtocol         0   
   bMaxPacketSize0         8  
   idVendor           0x1457 First International Computer, Inc.  
   idProduct          0x5118 OpenMoko Neo1973 Debug board (V2+)  
   bcdDevice            5.00  
   iManufacturer           1 www.100ask.net  
   iProduct                2 USB<=>JTAG&RS232  
   iSerial                 0   
   bNumConfigurations      1  
   Configuration Descriptor:  
   bLength                 9  
   bDescriptorType         2  
   wTotalLength           55  
   bNumInterfaces          2  
   bConfigurationValue     1  
   iConfiguration          0   
   bmAttributes         0x80  
   (Bus Powered)  
   MaxPower              100mA  
   Interface Descriptor:  
   bLength                 9  
   bDescriptorType         4  
bInterfaceNumber        0  
   bAlternateSetting       0  
   bNumEndpoints           2  
   bInterfaceClass       255 Vendor Specific Class  
   bInterfaceSubClass    255 Vendor Specific Subclass  
   bInterfaceProtocol    255 Vendor Specific Protocol  
   iInterface              2 USB<=>JTAG&RS232  
   Endpoint Descriptor:  
   bLength                 7  
bDescriptorType         5  
bEndpointAddress     0x81  EP 1 IN  
   bmAttributes            2  
   Transfer Type            Bulk  
   Synch Type               None  
   Usage Type               Data  
wMaxPacketSize     0x0040  1x 64 bytes  
bInterval               0  
   Endpoint Descriptor:  
   bLength                 7  
bDescriptorType         5  
bEndpointAddress     0x02  EP 2 OUT  
bmAttributes            2  
Transfer Type            Bulk  
Synch Type               None  
Usage Type               Data  
wMaxPacketSize     0x0040  1x 64 bytes  
bInterval               0  
   Interface Descriptor:  
bLength                 9  
   bDescriptorType         4  
   bInterfaceNumber        1  
   bAlternateSetting       0  
   bNumEndpoints           2  
   bInterfaceClass       255 Vendor Specific Class  
   bInterfaceSubClass    255 Vendor Specific Subclass  
   bInterfaceProtocol    255 Vendor Specific Protocol  
   iInterface              2 USB<=>JTAG&RS232  
   Endpoint Descriptor:  
   bLength                 7  
   bDescriptorType         5  
   bEndpointAddress     0x83  EP 3 IN  
   bmAttributes            2  
   Transfer Type            Bulk  
   Synch Type               None  
   Usage Type               Data  
   wMaxPacketSize     0x0040  1x 64 bytes  
   bInterval               0  
   Endpoint Descriptor:  
   bLength                 7  
   bDescriptorType         5  
   bEndpointAddress     0x04  EP 4 OUT  
   bmAttributes            2  
   Transfer Type            Bulk  
   Synch Type               None  
   Usage Type               Data  
   wMaxPacketSize     0x0040  1x 64 bytes  
   bInterval               0  
   Device Status:     0x0000  
Bus Powered)  

使用特权

评论回复
11
niuyaliang|  楼主 | 2015-2-28 17:17 | 只看该作者
  3、board
       (1)jtag速率
        对于常见的arm、arm9,jtag配置的最大速率不能高于于cpu时钟的六分之一。如果所用的cpu时钟为60Mhz,因此jtag最大速率可设置为:

使用特权

评论回复
12
niuyaliang|  楼主 | 2015-2-28 17:17 | 只看该作者
如果使用

使用特权

评论回复
13
niuyaliang|  楼主 | 2015-2-28 17:17 | 只看该作者
  即使用自适应时钟,它将会用rclk自己搜索jtag工作频率,速度会很慢。

使用特权

评论回复
14
niuyaliang|  楼主 | 2015-2-28 17:17 | 只看该作者
(2)芯片复位
        这里配置的为jtag和target cpu可用的复位信号。其中复位jtag中的tap控制器的为trst信号,srst信号用于target cpu复位,它是都是可选的。最好的情况是这两个信号都有,这样openocd就可分别控制tap控制器和cpu的复位。

使用特权

评论回复
15
niuyaliang|  楼主 | 2015-2-28 17:18 | 只看该作者
4、Target
        在/usr/local/share/openocd/scripts/target目录下可以找到很多芯片的配置例程,因此参照样本添加配置。

使用特权

评论回复
16
niuyaliang|  楼主 | 2015-2-28 17:19 | 只看该作者
  配置TAP是一个通用的端口,通过TAP可以访问芯片提供的所有数据寄存器(DR)和指令寄存器(IR),配置语法为:

使用特权

评论回复
17
niuyaliang|  楼主 | 2015-2-28 17:19 | 只看该作者
配置cpu 此处设置cpu名称以及大小端排列顺序即可。配置如下:

使用特权

评论回复
18
niuyaliang|  楼主 | 2015-2-28 17:19 | 只看该作者
在使用openocd下载映像到ram时,为了提高速度,在ram中设置一块工作区域,配置如下:
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0  

使用特权

评论回复
19
niuyaliang|  楼主 | 2015-2-28 17:20 | 只看该作者
由于K60是Cortex-M4的内核,相比之前的arm系列有很大的不同,openocd针对cortex系列也有很多的特殊配置,所以上面的配置还只是初级的配置文档,更加详细的配置还要待今后对这一内核进入深入研究之后再添加了。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

212

主题

2427

帖子

7

粉丝