`
soboer
  • 浏览: 1311522 次
文章分类
社区版块
存档分类
最新评论

如何在ubuntu下搭建arm的集成开发环境

 
阅读更多

<!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } -->

.搭建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 <stdio.h>

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

就可以看到熟悉的界面了

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics