使用jlink+gdbserver+insight调试ARM程序--配置insight

1. 下载insight-6.8a.tar.bz2
编译:  ./configure --target=arm-linux --prefix=/opt/insight_arm --disable-werror
(1) 其中--target=arm-linux会影响安装生成的可执行文件的名字,例如安装之后可执行文件的名字为:
caodan@caodan-Ubuntu:/opt/insight_arm/bin$ ls
arm-linux-gdb  arm-linux-insight  arm-linux-run  tclsh8.4  wish8.4
(2) --prefix=/opt/insight_arm 的作用, 指定安装路径
(3) --disable-werror 禁止-Werror这个编译选项,因为它会打所有的Warning当作error,导致编译不能通过。

2. 编译 make
3. 安装 make install
安装之后的目录结构为:
caodan@caodan-Ubuntu:/opt/insight_arm$ ls
bin  include  info  lib  man  share

4. 在终端下面运行arm-linux-insight
可能会遇到下面的问题:
caodan@caodan-Ubuntu:/opt/insight_arm/bin$ ./arm-linux-insight
Tk_Init failed: Can't find a usable tk.tcl in the following directories:
    /opt/insight_arm/share/tk8.4 /opt/insight_arm/lib/tk8.4 /opt/lib/tk8.4 /opt/insight_arm/library /opt/library /opt/tk8.4.1/library /tk8.4.1/library

/opt/insight_arm/share/tk8.4/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
    while executing
"bind Listbox <MouseWheel> {
    %W yview scroll [expr {- (%D / 120) * 4}] units
}"
    (file "/opt/insight_arm/share/tk8.4/listbox.tcl" line 183)
    invoked from within
"source /opt/insight_arm/share/tk8.4/listbox.tcl"
    (in namespace eval "::" script line 1)
    invoked from within
"namespace eval :: [list source [file join $::tk_library $file.tcl]]"
    (procedure "SourceLibFile" line 2)
    invoked from within
"SourceLibFile listbox"
    (in namespace eval "::tk" script line 4)
    invoked from within
"namespace eval ::tk {
SourceLibFile button
SourceLibFile entry
SourceLibFile listbox
SourceLibFile menu
SourceLibFile panedwindow
SourceLibFile ..."
    invoked from within
"if {$::tk_library ne ""} {
    if {[string equal $tcl_platform(platform) "macintosh"]} {
proc ::tk::SourceLibFile {file} {
   if {[catch {
namesp..."
    (file "/opt/insight_arm/share/tk8.4/tk.tcl" line 393)
    invoked from within
"source /opt/insight_arm/share/tk8.4/tk.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list source $file]"


This probably means that tk wasn't installed properly.

提示信息是说tl没有安装好,
什么是tcl? 什么是tk?
tcl 是Tool Command Language 的缩写,而 tk 是一个 X window 的 Tool Kit,是 tcl在 X Window System 的应用。
tcl 是一种解译语言,也是一套 C 的函式库。为什么这样说呢?因为 tcl 的解译器被设计成一个 C 的函式库,提供基本的命令与控制结构,并且使用 tcl 的任何程序皆可以根据 tcl 的规格撰写 C 程序与之链接增加新的命令,以提高关键程序的效率、或增加新的特色。
  tk 的解译器叫 wish,是 WIndowing SHell 的简称。只要在提示号下 (xterm 下)输入 wish 就可以了。接下来你可以看到一个空白的窗口出现,xterm 下的提示号也变成了 wish 的提示号。此时,在提示号输入以下两行指令,就可以见最简单,最让人惊奇的t k程序了:

暂时不知道怎样解决上面遇到的这个问题,不过最快的方式就是把出错的行屏蔽掉。
将share/tk8.4/listbox.tcl第181行附近的内容注释掉
#annotation by caodan
#bind Listbox <MouseWheel> {
#    %W yview scroll [expr {- (%D / 120) * 4}] units
#}
将share/tk8.4/text.tcl文件第461行附近的内容注释掉
#annotation by caodan
#bind Text <MouseWheel> {
#    %W yview scroll [expr {- (%D / 120) * 4}] units
#}

再次执行,就会发现没有问题了,界面如下:

 

5. 可以在Dash菜单中建立一个快捷方式(针对Ubuntu用户)
caodan@caodan-Ubuntu:/usr/local$ cat /usr/share/applications/insight.desktop
[Desktop Entry]
Name=insight
GenericName=insight-6.8
Comment=graphic interface for debug with gdbserver
Exec=/opt/insight_arm/bin/arm-linux-insight
Terminal=false
Type=Application
StartupNotify=true
Icon=
Categories=Utility;Gnome;tcl;tk;redhat

6. 运行jlinkgdbserver, 并使用insight连接到gdbserver
运行jlinklgdbserver的界面如下,正在TCP/IP的2331端口等待连接:

caodan@caodan-Ubuntu:~/code/asm/S3C6410$ sudo jlinkgdbserver
[sudo] password for caodan:
SEGGER J-Link GDB Server V4.22

JLinkARM.dll V4.22 (DLL compiled Dec 17 2010 17:41:06)

Listening on TCP/IP port 2331

J-Link connected
Firmware: J-Link ARM V8 compiled Dec 16 2010 20:21:29
Hardware: V8.00
S/N: 20100213
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFULL

J-Link found 2 JTAG devices, Total IRLen = 5
JTAG ID: 0x07B76F0F (ARM11)
J-Link: ARM11 CP15 Settings changed: 0x00450078 from 0x00001002, MMU Off, ICache Off, DCache Off
Info: CP15.0.0: 0x410FB766: ARM, Architecture Unknown architecture
Info: CP15.0.1: 0x1D152152: ICache: 16kB (4*128*32), DCache: 16kB (4*128*32)
DIDR: 6 Breakpoints available and 2 Watchpoints available.

注意: 这里的jlinkgdbserver是我自己创建的一个符号链接,JLinkGDBserver如何使用,请参考其他文档

运行insight, 并设置连接到jlinkgdbserver

 

注意到,在Port的地方,上图为1000, 是因为无法修改这个参数,临时的解决办法是将Hostname设置为127.0.0.1:2331
连接成功之后如下图:

 

7. 如何解决无法设置端口号的问题:
(1)可以设置jlinkgdbserver启动时候监听的端口为1000
例如:

caodan@caodan-Ubuntu:~/code/asm/S3C6410$ sudo jlinkgdbserver -port 1000
SEGGER J-Link GDB Server V4.22

JLinkARM.dll V4.22 (DLL compiled Dec 17 2010 17:41:06)

Listening on TCP/IP port 1000

J-Link connected
.............................................

(2)另外一种方式是编译前修改源码,修改默认的端口。
gdb/gdbtk/library/targetselection.itb中的默认端口为2331
修改第345行为:  pref define gdb/load/$target-portname 2331
修改第809行为:  pref define gdb/load/$target-portname 2331

重新编译 安装
但是我没有成功,可能是因为make clean的时候有什么地方没有清除干净, 暂时就这样吧,使用第一种方式替代。

转载于:https://www.cnblogs.com/caodan/p/3597273.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值