本文转载自:http://www.linuxdiyf.com/linux/24086.html

Ubuntu 16.04下EasyOpenJTAG+OpenOCD的安装和使用

发布时间:2016-09-12 09:09:31来源:linux网站作者:heyuqian_csdn
操作系统:VMware fusion + Ubuntu 16.04.1 LTS
开发板:JZ2440 V3 + EasyOpenJTAG
 
设备连接:
 
要烧写裸机程序离不开OpenJTAG,OpenJTAG包含了3大功能,USB 转串口、USB 转 JTAG、 在线调试。
借助OpenOCD等开源软件可以完成程序的下载、烧写、调试等任务:
首先安装libftdi和ftdi-eeprom 下载地址http://www.intra2net.com/en/developer/libftdi/download.php:
 
1、下载confuse-2.5.tar.gz  libftdi1-1.3.tar.bz2并解压:
root@ubuntu:/work/tmp# ls /mnt/hgfs/jz2440/download/  
confuse-2.5.tar.gz  libftdi1-1.3.tar.bz2 
root@ubuntu:/work/tmp# tar -jxvf /mnt/hgfs/jz2440/download/libftdi1-1.3.tar.bz2 -C ./  
root@ubuntu:/work/tmp# tar -zxvf /mnt/hgfs/jz2440/download/confuse-2.5.tar.gz -C ./  
 
2、安装libftdi,参考源码目录下的README.build:
root@ubuntu:/work/tmp/libftdi1-1.3# mkdir build; cd build:  
root@ubuntu:/work/tmp/libftdi1-1.3# cmake  -DCMAKE_INSTALL_PREFIX="/usr" ../; make; sudo make install  
 
3、安装ftdi-eeprom,参考源码目录下的INSTALL
root@ubuntu:/work/tmp# cd confuse-2.5/; ./configure; make; make install
 
然后安装OpenOCD
1]、下载OpenOCD
root@ubuntu:/work/tmp# git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd 
 
2]、编译并安装, 请参考源码目录下的README.build
root@ubuntu:/work/tmp/openocd# ./bootstrap  
root@ubuntu:/work/tmp/openocd# ./configure --enable-ftdi  
root@ubuntu:/work/tmp/openocd# make; make install  
编译后的版本为:
root@ubuntu:/work/tmp/openocd# openocd -v  
Open On-Chip Debugger 0.10.0-dev-00371-g81631e4 (2016-09-11-18:21)  
Licensed under GNU GPL v2  
For bug reports, read  
http://openocd.org/doc/doxygen/bugs.html  
 
3]、增加udev规则,以便使用普通用户权限操作调试器。以root权限创建/etc/udev/rules.d/45-openjtag.rules(文件名可以换成别的):
SYSFS{idProduct}=="5118", SYSFS{idVendor}=="1457", MODE="666", GROUP="plugdev"
 
