您的位置:首页 > 编程语言 > Java开发

Eclipse+Jlink gdbSever调试mini6410 uboot

2013-04-11 23:07 375 查看
Eclipse+Jlink gdbSever调试mini6410 uboot

由于mini6410出厂时硬件上不支持仿真器,需要进行修改,具体请看

RVDS2.2 + jlink v8调试 mini6410(http://www.towoo.net/forum.php?mod=viewthread&tid=245&page=1&extra=#pid267)

对于Eclipse图形化方法调试,网上已经有很多的文章,本文也是从中得到很多,只是把调试用到6410上而已.

把软件清单列一下:

1、 Eclipse-SDK-3.6-win32 http://www.eclipse.org/downloads/
2、 Cdt-master-7.0 http://www.eclipse.org/cdt/downloads.php

3、 Zylin插件 http://www.zylin.com/zylincdt/
4、 yagarto-tools-20100703-setup http://www.yagarto.de/#download
5、 yagarto-bu-2.20.1_gcc-4.5.1-c-gdb-7.1_eabi http://www.yagarto.de/#download

6、 JLinkARM_V410i http://www.segger.com/cms/jlink-software.html
注意: 对于Jlink的软件包,在V4.10下测试。高版本不一定支持的好。

正确连接上mini6410开发板和Jlink后,打开gdb server如图所示,可以正确读出ARM11.状态是waiting for connection.



本文就该调试环境来调试uboot来简单介绍一下。我尝试在 windows下编译uboot没有成功, 所以这里用Linux环境下编译得到的ELF格式的uboot。把已经编译好的elf格式的uboot copy到windows下的uboot原代码文件夹里,后面导入的时候方便。另外6410的uboot用到了MMU,为了简单起见,把MMU关掉,可以在/include/configs/mini6410.h里找到这个宏定义开关#define CONFIG_ENABLE_MMU,注释掉即可。另外还需要修改TEXT_BASE的值,定义在/board/samsung/mini6410/Config.mk,把0xc7e00000修改为0x57e00000.首先新建一个C
project, 如下图所示。



然后会出现下面的画面, 这里注意的是选择 Makefile project->Empty Project->Other Toolchain.点击完成。



如图所示。



点击Next,出现下图,这里点击Browse找到uboot的源代码,把需要的源代码选中导入(本文调试基于mini6410的uboot),要不然会出现一点麻烦,多试几次就可以知道哪些用不到了。



点击完成后如图所示,源代码已经导入了。



下面需要设置一下eclipse,使之能够编译调试基于arm的程序。下图用于设置交叉编译器arm-none-eabi-gcc.exe.由于本文调试uboot,也可以不设置,但为了以后方便,还是设置一下吧。



下图类似,可以根据下图设置自己的开发环境。



下面设置调试环境,也是本文的核心部分。点击Run->Debug Configurations,如图



出现下图:



在这里,我们用的是zylin Embedded debug(Native), 在Main选项卡中,C/C++ Application是重要的选项,就是选中我们需要调试的ELF格式的uboot.

下面设置Debugger选项卡,把GDB debugger设置为arm-none-eabi-gdb.exe.就是我们以后调试用的交叉调试器。把GDB command file: 清空。



下面设置Command选项卡,在’Initialize’ Command 添加初始化mini6410的代码,这个代码是符合Jlink gdbserver的语法结构的。



详细的代码如下,做了简单的注释。

# connect to the J-Link gdb server

target remote localhost:2331

# Set JTAG speed to 30 kHz

monitor endian little

monitor speed 30

# Reset the target

monitor reset

monitor sleep 10

#

# CPU core initialization (to be done by user)

#

# Set the processor mode

monitor reg cpsr = 0xd3

#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

monitor MemU32 0x7e004000 = 0x00000000

monitor sleep 10

#disable interrupt

monitor MemU32 0x71200014 = 0x00000000

monitor MemU32 0x71300014 = 0x00000000

monitor MemU32 0x7120000C = 0x00000000

monitor MemU32 0x7130000C = 0x00000000

monitor MemU32 0x71200F00 = 0x00000000

monitor MemU32 0x71300F00 = 0x00000000

#set clock

monitor MemU32 0x7e00f900 = 0x0000801e

monitor MemU32 0x7e00f000 = 0x0000ffff

monitor MemU32 0x7e00f004 = 0x0000ffff

monitor MemU32 0x7e00f020 = 0x01043310

monitor MemU32 0x7e00f00C = 0xc2150601

monitor MemU32 0x7e00f010 = 0xc2150601

monitor MemU32 0x7e00f024 = 0x00000003

monitor MemU32 0x7e00f014 = 0x00200102

monitor MemU32 0x7e00f018 = 0x00000000

monitor MemU32 0x7e00f01C = 0x14000007

#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 fixed

monitor speed 12000

break start_armboot

load

continue

点击Debug按钮,uboot download完成以后,就可以像其他的调试器一样,设置断点,单步调试之类的,大家可以尝试一下,一起进步。



转载:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: