本文转载自: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. HDU 5876 大连网络赛 Sparse Graph

    Sparse Graph Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) T ...

  2. python基础-第二篇-基本数据类型

    一.运算符 1.算数运算: 算数运算符相信大家都不陌生吧,尤其是加减乘除,好!那我就带着大家看看最后三个,这三个到底是干什么玩意的? %,取两数相除的余数,看图: **,x的多少次幂,看图: //,取 ...

  3. 申请startssl免费一年ssl证书(转)

    原文:http://www.live-in.org/archives/1296.html 申请过程步骤蛮多的,对于像我这样的小白来说还是截图+文字记录下比较好.浏览器是firefox. 1.打开htt ...

  4. PCI 设备详解二

    上篇文章主要从硬件的角度分析了PCI设备的特性以及各种寄存器,那么本节就结合LInux源代码分析下内核中PCI设备的各种数据结构以及相互之间的联系和工作机制 2016-10-09 注:一下代码参考LI ...

  5. Ningx代码研究.

    概述 研究计划 参与人员 研究文档 学习emiller的文章 熟悉nginx的基本数据结构 nginx 代码的目录结构 nginx简单的数据类型的表示 nginx字符串的数据类型的表示 内存分配相关 ...

  6. mysql联合其他表做更新

    在sql server中,我们可是使用以下update语句对表进行更新: update a set a.xx= (select yy from b) where a.id = b.id ; 但是在my ...

  7. Php 创建XML

    Php 创建XML  Php 创建XML并保存,学习示比例如以下: <? php try{ //创建DOMDocument 对象 $dom = new DOMDocument("1.0 ...

  8. CS224n(一)

    个人博客地址: https://yifdu.github.io/2018/10/30/CS224n%E7%AC%94%E8%AE%B0%EF%BC%88%E4%B8%80%EF%BC%89/#more

  9. APICloud常用方式

    新打开一个窗口: api.openWin({ name: 'unlogin', url: 'widget://html/unlogin.html', pageParam: { } }); 新打开一个F ...

  10. Python 函数的使用小结

    函数的好处:提高代码复用性,简化代码,代码可扩展. 函数只有调用的时候才会被执行. 1.参数: 形参&实参:位置参数,属于必填参数:默认值参数,为非必填参数,没有传值时使用默认值:关键字参数: ...