jlink怎么调试linux程序_【转】ubuntu linux下openocd + gdb-insight 用Jlink调试arm程序
openocd版本为svn 1214,insight版本为6.8 开发环境为ubuntu-8.04 包都升级到最新。2008.12.8
板子为自己设计的LPC2294的板子,BANK0 为SST39VF1601,BANK1为issi61lv25616al。
首先安装usb驱动库:
下载libusb-0.1.12 (地址google上搜)
解压./configure
make
make install
openocd 安装#./bootstrap
#./configure --enable-jlink (我使用的jtag调试工具是jlink)
#make
#make install
卸载时使用make uninstall即可,当然别删了makefile文件
insight安装
下载 解压
yu@yu-desktop:~/e-work/insight-6.8$ cd ..
yu@yu-desktop:~/e-work$ mkdir insight-arm
yu@yu-desktop:~/e-work$ cd insight-arm
yu@yu-desktop:~/e-work/insight-arm$
../insight-6.8/configure --target=arm-linux-gnueabi --enable-sim --prefix=/usr/local/insight-arm-6.8 --with-termlib=ncurses
我使用的edlk-4.2编译的arm程序,工具前缀都是arm-linux-gnueabi, 所以–target=arm-linux-gnueabi,我们安装到/usr/local/insight-arm-6.8,
因为我们安装的是交叉工具链,有时候需要安装多个版本,所以每个分别安装的不同目录,使用时把相应的目录加入PATH,避免版本之间出错。在工作目录建立source文件,内容为:
///
#export CROSS_COMPILE=arm-elf-
export CROSS_COMPILE=arm-linux-
export PATH=/home/yu/e-work/eldk/usr/bin:/usr/local/insight-arm-6.8/bin:${PATH}
#export PATH=/home/yu/e-work/eldk/usr/bin:/usr/local/insight-arm-6.6/bin:${PATH}
#export GUI_LIBRARY=/usr/local/insight-arm-6.8/lib
echo "Altered environment for u-boot Development"
//
当然要先安装libncurses5及libncurses5-dev(头文件 库等),在新立德软件管理器内搜即可。
在工作目录(我的是/home/yu/e-work)建立openocd.cfg,内容如下:
#daemon configuration
telnet_port 4444
gdb_port 1000
tcl_port 6666
# GDB can also flash my flash!
#gdb_memory_map enable
gdb_memory_map disable #我的insight不支持
#gdb_flash_program enable
gdb_breakpoint_override soft
#gdb_detach reset
#interface
interface jlink
#jtag_speed 0 #Note that the JTAG speed is given in kHz with 0 meaning to autodetect.
#may be I should use jtag_speed 3000, because the speed is too slow!!!! usb drivers's fault???
#jtag_rclk 3000
jtag_speed 3000
#delays on reset lines
jtag_nsrst_delay 200
jtag_ntrst_delay 200
#use combined on interfaces or targets that can't set TRST/SRST separately
#reset_config trst_and_srst srst_pulls_trst
reset_config trst_and_srst
#hard reset the system to a reliable state
#jtag_reset srst
#sleep 500
# It has atmel lpc2294 chip.
source [find lpc2294.cfg]
# The board has a NOR flash on CS0
#flash configuration
#flash bank [driver_options ...]
#flash bank cfi 0x80000000 0x00200000 2 2 0 #jedec_probe #haven't surport FOR sst39vf1601
#Enable use of the DBGRQ bit to force entry into debug mode. This should be safe for all but ARM7TDMI–S cores
# (like Philips LPC).
#arm7_9 dbgrq enable
#if set this command in the upper line, openocd willn't recognize this command!
arm7_9 dbgrq disable
proc psm-c30-a_init { } {
# Force target into ARM state
soft_reset_halt
#force cpu go into Supervisor Mode, and disable IRQ and FIQ
#mww cpsr 0xd3 use this command will make cpu issue data abort
arm7_9 write_xpsr 0xd3 0
#Disable PLL
mww 0xe01fc080 0x0
#remap interrupt vector to onchip flash
mww 0xe01fc040 0x00000001
#init the bus
mww 0xe002c014 0x0f810914
#BCFG0
mww 0xffe00000 0x1000feff
#BFG1
mww 0xffe00004 0x1000feff
#probe on chip flash
flash probe 0
}
$_TARGETNAME configure -event gdb-attach psm-c30-a_init #gdb来连接的时候执行这个事件!
init
//
openocd的文档没有很仔细的看,但是感觉各版本的命令区别很大。
mww命令如果不再事件函数中就会不能识别此指令。arm7_9 dbgrq disable如果放在source [find lpc2294.cfg]前也会不能识别。
所以指令的次序也很重要!可能在搜索到tap之前有些指令还不能执行!
gdb_memory_map disable 是因为我的insight带的gdb编译时默认没有打开parse XML memory map选项,具体怎么打开,还没有看,configure –help应该有。arm7_9 dbgrq disable因为lpc必须关闭。使用arm7_9 write_xpsr 0xd3 0,而不使用mww写cpsr是因为使用后者会报错,提示引起data abort。
reset_config trst_and_srst 我的jtag复位和系统复位是分别控制的。
发现如果使用jtag_rclk 3000,即先使用rclk自己搜索jtag工作频率,速度会很慢。另外我的sst39vf1601不是cfi全兼容的,目前openocd还不支持,但是openocd的maillist上有人修改源码支持,还没有进一步的分析。lpc2294.cfg在openocd源代码的src/target/target目录下有。也要放在当前工作目录,从而使得openocd能找到,我的lpc2294.cfg的内容:
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME lpc2294
}
if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}
if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID
} else {
# force an error till we get a good number
# set _CPUTAPID 0xffffffff
set _CPUTAPID 0x4f1f0f0f #此处要修改成你的cpu的id
}
#jtag scan chain
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
set _TARGETNAME [format "%s.cpu" $_CHIPNAME]
target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi-s_r4
$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0
#flash configuration
#flash bank lpc2000 0 0
#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum
#主频要修改成此时你的处理器的频率,特别是如果处理器内部已经烧写了程序时,要设置成你的那个程序设置的频率。
#而不是gdb attach时的频率。
#内部flash配置
flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 48000 calc_checksum
# For more information about the configuration files, take a look at:
# openocd.texi
我的gdb初始化脚本文件:
/
#GDB 6.8 and higher set any memory area not in the memory map as inaccessible, this can be changed to the old behaviour by #using the following gdb command.
set mem inaccessible-by-default off
#Previous versions of OpenOCD required the following gdb options to increase the packet size and speed up gdb communication.
#This is now handled in the qSupported PacketSize.
#但是现在如果去掉,还是出现(openocd那边):Warning:acknowledgment received, but no packet pending
#Warning:negative reply, retrying
#Error: GDB missing ack(2) - assumed good
#Warning:negative reply, retrying
#之类的错误,gdb的console窗口也会出现错误。
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
target remote localhost:1000
monitor sleep 500
monitor poll
monitor soft_reset_halt
#set fuction breakpoints
#break main
#No symbol table is loaded. Use the "file" command.
#how to load symbol table ???
#load /home/yu/e-work/u-boot-2008.10/u-boot
#continue to run the program
#continue
然后在openocd.cfg所在的目录执行openocd即可启动gdbserver。
然后在工作目录执行source source 建立path,然后执行arm-linux-gnueabi-insight -x insight.gdb /home/yu/e-work/u-boot-2008.10/u-boot
即可启动insight,再dowload即可调试了。可以在insight的cosole窗口通过monitor step等执行openocd的命令,monitor help看看都可以执行那些openocd的指令,help看看可以执行那些gdb的指令。
现在有一个问题是,我编译的insight的tcp端口输入框,watch窗口输入框,无法输入,怀疑是编译器或tcl库的bug。
安装预编译的gnuarm-3.4,其自带的insight-6.1情况依旧,故应该是库的缘故!
也可以使用ddd来调试!
ddd只是各种gdb的一个x-window前端ddd --debugger arm-linux-gdb -x insight.gdb /home/yu/e-work/u-boot-2008.10/u-boot
可启动arm的gdb,所以不用交叉编译。
使用新立德安装即可!!
jlink怎么调试linux程序_【转】ubuntu linux下openocd + gdb-insight 用Jlink调试arm程序相关推荐
- linux设置默认终端模拟器,ubuntu终端默认设置_在Ubuntu Linux上设置默认终端模拟器...
ubuntu终端默认设置_在Ubuntu Linux上设置默认终端模拟器 ubuntu终端默认设置_在Ubuntu Linux上设置默认终端模拟器 ubuntu终端默认设置 Ubuntu has a ...
- linux上开发应用程序_如何在Linux上安装软件应用程序
linux上开发应用程序 如何在Linux上安装应用程序? 与许多操作系统一样,该问题不仅有一个答案. 应用程序可以来自许多来源-几乎无法计数-每个开发团队都可以以自己认为最佳的方式交付软件. 知道如 ...
- arm调试java_使用J-Link GDB Server + Eclipse CDT进行ARM程序调试
之前我预告过这篇文章,这段时间以来,我工作一直比较忙,而且在装修我的小破窝,生活的压力让我把业余的时间都贡献给奥山战场了,我的小牧师,杀人很慢,被杀倒是挺速度的,呵呵:想当年上学的时候,我也是副本RL ...
- anydesk linux安装_在Ubuntu 20.04上安装AnyDesk
在Ubuntu 20.04上安装AnyDesk 运行系统更新 首先,更新和升级系统软件包.apt updateapt upgrade 安装AnyDesk 有两种方法可以在Ubuntu 20 04上安装 ...
- linux 易语言窗口程序_浅谈Linux入门的基本知识
浅谈Linux入门的基本知识 图形模式与文字模式的切换方式Linux预设提供了六个命令窗口终端机让我们来登录. 默认我们登录的就是第一个窗口,也就是tty1,这个六个窗口分别为tty1.tty2 - ...
- linux系统 ns3安装,ubuntu系统下ns3实验基础指令
ubuntu系统下ns3实验基础指令 ubuntu系统下ns3实验基础指令 ubuntu系统下ns3实验基础指令 针对使用ns3进行信息网络建模与仿真相关实验,这篇博客提供了一些基本操作的建议与命令介 ...
- linux版_巧用linux版powershell,管理linux下的docker
owershell,docker,cli,命令,docker ps,docker image 第一章 在linux中搭建docker环境 目的: 在任意版本的linux(物理机,虚拟机,节点机)中,安 ...
- linux 虚拟光驱软件,Ubuntu Linux下强大的虚拟光驱软件 :AcetoneISO
AcetoneISO 是一款十分强大的虚拟光驱软件,支持 Linux 及 Mac 系统,其功能主要包括: 支持挂载/卸载 ISO.MDF.NRG 等映像文件格式 能够将 BIN/CUE.MDF.NRG ...
- 温度转换java小程序_利用easygui模块编写的华氏温度与摄氏温度转换的小程序
-*- coding:utf-8 -*- #Author:'Lmc' #DATE: 2019/4/23/0023 下午 4:23:08 #FileName:tem_compare_gui.PY imp ...
- arch linux安装_安装Arch Linux如何使我的旧笔记本电脑重获新生
arch linux安装 by Jonathan Baldie 乔纳森·巴尔迪(Jonathan Baldie) 安装Arch Linux如何使我的旧笔记本电脑重获新生 (How installing ...
最新文章
- 机器学习笔记十:各种熵总结
- 口语学习Day3:今天聊聊菜单
- debug assertion failed是什么意思?_MD5是是什么?为什么很多压缩文件上都有这个东西?...
- Java web 面试题
- jQuery 阻止冒泡和默认事件
- 1472: C语言实验题――逆置正整数
- 红帽学习笔记[RHCSA] 第三课[输出重定向、Vi编辑器]
- anaconda moviepy_Anaconda使用之安装篇(Windows)
- 腾讯IP+文旅的探索实践
- HFSS、ANSYS Electronics Desktop安装完成后无法启动、无法使用、无法打开问题的解决办法。
- ibm最早的个人计算机,个人计算机竞争者分析:IBM.pdf
- GraphX 在图数据库 Nebula Graph 的图计算实践
- 控件不能正确注册错误
- Swift语法学习--数组
- 使用text-shadow 实现字体描边效果
- bootstrap pagewrapper_Bootstrap Metronic完全响应式管理模板之菜单栏学习笔记
- 告别盗版杀软!免费用17款鼎鼎大名的杀毒软件
- 朱亚杰 php,thinkphp框架怎么做一个三级菜单?
- WIN10 的windows media player 允许远程控制我的播放器勾选后不生效
- 2011年最犀利语录有哪些“语”出惊人?