免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2199 | 回复: 2
打印 上一主题 下一主题

at91sam9260ek修改nandflash大小调试笔记 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-13 17:17 |只看该作者 |倒序浏览


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


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/41638/showart_1190615.html

论坛徽章:
0
2 [报告]
发表于 2013-07-08 13:54 |只看该作者
好东西!谢谢分享!

论坛徽章:
0
3 [报告]
发表于 2013-07-18 23:49 |只看该作者
更改nandflash仅仅在bootstrap里修改是不够的,第二级的bootloader里你依旧要修改。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP