ubuntu 8.04中skyeye仿真项目的开发环境的建立

网上流传很多文章,但大多数重复杂乱。致使我浪费了好多时时间。
为此,记录我整个安装过程,一来方便自已,二来方便大家。
好了,不罗嗦了,正文开始:
1.在ubuntu中安装skyeye最简单不过,一个命令搞定:
  sudo apt-get install skyey
安装完成后运行skeye,显示如下:


**************************** 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.
***********************************************************************

big_endian is false.
Failed to open skyeye config file skyeye.conf in the same directory
error: No such file or directory
------------------------- SkyEye -V1.2 ---------------------------
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
lpc2210
ps7500
integrator
-------- BlackFin architectures ----
bf533


出现此界面说明安装成功.

     网上有人总是提问,说:不是出现这个界面说明安装不正常吗,只有出现这个界面时才是安装成功能:

GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
(gdb)
这纯粹是误人子弟.我刚开如也以为安装不成功,找了好多文章.发现并没有人去解这个问题.后来仔细看了skeyey的相关资料,发现这是正常现象.一些人只是断章取义,才有此说,希望大家注意。

2.下载skyeye-binary-testutils-1.2.0进行测试:
我以我的测试过程为例:
在$HOME目录下新建一个文件夹:mkdir skyeye_test
然后解压skyeye-binary-testutils-1.2.0.里面有好多bin code.
选择/skyeye-binary-testutils-1.2.0/at91x40/uclinux1
运行$skyeye ,出现如下界面,是不是很cool:

Welcome to
          ____ _  _
         /  __| ||_|                
    _   _| |  | | _ ____  _   _  _  _
   | | | | |  | || |  _ /| | | |/ // /
   | |_| | |__| || | | | | |_| |/    /
   |  ___/____|_||_|_| |_|/____|/_//_/
   | |
   |_|

GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/

Command: /bin/ifconfig eth0 up 10.0.0.2
Execution Finished, Exiting

3.接下来安装cross tool chain.安装文件比较难下载.
uclinux网站的速度简直是牛速.
我是在以下网站下载的,速度还可以,大家可发试一试:

http://opensrc.sec.samsung.com/download.html
下载后,运行:
sudo sh ./ arm-uclinux-tools-base-gcc3.4.0-20040713.sh
可能会出现错误,只需修改一下即可.

tail +${SKIP} ${SCRIPT} | bunzip2 | tar xvf -
修改为:
tail -n +${SKIP} ${SCRIPT} | bunzip2 | tar xvf -
默认安装完后,已在系统命令search 路径.
在shell中输入arm-elf-,按TAB,应会出现选择提示:arm-efl-g++,arm-elf-gcc.
说明安装完成一大步.

接下来测试cross tool chain是否能够正常编译.
转其它网友的,我试过了,是可以的.

先写一个小程序hello.c

srccode 代码:
#include <stdio.h>

int main ( void )
{
    
int i ;

    for(
i = 0 ; i < 6 ; i ++){

        
printf ( "i = %d  " , i );

        
printf ( "Hello, embedded linux!/n" );
    }

    return
0 ;
}
然后执行:

arm-elf-gcc -Wl,-elf2flt -o hello hello.c

-elf2flt参数是将elf文件格式转为flat文件格式,这个工具是在你安装交叉编译器产生的。

或者你可以写个Makefile文件,执行:

make

这里是我的Makefile文件,仅供参考:
makefile代码:
# begin

CC = arm - elf - gcc

CFLAGS
= - D__PIC__ - fpic - msingle - pic - base - O2 - pipe - Wall - g
LDFLAGS
= - Wl ,- elf2flt

LIBS
=
OBJS = hello . o

all
:     hello

hello
:  $( OBJS )
        $(
CC ) $( CFLAGS ) $( LDFLAGS ) - o hello $( OBJS ) $( LIBS )

clean :
        
rm - rf *. o *. elf *. gdb hello

# end
如果编译通过,就会产生hello可执行文件。用下面的命令:

file hello

你会发现,它是BFLT(binary FLAT),你目标平台所支持的文件格式。

这里,我们将借助genromfs这个小工具来完成测试,这个工具就是你在安装交叉编译器时产生的,你可以直接使用它。

http://gro.clinux.org/projects/skyey...-1.0.4.tar.bz2 包:

//================================
我试过此链接不可用,不过ubuntu用可直接sudo来安装.
//================================

tar jxvf skyeye-binary-testutils-1.0.4.tar.bz2

cd testsuits/at91/uclinux2(当然你还可以用别的)

mkdir romfs(建一个目录,后面用)

mount -o loop boot.rom /mnt/xxx

cp -r /mnt/xxx/* romfs

另外,把你编译好的可执行程序拷贝到/romfs/bin目录里,这里就是hello了!

genromfs -f boot.rom -d romfs/

注:可以用genromfs -h来获得帮助!

OK!执行下面的命令:

skyeye linux

(skyeye)target sim

(skyeye)load

(skyeye)run

kernel start.....

很熟悉了吧。。。

cd /bin

hello

可以看到结果了吗?

其实到了这一步,你就可以开发自己的程序了!


/************************************************************/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值