|
最近想学习给U-BOOT添加Nand Flash启动的支持。之前在网上搜了不少资料,但u-boot及skseye的版本都比较老,属于老皇历帖了 (U-boot V1.1.4、skyeye V1.2.2)
于是想在当前新版本之下来添加U-boot对Nand Flash的支持(u-boot V1.3.4、skyeye V1.2.5),在前人的基础上举一反三,与时俱进
但是经实践发现,skyeye模拟的s3c2410 nand controller似乎并不是完全忠实于硬件
具体实验如下:
[root@localhost s3c2410]# /opt/skyeye/bin/skyeye -h
SkyEye 1.2.5
......
[root@localhost s3c2410]# ls
skyeye.conf src u-boot-1.3.4 u-boot.bin u-boot.nand
[root@localhost s3c2410]# cat skyeye.conf
cpu:arm920t
mach: s3c2410x
# physical memory
mem_bank:map=M, type=RW, addr=0x00000000, size=0x00020000, file=u-boot-1.3.4/u-boot.bin, boot=yes # 64K
mem_bank:map=M, type=RW, addr=0x30000000, size=0x0f000000
# I/O mapping area
mem_bank:map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank:map=I, type=RW, addr=0x19000300, size=0x00000020
#net: type=cs8900a, base=0x19000300, size=0x20, int=9, mac=08:00:3E:26:0A:5B, ethmod=tuntap, hostip=10.0.0.1
#lcd:state=on,type=s3c2410x, mod=gtk
nandflash: type=s3c2410x, name=K9F1208U0B, dump=./uboot.nand
[root@localhost s3c2410]# /opt/skyeye/bin/skyeye -d
**************************** 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 0x8067224
nandflash: dump ./uboot.nand
file size:69206016
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM u-boot-1.3.4/u-boot.bin
debugmode= 1, filename = skyeye.conf, server TCP port is 12345
(另一个终端起gdb)
[root@localhost s3c2410]# arm-linux-gdb
GNU gdb Red Hat Linux (6.3.0.0-1.21_3rh)
Copyright 2004 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 conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-redhat-linux --target=arm-linux".
The target architecture is set automatically (currently arm)
(gdb) target remote 127.0.0.1:12345
Remote debugging using 127.0.0.1:12345
0x00000000 in ?? ()
(此时skyeye的终端输出)
Remote debugging using host:12345
(gdb终端继续)
(gdb) x/4w 0x4e000000 //0x4e00 0000也就是NFCONF寄存器
0x4e000000: 0xffffff00 0xffffff00 0xffffff00 0xffffff00
(gdb) p *0x4e000000=0x1006 //往NFCONF寄存器写入初始值,TACLS=1、TWRPH0=0、TERPH1=0、AdvFlash=0、PageSize=1、AddrCycle=1、BusWidth=0
$1 = 0xffffff06
(gdb) x/4w 0x4e000000 //再次读取NFCONF,只有低8位被有效写入
0x4e000000: 0xffffff06 0xffffff00 0xffffff00 0xffffff00
(此时skyeye的终端输出)
ERROR: s3c2410x_io_write_word(0x4e000001) = 0x00000010
ERROR: s3c2410x_io_write_word(0x4e000002) = 0x00000000
ERROR: s3c2410x_io_write_word(0x4e000003) = 0x00000000
此实验说明了skyeye模拟的NandFlash Controller的NFCONF寄存器仅有低8位可写,其余高位字节全都不可写入。(CPU UM上此为32位寄存器)
经全面测试,还有NFCONT同样只能写低8位。用作ECC校验的NFMECCD0、NFMECCD1、NFSECCD更是彻底不可读写。
综上,故有此一问。
望达人或nand模拟实现者给与指点。 |
|