4]、添加OpenOCD配置文件openocd.cfg:
interface ftdi  
#通过描述来指定设备,应当和dmesg中的Product一致  
#ftdi_device_desc "USB<=>JTAG&RS232"  
#通过PID VID指定调试器,比描述更准确些  
ftdi_vid_pid 0x1457 0x5118  
#如果有多个同样的调试器,还可以指定要使用的调试器序列号  
#ftdi_serial  
#引脚定义,相当于旧版中的 ft2232_layout jtagkey  
ftdi_layout_init 0x0c08 0x0f1b  
ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400  
ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800 
# Target configuration for the Samsung 2440 system on chip  
# Tested on a S3C2440 Evaluation board by keesj  
# Processor   : ARM920Tid(wb) rev 0 (v4l)  
# Info:   JTAG tap: s3c2440.cpu tap/device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0)
if { [info exists CHIPNAME] } {  
set  _CHIPNAME $CHIPNAME  
} else {  
set  _CHIPNAME s3c2440  
}
if { [info exists ENDIAN] } {  
set  _ENDIAN $ENDIAN  
} else {  
# this defaults to a bigendian  
set  _ENDIAN little  
}
if { [info exists CPUTAPID ] } {  
set _CPUTAPID $CPUTAPID  
} else {  
# force an error till we get a good number  
set _CPUTAPID 0x0032409d  
#jtag scan chain  
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_CPUTAPID
#  
#jtag_rclk 3000  
adapter_khz 1234
#set _TARGETNAME $_CHIPNAME.cpu  
#target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm920t  
#$_TARGETNAME configure -work-area-phys 0x200000 -work-area-size 0x4000 -work-area-backup 0  
#arm7_9 fast_memory_access enable 
set _TARGETNAME $_CHIPNAME.cpu  
target create $_TARGETNAME arm920t -chain-position $_TARGETNAME  
$_TARGETNAME configure -work-area-phys 0x00200000 \  
-work-area-size 0x4000 -work-area-backup 0 
#reset configuration  
reset_config trst_and_srst
#Flash CFG<openocd.pdf P[74~]  
#flash bank name driver base size chip_width bus_width target [driver_options]  
#usage: flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target>  
#flash bank bank_id driver_name base_address size_bytes chip_width_bytes bus_width_bytes target [driver_options ...]  
flash bank 0 cfi 0x0 0x200000 2 2 $_TARGETNAME
#NAND CFG <openocd.pdf P[88~92]>  
#nand device name driver target [ configparams... ]  
nand device 0 s3c2440 $_TARGETNAME 
root@ubuntu:~# telnet localhost 4444  
Trying 127.0.0.1...  
Connected to localhost.  
Escape character is '^]'.  
Open On-Chip Debugger  
> halt  
> nand probe 0  
NAND flash device 'NAND 256MiB 3.3V 8-bit (Samsung)' found  
> load_image leds.bin  
136 bytes written at address 0x00000000  
downloaded 136 bytes in 0.015671s (8.475 KiB/s)  
> resume 0x0
最后启动OpenOCD:首先将EasyOpenJTAG USB连接至PC,然后开发板上电,最后在和配置文件openocd.cfg相同目录执行openocd
root@ubuntu:~# openocd   
Open On-Chip Debugger 0.10.0-dev-00371-g81631e4 (2016-09-11-22:15)  
Licensed under GNU GPL v2  
For bug reports, read  
http://openocd.org/doc/doxygen/bugs.html  
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.  
adapter speed: 1234 kHz  
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst  
Info : clock speed 1234 kHz  
Info : JTAG tap: s3c2440.cpu tap/device found: 0x0032409d (mfg: 0x04e (Samsung), part: 0x0324, ver: 0x0)  
Info : Embedded ICE version 2  
Info : s3c2440.cpu: hardware has 2 breakpoint/watchpoint units
可以看到设备已经识别成功。
 

Ubuntu 16.04下EasyOpenJTAG+OpenOCD的安装和使用【转】的更多相关文章

  1. Ubuntu(16.04) 下如何修改(安装)arm-linux-gcc编译器

    ubuntu下如何修改(安装)arm-linux-gcc编译器 将gcc解压到根目录 sudo tar xjf arm-linux-gcc-4.3.2.tar.bz2 -C / 查看原来的环境变量 e ...

  2. Ubuntu 16.04下docker ce的安装(待完善)

    参见:https://www.cnblogs.com/senlinyang/p/8203191.html https://blog.csdn.net/qq_34906391/article/detai ...

  3. Ubuntu 16.04下docker ce的安装

    卸载版本的docker sudo apt-get remove docker docker-engine docker.io 安装可选内核模块 从 Ubuntu 14.04 开始,一部分内核模块移到了 ...

  4. Ubuntu 16.04下deb文件的安装

    pkg 是Debian Package的简写,是为Debian 专门开发的套件管理系统,方便软件的安装.更新及移除.所有源自Debian的Linux发行版都使用dpkg,例如Ubuntu.Knoppi ...

  5. ubuntu 16.04下node和pm2安装

    一.安装node,这里安装9.0的版本,安装其它版本直接到https://deb.nodesource.com/setup_9.x找相应版本的更改既可 1.sudo apt-get remove no ...

  6. Ubuntu 16.04 下简单安装使用golang之备忘

      刚开始学习Go语言,这里记录下我在Ubuntu 16.04下安装使用golang的过程,方便以后查询.   一.安装   1.添加源   如果使用默认的源安装golang的话,版本太低,只到1.6 ...

  7. Ubuntu 16.04下编译安装Apache2.4和PHP7结合

    Ubuntu 16.04下编译安装Apache2.4和PHP7结合,并安装PDOmysql扩展. 1.编译安装apache2.4.20 1 第一步: ./configure --prefix=/usr ...

  8. Ubuntu 16.04下安装MacBuntu 16.04 TP 变身Mac OS X主题风格

    Ubuntu 16.04下安装MacBuntu 16.04 TP 变身Mac OS X主题风格 sudo add-apt-repository ppa:noobslab/macbuntu sudo a ...

  9. Ubuntu 16.04 下使用Xampp

    Ubuntu 16.04 下使用Xampp 什么是Xampp? XAMPP(Apache+MySQL+PHP+PERL) 是一个功能强大的建站集成软件包.这个软件包原来的名字是 LAMPP,但是为了避 ...

随机推荐

  1. Hibernate中的一对一映射关系

    Hibernate中的一对一映射关系有两种实现方法(单向一对一,和双向一对一)(一对一关系:例如一个department只能有一个manager) 单向和双向有什么区别呢??例如若是单向一对一,比如在 ...

  2. Oracle之rman常用命令及维护(51CTO风哥rman课程)

    list 查看数据库备份的信息 查询数据库对应物 list incarnation; list backup summary; 列出当前备份信息及汇总 B是备份 F是全备 A是归档 第三个A是是否有效 ...

  3. User Login Client Identification

    w用HTTP认证首部注册用户名. HTTP The Definitive Guide Rather than passively trying to guess the identity of a u ...

  4. web前端 微信支付之H5支付

    一.什么是微信H5支付? 微信,简直是21世纪的社交产品之最.人们的生活已经离不开它,因为它的触角广泛蔓延像一张巨大无形的网,从而让我们的生活更加便捷高效,这款社交工具我们不做过多评价,但是我们要通过 ...

  5. Flask之中间件

    from flask import Flask, flash, redirect, render_template, request app = Flask(__name__) app.secret_ ...

  6. mysql参照完整性 策略设置之 on update 和 on delete

    一.当表中有外键约束的时候参照表中数据的删除和修改违背参照完整性时 可根据以下策略进行处理 1.两条策略设置为cascade的时候 参照表中的数据修改或者删除的时候改表中数据也会被删除 2.两条策略设 ...

  7. window下的开发环境:常用软件

    window下的开发环境:常用软件 Visio 2010  - 产品设计 xmind        -产品设计 Axure       -产品设计 Edraw max 7.3(破解版)  -产品设计 ...

  8. 18.出现Description Resource Path Location Type Unknown error merging manifest

    原因是,依赖工程和主工程的manifest中的 <uses-sdk android:minSdkVersion="9" android:targetSdkVersion=&q ...

  9. python学习笔记(十三)接口开发

    一.开发接口的作用 1.mock接口,模拟一些接口,在别的接口没有开发好的时候,需要开发一些模拟接口进行调试和测试. 2.查看数据,比如,获取所有学员信息的接口,就不需要提供数据库的查看信息. 二.接 ...

  10. PAT 1144 The Missing Number[简单]

    1144 The Missing Number(20 分) Given N integers, you are supposed to find the smallest positive integ ...