AT91sam9260ek修改nandflash大小调试笔记

原开发板是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"},

      {0xecaa, 0x800, 0x20000, 0x800, 0x40, 0x0, "Samsung K9F2G08U0A 256Mb/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

 

 原文地址 http://shengming217.spaces.live.com/blog/cns!FDDA41F01A701B9C!155.entry?wa=wsignin1.0
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值