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

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到使用就没有啥区别了,只是初始化脚本需要修改一下。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值