系统平台:WindowsXP

虚拟机: VMware Workstation 6.5.0

Ubuntu8.10 安装程序 ubuntu-8.10-desktop-i386.iso

下载地址:http://mirror.ylmf.net/ubuntu/8.10/ubuntu-8.10-desktop-i386.iso

u-boot-1.2.0

官方下载地址:ftp://ftp.denx.de/pub/u-boot/

Skyeye-1.2.6

下载地址:http://sourceforge.net/projects/skyeye/files/skyeye/skyeye-1.2.6_rc1/skyeye-1.2.6_rc1.tar.bz2/download

图形化GDB调试工具:insight-6.8.tar.bz2

下载地址ftp://sourceware.org/pub/insight/releases/

(一) 安装虚拟机VMware及虚拟安装Ubuntu8.10

VMware及在VMware上虚拟安装Ubuntu8.10的安装很简单这里不详细描述,不懂的朋友可在Baidu中搜索“Vmware 上安装Ubuntu8.10”,网上这方面的帖子很多。

安装完VMware 及Ubuntu8.10后要安装VMware Tools

安装好VMware Tools后可以就可在WindowsXP和Ubuntu8.10间进行文件共享及实现Ubuntu8.10下对屏幕分辨率的调整。

这里给个链接参考:

http://linux.chinaunix.net/techdoc/system/2009/04/30/1109676.shtml

http://blog.chinaunix.net/u3/93889/showart_1915654.html

这两个链接讲的很详细,非常感谢作者如此详细认真的描述。

(二)  为Ubuntu8.10换更新源

用虚拟机运行Ubuntu8.10

打开终端输入:sudo gedit /etc/apt/sources.list

用以下内容覆盖原文件

#台湾:台湾的官方源速度也相当不错,有时甚至快于内地的
deb http://tw.archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu intrepid-security main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu intrepid-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu intrepid-backports main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu intrepid-proposed main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu intrepid-security main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu intrepid-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu intrepid-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu intrepid-proposed main restricted universe multiverse #电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):
deb http://cn.archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu intrepid-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu intrepid-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu intrepid-backports main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu intrepid-proposed main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu intrepid-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu intrepid-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu intrepid-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu intrepid-proposed main restricted universe multivers

保存并退出。

在终端中输入:sudo apt-get update 更新列表。

由于更新源很多,可根据情况选择速度较快的几个。

(三) 用新立得软件管理器更新安装以下软件包

binutils

binutils-dev

build-essential

libx11-dev

libncurse5-dev

texinfo

autoconf

点击System-》系统管理-》新立得软件管理器 输入root权限密码 在软件管理器中标记以上软件,然后点击Apply进行软件包的安装。

(四) Skyeye的安装

下载skyeye-1.2.6_rc1.tar.bz2

tar  jxvf  skyeye-1.2.6_rc1.tar.bz2

cd   skyeye-1.2.6_rc1

修改文件 device/nandflash/nandflash_smallblock.c line 519  to

 if(( nf->fdump=open(dev->dump,FILE_FLAG,))<)

./configure

make

make install

查看/usr/local/bin,多出一项skyeye,这就是我们启动skyeye的命令文件。之后可在任何目录下运行skyeye。

在终端输入skyeye将显示以下内容,说明安装正确:

**************************** WARNING **********************************

If you want to run ELF image, you should use -e option to indicate

your elf-format image filename. Or you only want to run binary image,

you need to set the filename of the image and its entry in skyeye.conf.

***********************************************************************

Your elf file is little endian.

Failed to open skyeye config file skyeye.conf in the same directory

error: No such file or directory

SkyEye 1.2.

Bug report: skyeye-developer@lists.gro.clinux.org

Usage: skyeye [options] -e program [program args]

Default mode is STANDALONE mode

------------------------------------------------------------------

Options:

-e exec-file        the (ELF executable format)kernel file name.

-l load_address,load_address_mask

                    Load ELF file to another address, not its entry.

-b                  specify the data type is big endian when non "-e" option.

-d                  in GDB Server mode (can be connected by GDB).

-c config-file      the skyeye configure file name.

-h                  The SkyEye command options, and ARCHs and CPUs simulated.

------------------------------------------------------------------

----------- Architectures and CPUs simulated by SkyEye-------------

-------- ARM architectures ---------

at91

