一.搭建arm开发测试环境1.下载arm-elf-tools-20030314.sh从uClinux.org
2.执行$sudo sh arm-elf-tools-20030314.sh安装arm交叉编译环境,可通过终端下输入arm-elf-gcc
-v检验是否安装好了3.在源里下载安装skyeye
arm的模拟环境$sudo apt-get install skyeye安装好后,可在终端下输入skyeye,检验是否安装好了二.使用开发工具编写helloworld.c放在~/Program/Arm/路径下/*--helloworld.c--*/
#include
int main()
{
printf("Hello
World! embedded linux! ");
return
0;
}编译程序:$arm-elf-gcc
-Wl,-elf2flt -o helloworld helloworld.c将产生两个文件:$ls
helloworld
helloworld.c
helloworld.gdb其中命令中-elf2flt参数是将文件格式转换为flat文件格式也可用命令编译生成汇编代码:arm-elf-gcc
-S -o helloworld.s
helloworld.c三.测试这个程序:需要用到工具skyeye-testsuits下载skyeye-binary-testutils-1.2.0.tar.bz2解压缩:$tar
jxvf skyeye-binary-testutils-1.2.0.tar.bz2进入目录:
$cd
skyeye-binary-testutils-1.2.0/at91x40/uclinux2
$ls
boot.rom
linux readme
skyeye.conf这个目录里有四个文件,其中linux就是内核镜像,boot.rom是要写到Flash里面去的,里面包含文件系统。skyeye.conf是配置文件。终端下键入:$skyeye
-e linux呵呵,看到了吧,感觉不错吧____ _ _
/ __| ||_|
_
_| | | | _ ____ _ _ _ _
| | | | | | || | _ | | | | /
/
| |_| | |__| || | | | | |_| |/
| ___/____|_||_|_|
|_|/____|/_//_/
| |
|_|建立目录romfs/用来倒boot.rom里的文件和helloworld程序$mkdir
romfs建立挂载目录tmp,并挂载boot.rom,然后拷贝文件到romfs中$mkdir
tmp
$sudo mount -o loop boot.rom ./tmp/
$sudo cp -r tmp/*
romfs/
$umount tmp进入romfs/可以看到:$cd
romfs
$ls
bin dev etc home lib mnt proc sbin tmp usr
var
$cd ..把helloworld放到bin/目录下:$sudo
cp ~/Promgram/Arm/helloworld
romfs/bin/用genromfs这个工具重新制作文件系统,再运行$sudo
genromfs -f boot.rom -d romfs/
$skyeye -e
linux
....
/>helloworld
Hello World! embedded
linux!
/>四.手动编译uClinux内核下载uClinux的源码包:uClinux-dist-200701030.tar.gz放在目录如~/uclinux/下解压缩uClinux-dist-20071030.tar.gz
:
$tar -zvxf
uClinux-dist-20071030.tar.gz产生uClinux-dist目录需要安装ncurses开发包libncurses5-dev
$sudo
apt-get install libncurses5-dev这里还需要修改一下:$cd
uClinux-dist
$gedit
vendors/config/armnommu/config.arch将CROSS-COMPILER
= arm-linux-改为CROSS-COMPILER
= arm-elf-配置编译内核:$make
manuconfig选择GDB/ARMulator,kernel2.4,ucLibc
$make
dep
...
$make
...进入images/创建配置文件skyeye.conf
$cd
images
$gedit skyeye.conf加入以下内容:#skyeye
config file sample
cpu: arm7tdmi
mach: at91
mem_bank:
map=M, type=RW, addr=0x00000000, size=0x00004000
mem_bank: map=M,
type=RW, addr=0x01000000, size=0x00400000
mem_bank: map=M, type=R,
addr=0x01400000, size=0x00400000, file=./boot.rom
mem_bank:
map=M, type=RW, addr=0x02000000, size=0x00400000
mem_bank: map=M,
type=RW, addr=0x02400000, size=0x00008000
mem_bank: map=M,
type=RW, addr=0x04000000, size=0x00400000
mem_bank: map=I,
type=RW, addr=0xf0000000, size=0x10000000如果images/里不是boot.rom而是romfs.img则将文件里的boot.rom改为romfs.img运行:$skyeye
-e linux就可以看到熟悉的界面了