您的位置:首页 > 运维架构 > Linux

CentOS 下编译安装openocd配合JLINK调试

2012-12-17 01:57 429 查看
CentOS 6.3 X86_64

openocd 0.6.1

jlink v8

官网
http://openocd.sourceforge.net/
这里下载 0.6.1 版
http://sourceforge.net/projects/openocd/files/openocd/0.6.1/
libusb本来已经安装了,但是需要将开发包也安装来,否则提示错误。

$ sudo yum install libusb-devel

$ ./bootstrap

$ ./configure --prefix=/opt/openocd --enable-jlink

$ make

# make install

运行openocd需要指定两个参数,

interface 是仿真器,这里就是 jlink.cfg

target 是指IC型号,这里是 samsung_s3c2440.cfg

这两个文件在 /opt/openocd/share/openocd/scripts/ 目录下到 target 和 interface 目录下面找到。

复制到项目里面。

注意openocd需要在root权限下执行

# /opt/openocd/bin/openocd -f jlink.cfg -f samsung_s3c2440.cfg

结果提示错误

"An adapter speed is not selected in the init script......"

字面意思是没有初始化JTAG speed,问题是在哪里添加?

google查找后(百度是找不到的......)

原来需要在 samsung_s3c2440.cfg 文件添加

adapter_khz 6000

继续运行openocd发现已经可以来,找到来jtag,core到ID都读出来来。

[root@rsstudio rtems]# /opt/openocd/bin/openocd -f jlink.cfg -f samsung_s3c2440.cfg

Open On-Chip Debugger 0.6.1 (2012-12-17-00:47)

Licensed under GNU GPL v2

For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'

trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain

adapter speed: 6000 kHz

Info : J-Link initialization started / target CPU reset initiated

Info : J-Link ARM V8 compiled Dec 6 2011 18:57:44

Info : J-Link caps 0xb9ff7bbf

Info : J-Link hw version 80000

Info : J-Link hw type J-Link

Info : J-Link max mem block 9440

Info : J-Link configuration

Info : USB-Address: 0x0

Info : Kickstart power on JTAG-pin 19: 0xffffffff

Info : Vref = 3.235 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 0 TRST = 0

Info : J-Link JTAG Interface ready

Info : clock speed 6000 kHz

Info : JTAG tap: s3c2440.cpu tap/device found: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)

Info : Embedded ICE version 2

Info : s3c2440.cpu: hardware has 2 breakpoint/watchpoint units

测试,可以用telnet链接,没有到话先安装

$ sudo yum install telnet

# telnet localhost 4444

结果如下

[root@rsstudio etual]# telnet localhost 4444

Trying ::1...

telnet: connect to address ::1: Connection refused

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Open On-Chip Debugger

> halt

target state: halted

target halted in ARM state due to debug-request, current mode: Supervisor

cpsr: 0x200000d3 pc: 0x000000b8

MMU: disabled, D-Cache: disabled, I-Cache: enabled

>

可以尝试一些openocd到命令了。

到此基本可以来。剩下到用 eclipse 配合gdb到使用就没有啥区别了,只是初始化脚本需要修改一下。

Etual

2012-12-16
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: