一步一步写嵌入式操作系统----环境搭建

本文是《一步一步写嵌入式操作系统》的学习笔记。

书籍工具下载可参考:https://github.com/Joyounger/leeos

工具:skyeye 用于在linux上模拟开发板,书中使用的是s3c2410;ubuntu12.0+skyeye1.2.6

1.在ubuntu中安装skyeye1.2.6

2.配置skyeye.conf文件,文件和代码位于同级目录下

#cpu型号
cpu:arm920t
#平台
mach:s3c2410x
#物理内存配置
mem_bank:map=M,type=RW,addr=0x00000000,size=0x00800000,file=./helloworld.bin,boot=yes
mem_bank:map=I,type=RW,addr=0x48000000,size=0x20000000

3.测试代码

//串口寄存器,写入值以后会从屏幕输出
#define UFCONO ((volatile unsigned int *)(0x50000020))

void helloworld(void)
{
        const char *p = "helloworld\n";
        while(*p)
        {
                *UFCONO = *p++;
        }
        while(1);
}

4.编译

#编译文件,不加-O2参数会因为没有main函数报错
arm-elf-gcc -O2 -c helloworld.c

#将执行文件链接到0地址
arm-elf-ld -e helloworld -Ttext 0x0 helloworld.o -o helloworld

#将elf文件中的机器码拷贝出来
arm-elf-objcopy -O binary helloworld helloworld.bin

5.执行skyeye

root@ubuntu:/home/os/t1# 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.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2 
mach info: name s3c2410x, mach_init addr 0x806f9d0
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./helloworld.bin
helloworld

 

一步嵌入式操作系统 linux平台实现代码 step 0 准备开发环境 1 安装交叉编译工具 sudo apt-get install gcc-arm-none-eabi sudo apt-get install gcc-arm-linux-gnueabihf sudo apt-get install g++-arm-linux-gnueabihf 2 手边编译skyeye 用apt命令安装的skyeye模拟器版本(1.2.5)有bug,需要手动编译更高版本的skyeye 下载并解压skyeye 1.2.6_rc1的代码, ~/Downloads/skyeye-1.2.6_rc1 根据执行skyeye-1.2.6_rc1/INSTALL的说明 1 执行 ./configure 2 执行 make 后 编译错误1: In file included from /usr/include/fcntl.h:289:0, from nandflash/nandflash_smallblock.c:19: In function ‘open’, inlined from ‘nandflash_sb_setup’ at nandflash/nandflash_smallblock.c:519:24: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments __open_missing_mode (); 解决方法: 修改skyeye-1.2.6_rc1/device/nandflash/nandflash_smallblock.c 519行 if ((nf->fdump= open(dev->dump, FILE_FLAG)) < 0) 改为: if ((nf->fdump= open(dev->dump, FILE_FLAG, 0777)) < 0) 编译错误2: gcc -g -O2 -o skyeye skyeye.o ./utils/libutils.a ./arch/arm/libarm.a ./device/libdev.a ./arch/mips/libmips.a ./arch/ppc/libppc.a ./arch/bfin/libbfin.a ./arch/mips/libmips.a ./arch/coldfire/libcoldfire.a -lc ./utils/libutils.a -lbfd -lm -lc ./arch/mips/libmips.a(decoder.o):在函数‘decode’中: /home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:1079:对‘sign_extend_UInt32’未定义的引用 /home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:1105:对‘sign_extend_UInt32’未定义的引用 /home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:1049:对‘sign_extend_UInt32’未定义的引用 /home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:1027:对‘sign_extend_UInt32’未定义的引用 /home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:1013:对‘sign_extend_UInt32’未定义的引用 ./arch/mips/libmips.a(decoder.o):/home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:1001: 跟着更多未定义的参考到 sign_extend_UInt32 ./arch/mips/libmips.a(decoder.o):在函数‘decode’中: /home/kolya/Downloads/skyeye-1.2.6_rc1/arch/mips/common/decoder.c:240:对‘divide_UI
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值