lpc

s3c4510b

s3c44b0x

s3c44b0

s3c3410x

ep7312

lh79520

ep9312

cs89712

sa1100

pxa_lubbock

pxa_mainstone

at91rm92

s3c2410x

s3c2440

sharp_lh7a400

ns9750

-------- BlackFin architectures ----

bf533

bf537

(五) 安装arm-linux交叉编译工具链

交叉编译工具可以自己编译或使用别人已经编译好的交叉编译工具。

交叉编译工具的制作过于复杂,有兴趣有时间的可以学习下如何制作,这里我就使用别人已经编译好的交叉编译工具cross-3.2

下载地址:ftp://ftp.arm.linux.org.uk/pub/armlinux/toolchain/

sudo cp cross-3.2.tar.bz2 /  将cross-3.2.tar.bz2 拷贝到跟目录下

sudo tar jxvf  cross-3.2.tar.bz2

sudo rm –rf cross-3.2.tar.bz2

在/usr/local/下会多出一arm文件夹

/usr/local/arm 就是交叉编译工具所在的目录

设置环境变量PATH

sudo gedit /ect/apt/environment

将 :/usr/local/arm/bin 加入末尾保存并退出

注销重新登陆

在终端输入:arm-linux-gcc -v 

显示以下信息说明安装正确

Reading specs from /usr/local/arm/bin/../lib/gcc-lib/arm-linux/3.2/specs

Configured with: ./configure --target=arm-linux --prefix=/usr/local/arm/ --with-headers=/home/sylam/armbuild/src/linux/include --disable-shared --disable-threads --enable-languages=c : (reconfigured) ./configure --target=arm-linux --prefix=/usr/local/arm/ --with-headers=/home/sylam/armbuild/src/linux/include

Thread model: posix

gcc version 3.2

(六) 编译u-boot

下载u-boot-1.2.0.tar.bz2

官方下载地址:ftp://ftp.denx.de/pub/u-boot/

tar jxvf u-boot-1.2.0.tar.bz2

cd u-boot-1.2.0

vim common/cmd_bootm.c

将第464-477行

U_BOOT_CMD(
bootm, CFG_MAXARGS, , do_bootm,
"bootm - boot application image from memory\n",
"[addr [arg ...]]\n - boot application image stored in memory\n"
"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
"\t'arg' can be the address of an initrd image\n"
#ifdef CONFIG_OF_FLAT_TREE
"\tWhen booting a Linux kernel which requires a flat device-tree\n"
"\ta third argument is required which is the address of the of the\n"
"\tdevice-tree blob. To boot that kernel without an initrd image,\n"
"\tuse a '-' for the second argument. If you do not pass a third\n"
"\ta bd_info struct will be passed instead\n"
#endif
);

改为:

#ifdef CONFIG_OF_FLAT_TREE
U_BOOT_CMD(
bootm, CFG_MAXARGS, , do_bootm,
"bootm - boot application image from memory\n",
"[addr [arg ...]]\n - boot application image stored in memory\n"
"passing arguments 'arg ...'; when booting a Linux kernel,\n"
"\t'arg' can be the address of an initrd image\n"
"\tWhen booting a Linux kernel which requires a flat device-tree\n"
"\ta third argument is required which is the address of the of the\n"
"\tdevice-tree blob. To boot that kernel without an initrd image,\n"
"\tuse a '-' for the second argument. If you do not pass a third\n"
"\ta bd_info struct will be passed instead\n"
);
#else
U_BOOT_CMD(
bootm, CFG_MAXARGS, , do_bootm,
"bootm - boot application image from memory\n",
"[addr [arg ...]]\n - boot application image stored in memory\n"
"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
"\t'arg' can be the address of an initrd image\n"
);
#endif

原文参见:http://shkliu.blogbus.com/logs/7898682.html

编译u-boot

make smdk2410_config

make

(七) 将GCC 版本降由GCC-4.3.2到GCC-4.2.0

GCC-4.3.2版本过高对语法要求较严格编译gdb会有错误,若出现编译错误可将gcc 版本降低

sudo apt-get install gcc-4.2

rm /usr/bin/gcc

ln –s /usr/bin/gcc-4.2 /usr/bin/gcc

运行gcc –v查看gcc 版本将显示以下信息

Using built-in specs.

Target: i486-linux-gnu

Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu

