裸机移植yaffs2文件系统

裸机移植yaffs2演示
 
Linux系统上
 
[fulinux@CentOS6 ~]$ cd yaffs2/
 
[fulinux@centos6 yaffs2]$ ls
 
bootstrap.c  bootstrap.lds  bsp  common  makefile  start.S  yaffs2
 
[fulinux@centos6 yaffs2]$ make
 
........................
 
........................
 
........................
 
[fulinux@centos6 yaffs2]$ ls
 
bootstrap.bin  bootstrap.c  bootstrap.lds  bootstrap.map  bsp  common  makefile  start.S  yaffs2
 
[fulinux@centos6 yaffs2]$
 

将bootstrap.bin文件拷贝到/tfpt目录下
 
s3c2440开发板上
 
[ s3c2440@guowenxue ]# set bstarp 'tftp 31000000 bootstrap.bin;go 31000000'
 
[ s3c2440@guowenxue ]# save
 
Saving Environment to NAND...
 
Erasing Nand...
 
Erasing at 0x60000 -- 100% complete.
 
Writing to Nand... done
 
[ s3c2440@guowenxue ]# run bstarp
 
dm9000 i/o: 0x20000300, id: 0x90000a46
 
DM9000: running in 16 bit mode
 
MAC: 08:00:3e:26:0a:6b
 
could not establish link
 
operating at 100M full duplex mode
 
Using dm9000 device
 
TFTP from server 192.168.1.2; our IP address is 192.168.1.111
 
Filename 'bootstrap.bin'.
 
Load address: 0x31000000
 
Loading: T ##############
 
done
 
Bytes transferred = 193924 (2f584 hex)
 
## Starting application at 0x31000000 ...
 

Bootstrap nandflash yaffs2 test Version 0.0.1
 
malloc memory space: 0x30f00000~0x31000000
 
Malloc address: 30f00008, string: Hello World!
 

Configures yaffs mount /nand: start block 16, end block 96
 
'/nand' mounted
 
Create directory [/nand/foo]
 
Create File [/nand/foo/f1] content: [foo/f1]
 
Create File [/nand/foo/f2] content: [foo/f2]
 
Create File [/nand/foo/f3] content: [foo/f3]
 
Create File [/nand/foo/f4] content: [foo/f4]
 
Create directory [/nand/bar]
 
Create File [/nand/bar/f1] content: [bar/f1]
 
List folder '/nand' with recursive:
 
drw- 1 /nand/bar 2048 bytes
 
-rw- 1 /nand/bar/f1 6 bytes
 
drw- 1 /nand/foo 2048 bytes
 
-rw- 1 /nand/foo/f4 6 bytes
 
-rw- 1 /nand/foo/f3 6 bytes
 
-rw- 1 /nand/foo/f2 6 bytes
 
-rw- 1 /nand/foo/f1 6 bytes
 
drw- 1 /nand/lost+found 2048 bytes
 
Remove /nand/foo/f4
 
Remove /nand/bar
 
List folder '/nand' with recursive:
 
drw- 1 /nand/foo 2048 bytes
 
-rw- 1 /nand/foo/f3 6 bytes
 
-rw- 1 /nand/foo/f2 6 bytes
 
-rw- 1 /nand/foo/f1 6 bytes
 
drw- 1 /nand/lost+found 2048 bytes
 
unmount and remount
 

List folder '/nand' with recursive:
 
drw- 1 /nand/lost+found 2048 bytes
 

代码分析
 
[fulinux@centos6 yaffs2]$ ls
 
bootstrap.bin  bootstrap.c  bootstrap.lds  bootstrap.map  bsp  common  makefile  start.S  yaffs2
 
[fulinux@centos6 yaffs2]$
 
先看看make后生成的bootstrap.map文件中主要的段:
 
Linker script and memory map startsize size
 
                0x0000000000000000                . = ALIGN (0x4)
 
(.stack xxxxxxxxxxxxxxxxxx          xxxx  运行时初始化这个段)
 
.text              0x0000000031000000    0x2c3dc
 
.rodata            0x000000003102c3dc      0x2c58
 
.data            0x000000003102f054        0x10
 
.bss            0x000000003102f588      0x36b4
 

其中代码段的第一个代码是start.S
 
start.S文件
 
/********************************************************************************************
 
 *        File:  start.S - Startup Code for ARM920 CPU-core
 
 *    Version:  1.0.0
 
 *  Copyright:  2011 (c) Guo Wenxue <guowenxue@gmail.com>
 
 * Description:  When system power up, the CPU will comes here to excute the first code here.
 
 *  ChangeLog:  1, Release initial version on "Tue Jul 12 16:43:18 CST 2011"
 
 *
 
 *******************************************************************************************/
 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/4be9678c1495a1085cea27b68226880c.html