Chinaunix首页 | 论坛 | 博客
  • 博客访问: 947089
  • 博文数量: 214
  • 博客积分: 10173
  • 博客等级: 上将
  • 技术积分: 1867
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-18 13:48
文章分类

全部博文(214)

文章存档

2012年(1)

2010年(13)

2009年(5)

2008年(98)

2007年(97)

分类: LINUX

2008-09-13 17:17:26

 

原开发板是256M的NANDFLASH,目的是想用一个64Mnandflash,并且从nandflash启动。

 主要是对bootstraps修改,修改地方如下:(以百特光盘自带的AT91Bootstrap1.2为例)

 1AT91Bootstrap1.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即增加了支持三星的128M64M的两款nandfalsh

到此128Mnandflash可完全支持了。因为128M256Mnandflash读写调用函数是一个。但要注意烧写128M的时候还要对SAM-BA2.5 里的lib/AT91SAM9260-ek/NANDFLASH.tcl中增加支持128Mnandflash,要不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而这样64Mnandflash的修改还没有完成,其实从以上的"SAM-BA-nand.bin" "SAM-BA-nand-small.bin"也可以看出,512M256M128M的对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)和256MNANDFLASH_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"},

0xecf1ID

0x400Nbblocks

0x20000Blocksize

0x800SectorSize

0x40SpareSize

0x0Buswidth

阅读(2191) | 评论(0) | 转发(0) |
0

上一篇:FPGA学习点滴积累

下一篇:工作总结(一)

给主人留下些什么吧!~~