Thread model: posix

gcc version 4.2. (Ubuntu 4.2.-3ubuntu4)

要更改其他gcc 版本方法同上。

(八) 安装gdb-6.8

下载gdb-6.8.tar.bz2

 tar jxvf gdb-6.8.tar.bz2

 cd gdb-6.8

./configure  --target=arm-linux

make

sudo make install

编译 gdb-server

cd gdb-6.8/gdb/gdbServer

./configure  --target=arm-linux --host=arm-linux

make CC=/usr/local/arm/bin/arm-linux-gcc

(九) 安装图形化GDB调试工具

insight-6.8

下载insight-6.8.tar.bz2

下载地址ftp://sourceware.org/pub/insight/releases/

tar jxvf insight-6.8.tar.bz2

cd insight-6.8

./configure --target=arm-linux  --enable-sim --prefix=/usr/local

make

sudo make install

安装结束后在/usr/local/bin 中会有arm-linux-insight

在终端中是输入: arm-linux-insight 将启动insight

(十) 用arm-linux-insight 及skyeye对u-boot 进行调试

cd $HOME

mkdir skyeye

拷贝第六步中u-boot-1.2.0目录下编译生成的u-boot 及u-boot.bin文件到此文件下

建立skyeye.conf 文件

文件内容如下:

# skyeye config file for S3C2410X

cpu: arm920t
mach: s3c2410x # physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00100000
mem_bank: map=M, type=R, addr=0x01400000, size=0x00400000
#mem_bank: map=M, type=R, addr=0x01400000, size=0x00400000, file=./u-boot.bin,boot=yes
mem_bank: map=M, type=RW, addr=0x30000000, size=0x03f80000
mem_bank: map=M, type=RW, addr=0x33F80000, size=0x00080000,file=./u-boot.bin,boot=yes # all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
net: type=cs8900a, base=0x19000300, size=0x20,int=, mac=::3E::0A:5B, ethmod=tuntap, hostip=192.168.245.100 #nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
#lcd: type=s3c2410x, mod=gtk #dbct:state=on

本人skyeye的配置如下,boot则表示从RAM或者ROM中启动,没有直接skyeye -e u-boot则表示虚拟地址启动

# skyeye config file for S3C2410X
arch:arm
cpu: arm920t
mach: s3c2410x #physical memory #从rom启动 mem_bank: mem=M, type=R, addr=0x00000000, size=0x04000000, file=./u-boot.bin, boot=yes
#从ram启动 mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000, file=./u-boot.bin, boot=yes #从虚拟地址启动
mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000
# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000 # dbct:state=on<br>

(十一) U-boot源代码调试

进入skyeye文件夹,用-d命令启动skyeye

终端输入命令:sudo skyeye –c  skyeye.conf –d

skyeye 将进入debug模式在TCP:12345端口等待gdb连接,u-boot程序运行到第一条指令0x33f8000处暂停

配置arm-linux-insight

按如下图所示:

打开文件:File-》Open

File-》Target Settings

 

如上图在0x33f80000 处设置断点(红色)

然后连接目标

Run-》Connect to target

如上图显示程序运行到0x33f80000 处(绿色)

按下Ctrl+R 将显示寄存器窗口,可以观察当前各Register的值,如下图

按下N程序将跳到reset 处如下图

我们在board.c start_armboot 入口处设置断点然后按下C键程序将在start_armboot入口处暂停

如上图所示我们可以对u-boot进行断点,单步跟踪调试。

此篇文章是我在上海出差期间,闲暇之余做的总结,因为涉及的方面比较多,很多地方介绍不详细,可能会有很多错误,仅做为有兴趣用Skyeye搭建仿真开发环境的朋友提供参考。我觉得这一平台很适合那些想学习嵌入式开发的同学,在没有硬件的情况下不妨以此为出发点。既然现在可以调试u-boot,那我想应该也可以调试操作系统吧,比如可以从ucosii开始。

关于如何解决错误,在试验过程中在所难免出现这样那样的错误,我碰到了许多问题,有编译器版本问题,有缺少库文件的问题,以及一些源码有错误的地方。出现问题最好的方法不是马上发帖去问,应该把终端输出的错误信息中最重要的部分copy下来到百度里去搜索下,很有可能你遇到的问题已经有人遇到过且已经有解决方法。我觉得大部分问题是都可以找到答案的。

