1、ARM开发 在skyeye上运行uClinux在skyeye上运行uC/OS和uClinux step by step一、基本概念的介绍 首先介绍一下什么是uClinux,uc/OS和skyeye uC/OS是一种免费公开源代码、结构小巧、具有可剥夺实时内核的实时操作系统。其内核提供任务调度与管理、时间管理、任务间同步与通信、内存管理和中断服务等功能。 uClinux是一种优秀的嵌入式linux版本。uClinux是micro-conrol-linux的缩写。同标准linux相比,它集成了标准linux操作系统的稳定性、强大网络功能和出色的文件系统等主要优点。但是由于没有mmu(内存管理单元)
2、,其多任务的实现需要一定技巧。 SkyEye是一个开源软件(opensource software)项目,中文名字是“天目”。SkyEye的目标是在通用的Linux和Windows平台实现一个仿真集成开发环境,模拟常见的嵌入式计算机系统(目前支持基于arm7tdmi的AT91开发板);可在SkyEye上运行uclinux以及uC/OS-II等多种嵌入式操作系统,并对它们进行源码级的分析和测试。 二、测试环境及其软件的下载 本文的所有操作都是在RedHat 9.0上进行的。 1、uClinux-dist-20041215.tar.gz (http:/www.uclinux.org/) 2、arm
3、-elf-tools-20030314.sh (编译uClinux的交叉编译器http:/www.uclinux.org/) 3、skyeye-0.9.8.tar.bz2 (http:/gro.clinux.org/frs/?group_id=327&release_id=840) 4、ucosii4skyeye-1.9.3.tar.gz (http:/gro.clinux.org/frs/?group_id=327&release_id=716) 下载后的软件均放在/tmp/embed的目录下 三、安装软件及其使用 1、skyeye的安装 Code:cd /tmp/embed tar -jv
4、xf skyeye-0.9.8.tar.bz2 cd skyeye ./configure -target=arm-elf -prefix=/usr/local/ -without-gtk-prefix -without-gtk-exec-prefix -disable-gtktest 如果机器上没有安装gtk的开发包,那么就需要加入大括弧之间的选项 Code:make; make install 2、arm-elf-tools 的安装 所有的交叉编译工具都在arm-elf-tools-20030314.sh文件中,执行下面的命令后将安装在/usr/local/bin目录下 Code:./ar
5、m-elf-tools-20030314.sh 3、ucosii4skyeye-1.9.3.tar.gz Code:cd /tmp/embed export CROSS_COMPILE=/usr/local/bin/arm-elf- 或者把以上的命令加入/.bash_profile文件里 然后运行 su your_login_name -login Code:tar -zvxf ucosii4skyeye-1.9.3.tar.gz 在没有编译之前先修改一下lib/skyeye_printf.c文件,不然在编译samples时会出现如下错误: Quote:skyeye_printf.o: In
6、function getnum: /root/src/skyeye/ucosii4skyeye/samples/ucos_test/././lib/skyeye_printf.c:118: undefined reference to isdigit skyeye_printf.o: In function skyeye_printf: /root/src/skyeye/ucosii4skyeye/samples/ucos_test/././lib/skyeye_printf.c:164: undefined reference to isdigit make: * ucos_test.elf
7、 Error 1 (不知道在其他的系统中有没有这个Bug,我在RH9上测试时出现了这个问题),把以下代码加入skyeye_printf.c文件中 Code:static int isdigit(char ch) if (ch = 0 & ch = 9) return 1; return 0; 然后把该文件中的#include 这一行注释掉。 保存退出进入ucosii4skyeye/samples/ucos_test目录 Code:cd ucosii4skyeye/samples/ucos_test make cleanall make config make dep make make tes
8、t 进入(SkyEye)后,运行 Code:target sim load r 如果读者看到了如下的界面: Quote:skyeye ucos_test.elf * * * * SkyEyeSimulator Ver 0.9.8 withGDB/Insight 5.3 Interface * * * * GNU gdb 5.3 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to c
9、hange 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 SkyEye was configured as -host=i686-pc-linux-gnu -target=arm-elf. (SkyEye) target sim cpu info: armv3, arm7tdmi, 410
10、07700, fff8ff00, 0 mach info: name at91, mach_init addr 0x8161574 SKYEYE: use arm7100 mmu ops Connected to the simulator. (SkyEye) load Loading section .text, size 0x7660 vma 0x1000000 Loading section .data, size 0x205c vma 0x1008000 Start address 0x1000000 Transfer rate: 308704 bits in hello world.
11、! ;) Task2 running. Your input string: hello world.! ;) pParam is 16814060Task1 running. Please input a string: 恭喜你,你成功了,剩下的问题就是用skyeye深入的去熟悉ucos,理解它的内部结构并写出自己程序。 除了这一个ucos_test以外,在samples目录下还有其他的ucos的测试目录,其中lwip_on_ucos_test时作者把lwip移植到了ucos里面(ucos本身并不带协议栈),有兴趣的朋友可以试试,编译它的命令与编译ucos_test的一样。 4、uclinu
12、x的安装和使用 1、安装 Code:cd /tmp/embed tar -zvxf uClinux-dist-20041215.tar.gz cd uClinux-dist make xconfig 在Target Platform Selection中选择GDB/skyeye,内核选择linux-2.4.x 如下图1所示 图1、uClinux Config选项 Code:make dep make 在当前目录下建立仿真AT91的skyeye配置文件 skyeye.conf,内容如下: Quote:cpu: arm7tdmi mach: at91 mem_bank: map=M, type=R
13、W, 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=images/romfs.img mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000 mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000 mem_ba
14、nk: map=M, type=RW, addr=0x04000000, size=0x00400000 mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000 #set nic info state=on/off mac=xx:xx:xx:xx:xx:xx ethmod=tuntap/vnet hostip=dd.dd.dd.dd net: state=on, mac=0:4:3:2:1:f, ethmod=tun, hostip=10.0.0.1 2、使用 Code:skyeye linux-2.4.x/linux target
15、 sim load r 结果如下所示: Quote:* * * * SkyEyeSimulator Ver 0.9.8 withGDB/Insight 5.3 Interface * * * * GNU gdb 5.3 Copyright 2002 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 c
16、onditions. Type show copying to see the conditions. There is absolutely no warranty for GDB.Type show warranty for details. This SkyEye was configured as -host=i686-pc-linux-gnu -target=arm-elf. (SkyEye) target sim cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0 mach info: name at91, mach_init addr
17、 0x8161574 nic0 info: state=1, ethmod num=1, mac addr=0:5:3:2:1:f, hostip=192.168.2.1 nic_init_begin tapif_init begin tapif_init: fd 6 tapif_init: system(ifconfig tap0 inet 192.168.2.1); tapif_init end nic_init_end SKYEYE: use arm7100 mmu ops Loaded ROM ./romfs.img Connected to the simulator. (SkyEy
18、e) load Loading section .init, size 0xa000 vma 0x1000000 Loading section .text, size 0xe0e90 vma 0x100a000 Loading section .data, size 0xa594 vma 0x10ec000 Start address 0x1000000 Transfer rate: 4018320 bits/sec. (SkyEye) r Starting program: /root/src/skyeye/uclinux/linux Linux version 2.4.27-uc1 (r
19、ootTEST) (gcc version 2.95.3 20010315 (release)(Cold Fire patches - 20010318 from XIP and shared lib patches from #2 Fri Aug 5 15:13:59 CST 2005 Processor: Atmel AT91M40xxx revision 0 . . . Shell invoked to run file: /etc/rc Command: hostname GDB-ARMulator Command: /bin/expand /etc/ramfs.img /dev/ra
20、m0 Command: mount -t proc proc /proc mount: /etc/mtab: Read-only file system Command: mount -t ext2 /dev/ram0 /var mount: /etc/mtab: Read-only file system Command: mkdir /var/tmp Command: mkdir /var/log Command: mkdir /var/run Command: mkdir /var/lock Command: mkdir /var/empty Command: cat /etc/motd
21、 Welcome to _ _ /_| |_| _ _| | | _ _ _ | | | | | | |_ | | | | / / | |_| | |_| | | | | | |_| |/ |_|_|_|_| |_|_|_/_/ | | |_| GDB/ARMulator support by For further information check: http:/www.uclinux.org/ Command: /bin/ifconfig eth0 up 10.0.0.2 Execution Finished, Exiting Sash command shell (version 1.
22、1.1) / ps PID PORT STATSIZE SHARED %CPU COMMAND 1S 150K 0K5.0 /sbin/init 2S 0K 0K0.0 keventd 3S 0K 0K0.0 ksoftirqd_CPU0 4S 0K 0K0.0 kswapd 5S 0K 0K0.0 bdflush 6S 0K 0K0.0 kupdated 12 S0 R44K 0K6.0 /bin/sh 13S22K 0K3.0 /bin/inetd / 3、在uclinux里面添加自己的应用程序 先写一个hello world!的程序 Code:#include int main() pr
23、intf(welcome to uclinux world!n); 编译hello.c, Code:arm-elf-gcc -Wl,elf2flt hello.c -o hello 把hello 拷贝到romfs/bin目录下 接着运行 Code:make romfs make image 再按2的方法运行一次 然后执行hello, 看到welcome to uclinux world!了吧. 往uclinux里面加入程序还有另外一种方发,不过那种方法很繁琐,这里就不介绍了, 有兴趣的朋友参考uclinux-dist/Documentation/Adding-User-Apps-HOWTO文件
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1