Eclipse+Jlink+Fedora实现mini6410单步调试u-boot
2014-04-20 10:11
417 查看
Eclipse+Jlink+Fedora实现mini6410单步调试u-boot.zip
(566 K)
注意
linux下编译已经为elf32格式的文件
(若Jlink不能识别,看板子version是否小于1048,请看使用J-Link在ADS下调试Mini6410裸机程序的详细步骤(开发文档和教程下))
因有人问到2440等是否可用,就试了下 :
如果用SD卡或者Nand
U-boot启动来完成初始化,Eclipse可采用如下初始命令,即去掉了初始化CPU等部分,只提供下载等命令:
# connect to the J-Link gdb server
target remote localhost:2331
#target remote 127.0.0.1:2331
# Set JTAG speed to 30 kHz
monitor speed 30
monitor endian little
# Setup GDB for faster downloads
#set remote memory-write-packet-size 1024
#set remote memory-write-packet-size 4096
set remote memory-write-packet-size 10240
set remote memory-write-packet-size fixed
monitor speed 12000
#break start_armboot
break relocate_code
load
break lowlevel_init
load完成后就可以进行jlink单步调试,但要注意修改u-boot的基地址,如原板子上得u-boot在0x57e00000(u-boot-2011.09默认在此),就要修改Makefile中的 echo "RAM_TEXT= 0X57E00000" >> ......config.tmp 为合适的值,如0x58E00000等。
一、需安装的软件:
1、jre-6u21-windows-i586.exe
2、eclipse
推荐:Eclipse Helios Packages (2010 - v 3.6)
à
Eclipse IDE for C/C++ Developers
Feature List:
org.eclipse.cdt | 7.0.0 |
org.eclipse.cdt.platform | 7.0.0 |
org.eclipse.platform | 3.6.0 |
org.eclipse.rcp | 3.6.0 |
或者:
Eclipse-SDK-3.6.2-win32 http://www.eclipse.org/downloads/
Cdt-master-7.0 .2.zip
http://www.eclipse.org/cdt/downloads.php
(不需要解压,安装较久)
4、
Zylin插件 http://opensource.zylin.com/zylincdt
(在线安装)
5、
JLinkARM_V410i http://www.segger.com/cms/jlink-software.html
注意:
对于Jlink的软件包,在V4.10下测试。高版本不一定支持的好。
6、Windows下的交叉编译工具(两个工具都试过能在windows下正常编译u-boot)
Sourcery CodeBench Lite Edition for ARM
选择EABI—all versions---》Sourcery
G++ Lite 2011.03-42
http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite
或者
yagarto-bu-2.20.1_gcc-4.5.1-c-gdb-7.1_eabi
http://www.yagarto.de/#download
二、在线查找并安装
1 安装C/C++插件(如果是Eclipse
IDE for C/C++ Developers版本省略此步)
启动eclipse,点 help->Install new software->Add .然后在弹出的窗口中
Name不用填写,在Location中填写:http://update.eclipse.org/tools/cdt/releases/new,然后点OK,软件会自动查找CDT插件,一路点下去即可;
2 安装zylincdt调试插件
同样重复以上步骤,在Location中填写:http://opensource.zylin.com/zylincdt
下载压缩包来安装:
1、启动eclipse,点
help->Install new software->Add . 然后在弹出的窗口中—》Location一栏选择压缩包。
2、勾选要安装的插件,点ok
三、连接Jlink
正确连接上mini6410开发板和Jlink后,打开gdb
server如图所示,可以正确读出ARM11.状态是waiting
for connection.
1)
一定不要选adpative否则在调试时会出现连不上,可选择auto或者5k~12000k之一都可以。
2)
需选为little endian
本文就该调试环境来调试uboot来简单介绍一下。在 windows下编译uboot可以参考Build
and Debug U-Boot in Eclipse Helios On Window XP一文,我用的是u-boot-2011.09,经过修改Makefile和mkconfig中soft
link相关部分,在MinGW和Eclipse下能顺利进行编译。本文介绍另外一种方法,也是liandao大侠提供的方法,只是我做了一些改动。
1、建立工程
new—>projectà须选择
Makefile project with Existing Code->选择samba共享的u-boot-2011.09目录。
我是将samba目录映射驱动Z。
如果导入不成功,请到linux虚拟机检查samba共享设置,是否勾上writable。我用的Fedora14,附录A是samba相关设置。
2、设置build相关选项。
工程选项properties—》C/C++
Build
a、Builder Setting Tab项
去掉Use default build command
,填上cmd /c remote_build.bat
b、Setting一栏,勾上elf
parse 和GNU elf parse
并修改GNU elf parse下addr2line.exe
和c++ filt.exe为你安装到windows的交叉编译工具eabi目录路径。我装的是Sourcery
G++ Lite 2011.03-42,所以是arm-2011.03\bin下。
并把project
项中build automatically项取消掉,不让其自动编译。
3、添加make distclean和make
mini6410_config项
project->make targetàcreate
填上distclean然后ok
同样增加mini6410_config项.(如果是全新的u-boot-2011.09
可尝试smdk_6400)
4、plink等相关设置
a、link.exe C:/Windows/system32下
b、建立一文本文件写入:
plink.exe -ssh root@192.168.0.5 -pw 111111 cd /usr/tmp/u-boot-2011.09; time make %1; date;
linux IP
密码 uboot目录
改名为remote_build.bat,放到/usr/tmp/u-boot-2011.09目录下
因我在u-boot中Makefine
加入了linux下的交叉编译路径(export CROSS_COMPILE=arm-none-eabi-
)及root账户启动时加入了交叉编译器的linux目录,所以不用再remote_build.bat中去执行环境变量。
5、Debug项设置
run-》Debug
双击Zylin embedded debug—》选择下边的u-boot-xx
main一栏选择u-boot
[upload=8]
下面设置Debugger选项卡,把GDB
debugger设置为arm-none-eabi-gdb.exe.就是我们以后调试用的交叉调试器。把GDB
command file: 清空。
[upload=9]
下面设置Command选项卡,在’Initialize’ Command
添加下面的初始化mini6410的代码,这个代码是符合Jlink
gdbserver的语法结构的。
[upload=10]
在Eclipse+Jlink gdbSever调试mini6410
uboot一文中作者加入了continue,是不能进行单步调试的,切记。
代码如下(做了简单的注释):
# connect to the J-Link gdb server
target remote localhost:2331
#target remote 127.0.0.1:2331
# Set JTAG speed to 30 kHz
monitor speed 30
monitor endian little
# Reset the target
monitor reset
monitor sleep 20
#
# CPU core initialization (to be done by user)
#
# Set the processor mode
monitor reg cpsr = 0xd3
#enable arm instruction set simulation
monitor AllowSimulation 1
#config MMU
#flush v3/v4 cache
monitor cp15 7, 7, 0, 0 = 0x0
#/* flush v4 TLB */
monitor cp15 8, 7, 0, 0 = 0x0
#disable MMU stuff and caches
monitor cp15 1, 0, 0, 0 =0x1002
#Peri port setup
monitor cp15 15, 2, 0, 4 = 0x70000013
#disable watchdog
#memU8/16/32 read/write byte/half word/word from the address
#monitor memU32 0x7e004000 :read word
monitor MemU32 0x7e004000 = 0x00000000
monitor sleep 100
#disable interrupt ,对VICINTENCLEAR
寄存器:0无影响
1中断diable
monitor MemU32 0x7120000C = 0x00000000
monitor MemU32 0x7130000C = 0x00000000
monitor MemU32 0x71200014 = 0xFFFFFFFF
monitor MemU32 0x71300014 = 0xFFFFFFFF
#对VectAddr写入任何值清除当前中断
monitor MemU32 0x71200F00 = 0x00000000
monitor MemU32 0x71300F00 = 0x00000000
#set clock 【系统控制器一章中包括时钟和电源控制】
monitor MemU32 0x7e00f000 = 0x0000ffff
monitor MemU32 0x7e00f004 = 0x0000ffff
#monitor MemU32 0x7e00f00C = 0xc2150603
monitor MemU32 0x7e00f00C = 0xc2150601
monitor MemU32 0x7e00f010 = 0xc2150601
monitor MemU32 0x7e00f014 = 0x00200102
monitor MemU32 0x7e00f018 = 0x00000000
monitor MemU32 0x7e00f01C = 0x14000007
monitor MemU32 0x7e00f020 = 0x01043310
monitor MemU32 0x7e00f024 = 0x00000003
monitor MemU32 0x7e00f900 = 0x0000801e
#config sdram
monitor MemU32 0x7e00f120 = 0x00000008
monitor MemU32 0x7e001004 = 0x00000004
monitor MemU32 0x7e001010 = 0x0000040f
monitor MemU32 0x7e001014 = 0x00000006
monitor MemU32 0x7e001018 = 0x00000001
monitor MemU32 0x7e00101c = 0x00000002
monitor MemU32 0x7e001020 = 0x00000006
monitor MemU32 0x7e001024 = 0x0000000a
monitor MemU32 0x7e001028 = 0x0000000c
monitor MemU32 0x7e00102c = 0x0000018f
monitor MemU32 0x7e001030 = 0x0000000c
monitor MemU32 0x7e001034 = 0x00000002
monitor MemU32 0x7e001038 = 0x00000002
monitor MemU32 0x7e00103c = 0x00000002
monitor MemU32 0x7e001040 = 0x00000002
monitor MemU32 0x7e001044 = 0x00000013
monitor MemU32 0x7e001048 = 0x00000013
monitor MemU32 0x7e00100C = 0x00010012
monitor MemU32 0x7e00104C = 0x00000b45
monitor MemU32 0x7e001200 = 0x000150f8
monitor MemU32 0x7e001304 = 0x00000000
monitor MemU32 0x7e001008 = 0x000c0000
monitor MemU32 0x7e001008 = 0x00000000
monitor MemU32 0x7e001008 = 0x00040000
monitor MemU32 0x7e001008 = 0x00040000
monitor MemU32 0x7e001008 = 0x000a0000
monitor MemU32 0x7e001008 = 0x00080032
monitor MemU32 0x7e001004 = 0x00000000
# Setup GDB for faster downloads
#set remote memory-write-packet-size 1024
#set remote memory-write-packet-size 4096
set remote memory-write-packet-size 10240
set remote memory-write-packet-size fixed
monitor speed 12000
#break start_armboot
break relocate_code
load
break lowlevel_init
#不能使用continue,否则不能进行单步调试(即会程序自动run)
#continue
source一栏移除default项。
点击Debug按钮,uboot download完成以后,就可以像其他的调试器一样。
如图下载进行中:
[upload=11]
下载完成,设置u-boot代码所在目录
Locate File设置start.S的目录
source lookup path
设置project—》u-boot-2011.09的目录
然后就可单步step in/step out调试了。
[upload=12]
附录A Fedora14 samba设置及Fedora运行于命令行模式
1、
修改 fedora14 /etc/ininttab
26行
改为 id :3:initdefault:
再次启动就会停留在命令行登陆模式,如果要进入X-windows,登陆后执行startx即可。
2、
samba
终端:
#yum search samba
#yum install samba.i686
samba GUI配置工具
#yum install system-config-samba.noarch
添加samba共享目录,需勾上writable
[upload=13]
添加samba用户
[upload=14]
共享属性设置:share模式,不需输入密码
[upload=15]
相关文章推荐
- Eclipse+Jlink gdbSever调试mini6410 uboot
- Eclipse+Jlink gdbSever调试mini6410 uboot
- Eclipse+Jlink gdbSever调试mini6410 uboot
- Ubuntu 下搭建Eclipse PDT实现php的单步调试的功能
- 如何在Eclipse中 NDK r-10实现单步调试jni代码
- 使用eclipse与jLink V8调试exynos 4412 u-boot
- eclipse配置ndk 实现jni 单步调试
- 使用eclipse与jLink V8调试exynos 4412 u-boot
- 继续摘抄:Ubuntu 下搭建Eclipse PDT实现php的单步调试的功能
- Eclipse 的单步调试(转)
- 实现u-boot在SDRAM中调试
- JLINK+ECLIPSE 调试树莓派
- eclipse的单步调试和java连接数据库2008或2005
- eclipse + GDB + JLink 搭建MCU调试环境
- eclipse 的单步调试的技巧
- Atitit. 脚本语言的断点单步调试的设计与实现 attialx 总结 php 参照java
- Eclipse的单步调试
- Eclipse单步调试
- (Caffe,LeNet)Eclipse单步调试(一)
- Eclipse 的单步调试