最后一点,虽然本文也借鉴了许多人的帖子,但毕竟也是辛苦总结出来的,希望转载的朋友注明出处,也算是对别人辛苦成果的一种肯定吧。

VMware+Ubuntu8.10+Skyeye+gdb实现u-boot源码调试的更多相关文章

  1. # 曹工说Spring Boot源码(10)-- Spring解析xml文件,到底从中得到了什么(context:annotation-config 解析)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  2. 曹工说Spring Boot源码系列开讲了(1)-- Bean Definition到底是什么,附spring思维导图分享

    写在前面的话&&About me 网上写spring的文章多如牛毛,为什么还要写呢,因为,很简单,那是人家写的:网上都鼓励你不要造轮子,为什么你还要造呢,因为,那不是你造的. 我不是要 ...

  3. 曹工说Spring Boot源码(2)-- Bean Definition到底是什么,咱们对着接口,逐个方法讲解

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码系列开讲了(1)-- Bean Definition到底是什么,附spring思维导图分享 工程代码地址 思维导图地址 工程结构图: 正 ...

  4. Spring Boot源码中模块详解

    Spring Boot源码中模块详解 一.源码 spring boot2.1版本源码地址:https://github.com/spring-projects/spring-boot/tree/2.1 ...

  5. 曹工说Spring Boot源码(11)-- context:component-scan,你真的会用吗(这次来说说它的奇技淫巧)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  6. 曹工说Spring Boot源码(12)-- Spring解析xml文件,到底从中得到了什么(context:component-scan完整解析)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  7. 曹工说Spring Boot源码(13)-- AspectJ的运行时织入(Load-Time-Weaving),基本内容是讲清楚了(附源码)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  8. 曹工说Spring Boot源码(14)-- AspectJ的Load-Time-Weaving的两种实现方式细细讲解,以及怎么和Spring Instrumentation集成

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  9. 曹工说Spring Boot源码(15)-- Spring从xml文件里到底得到了什么(context:load-time-weaver 完整解析)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

随机推荐

  1. 马士兵 Servlet & JSP(1) Servlet (源代码)

    1.HTTP协议基础测试(获取页面源代码) import java.io.BufferedReader; import java.io.IOException; import java.io.Inpu ...

  2. js bom中浏览器兼容问题判断代码

    var btn = document.getElementById('d1');if(addEventListener===undefined){ btn.attachEvent('onclick', ...

  3. javaweb文件下载

    最近搞了一下struts文件上传下载了,一个是通过struts自带的类实现的下载方法,一个是通用的下载方法: struts实现: FileDownloadAction.java package com ...

  4. Android播放音频的两种方式

    一种使用MediaPlayer,使用这种方式通常是播放比较长的音频,如游戏中的背景音乐. 代码如下: private MediaPlayer mPlayer = null; mPlayer = Med ...

  5. storm启动流程

    email:chenguibin2004@126.com storm: 是一个分布式的实时流式计算框架,具有低延迟.高可用.分布式.可扩展.数据不丢失的特点, storm包含四个核心组件: Nimbu ...

  6. Gstreamer 中的playback插件

    1. PLAYBACK插件基本介绍 在早期的版本中同时存在playbin和playbin2,但是在最新的版本中,playbin2已经稳定,取代了playbin, playbin不再进行维护.下面是官网 ...

  7. XML基本知识

    一.xml简介 1.xml(可扩展标记语言),是一种标记语言,类似于html,其作用主要是传输数据,并非显示数据! 2.xml标签没有被预定义需要用户自行定义. 3.xml由w3c组织发布,遵循200 ...

  8. IOS网络开发实战(一)

      1 局域网群聊软件 1.1 问题 UDP协议将独立的数据包从一台计算机传输到另外一台计算机,但是并不保证接受方能够接收到该数据包,也不保证接收方所接收到的数据和发送方所发送的数据在内容和顺序上是完 ...

  9. CentOS磁盘分区、格式化并挂载外置存储的方法

    1.划分外置存储主分区: 假设该外置存储在linux系统中被识别为/dev/sdb,使用fdisk /dev/sdb进入分区工具操作界面. 按p键打印当前外置存储分区情况,如果显示为空,则表示此外置存 ...

  10. CSS3 中的按钮效果与进度条

    效果如图