分类:
2010-06-10 14:47:15
原开发板是256M的NANDFLASH,目的是想用一个64M的nandflash,并且从nandflash启动。
主要是对bootstraps修改,修改地方如下:(以百特光盘自带的AT91Bootstrap1.2为例)
1:AT91Bootstrap1.2/include/nand_ids.h中的增加两行
{0xecf1, 0x400, 0x20000, 0x800, 0x40, 0x0, "Samsung K9F1G08U0M 128Mb\0"},
{0xec76, 0x1000, 0x4000, 0x200, 0x10, 0x0, "Samsung K9F12808u0b 64Mb\0"},
即变成:
/* Supported NandFlash devices */
static struct SNandInitInfo NandFlash_InitInfo[] = {
{0xecda, 0x800, 0x20000, 0x800, 0x40, 0x0, "Samsung K9F2G08U0M 256Mb\0"},
{0xecf1, 0x400, 0x20000, 0x800, 0x40, 0x0, "Samsung K9F1G08U0M 128Mb\0"},
{0xec76, 0x1000, 0x4000, 0x200, 0x10, 0x0, "Samsung K9F12808u0b 64Mb\0"},
{0x2cca, 0x800, 0x20000, 0x800, 0x40, 0x1, "Micron MT29F2G16AAB 256Mb\0"},
{0,}
};
2即增加了支持三星的128M,64M的两款nandfalsh。
到此128M的nandflash可完全支持了。因为128M和256M的nandflash读写调用函数是一个。但要注意烧写128M的时候还要对SAM-BA2.5 里的lib/AT91SAM9260-ek/NANDFLASH.tcl中增加支持128M的nandflash,要不SAM-BA2.5无法发现nandflash,具体修改为(红色部分为后加)
switch $devID {
"ca" {set nf(nandNbBlocks) 0x800
set nf(nandBlockSize) 0x20000
set nf(nandSectorSize) 0x800
set nf(nandSpareSize) 0x40
set nf(nandBusWidth) 1
set nf(monitorName) "SAM-BA-nand.bin"
puts "-I- NandFlash $manName 16 bits 256MB"}
"f1" {set nf(nandNbBlocks) 0x400
set nf(nandBlockSize) 0x20000
set nf(nandSectorSize) 0x800
set nf(nandSpareSize) 0x40
set nf(nandBusWidth) 0
set nf(monitorName) "SAM-BA-nand.bin"
puts "-I- NandFlash $manName 8 bits 128MB"}
"da" {set nf(nandNbBlocks) 0x800
set nf(nandBlockSize) 0x20000
set nf(nandSectorSize) 0x800
set nf(nandSpareSize) 0x40
set nf(nandBusWidth) 0
set nf(monitorName) "SAM-BA-nand.bin"
puts "-I- NandFlash $manName 8 bits 256MB"}
"76" {set nf(nandNbBlocks) 0x1000
set nf(nandBlockSize) 0x4000
set nf(nandSectorSize) 0x200
set nf(nandSpareSize) 0x10
set nf(nandBusWidth) 0
set nf(monitorName) "SAM-BA-nand-small.bin"
puts "-I- NandFlash $manName 8 bits 64MB"}
default {puts stderr "-E- NandFlash not supported..."
return}
}
3而这样64M的nandflash的修改还没有完成,其实从以上的"SAM-BA-nand.bin"和 "SAM-BA-nand-small.bin"也可以看出,512M,256M,128M的对FLASH操作是调用同一BIN文件,而64M以下的就不同。同理在Bootstraps 里的对大容量,小容量的nandflash读写也都不一样的。可从AT91Bootstrap1.2/driver/nandflash.c中看出。
#ifdef NANDFLASH_SMALL_BLOCKS
/*------------------------------------------------------------------------------*/
/* \fn AT91F_NandReadSector */
/* \brief Read a Sector */
/*------------------------------------------------------------------------------*/
BOOL AT91F_NandReadSector(PSNandInfo pNandInfo, unsigned int uSectorAddr, char *pOutBuffer, unsigned int fZone)
。。。。。。。。。。
。。。。。。。。。。
。。。。。。。。。。
#else /* NANDFLASH_LARGE_BLOCKS */
/*------------------------------------------------------------------------------*/
/* \fn AT91F_NandReadSector */
/* \brief Read a Sector */
/*------------------------------------------------------------------------------*/
static BOOL AT91F_NandReadSector(PSNandInfo pNandInfo, unsigned int uSectorAddr, char *pOutBuffer, unsigned int fZone)
这两个相同的函数就是分别对64M (NANDFLASH_SMALL_BLOCKS)和256M(NANDFLASH_LARGE_BLOCKS)的NANDFLASH操作的函数。调用哪个函数就看你对NANDFLASH_SMALL_BLOCKS是否定义了。因此我们在头文件AT91Bootstrap1.2/board/at91sam9260ek/nandflash/at91sam9260ek.h中将
#undef NANDFLASH_SMALL_BLOCKS /* NANDFLASH_LARGE_BLOCKS used instead */
语句改称#define NANDFLASH_SMALL_BLOCKS /* NANDFLASH_LARGE_BLOCKS used instead */即此定义成小容量模式。
到此bootstraps的修改已完成。
注:1如果此时编译后的bootstraps比较大,而烧写进FLASH后打印不正常,可考虑去掉打印信息,即在AT91Bootstrap1.2/board/at91sam9260ek/nandflash/at91sam9260ek.h中 将#undef CFG_DEBUG写入,屏蔽//#define CFG_DEBUG。
2 {0xecf1, 0x400, 0x20000, 0x800, 0x40, 0x0, "Samsung K9F1G08U0M 128Mb\0"},
0xecf1:ID
0x400:Nbblocks
0x20000:Blocksize
0x800:SectorSize
0x40:SpareSize
0x0:Buswidth