/* timeout values are in ticks */ //#define CONFIG_ENV_IS_IN_FLASH 1 然后加入下列代码: /*-----------------------------------------------------------------------
【2】在mini2440.h里添加nand_flash相关宏定义
打开include/configs/mini2440.h,定位到98行附近,加入下列代码:
/*
* Command line configuration.
*/
#include
#define CONFIG_CMD_CACHE
#define CONFIG_CMD_DATE
#define CONFIG_CMD_ELF
#define CONFIG_CMD_NAND
#define CONFIG_CMD_JFFS2 /* JFFS2 Support*/
... ...
在文件末尾处加入下列代码:
/*-----------------------------------------------------------------------
* NAND flash settings
*/
#if defined(CONFIG_CMD_NAND)
#define CONFIG_NAND_S3C2410
#define CONFIG_SYS_NAND_BASE 0x4E000000
#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */
#define SECTORSIZE 512
#define SECTORSIZE_2K 2048
#define NAND_SECTOR_SIZE SECTORSIZE
#define NAND_SECTOR_SIZE_2K SECTORSIZE_2K
#define NAND_BLOCK_MASK 511
#define NAND_BLOCK_MASK_2K 2047
#define NAND_MAX_CHIPS 1
#define CONFIG_MTD_NAND_VERIFY_WRITE
#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */
#endif /* CONFIG_CMD_NAND */
#define CONFIG_S3C2410_NAND_SKIP_BAD 1
3.5,重新编译,按上面3.3中方法下载,运行结果如下:
Enter your selection: ?
U-Boot 2009.08 ( 5鏈?06 2011 - 19:52:47)
DRAM: 64 MB
Flash: 2 MB
NAND: 128 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
[u-boot@MINI2440]# nand info
Device 0: NAND 128MiB 3,3V 8-bit, sector size 128 KiB
[u-boot@MINI2440]# saveenv
Saving Environment to Flash...
Un-Protected 16 sectors
Erasing Flash...Erasing sector 64 ...
从上面输出信息可以看到保存环境变量并没有成功,而且它是将把环境变量保存到Flash即Nor flash中,显然这不正确,我们是要保存到Nand中。原来,u-boot在默认的情况下把环境变量都是保存到Nor Flash中的,所以我们要修改代码,让它保存到Nand中,如下:
打开include/configs/mini2440.h,定位到193行附近,注释掉下列代码:
#define CONFIG_SYS_FLASH_ERASE_TOUT (5*CONFIG_SYS_HZ) /* Timeout for Flash Erase */
#define CONFIG_SYS_FLASH_WRITE_TOUT (5*CONFIG_SYS_HZ) /* Timeout for Flash Write */
//#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */
* NAND flash settings
*/
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET 0x40000 //将环境变量保存到nand中的0x40000位置必,须在块的起始位置
#define CONFIG_ENV_SIZE 0x20000 /*必须为块大小的整数倍 , 否则会提示下面的信息,将擦除整个块*/
#if defined(CONFIG_CMD_NAND)
Warning: Erase size 0x00010000 smaller than one erase block 0x00020000
Erasing 0x00020000 instead
NAND 128MiB 3,3V 8-bit: MTD Erase failure: -22
Writing to Nand... FAILED!
然后保存,重新编译、拨到nor 档下载,在拨到nand 档上电运行:
Enter your selection: ?
U-Boot 2009.08 ( 5鏈?06 2011 - 22:30:25)
DRAM: 64 MB
Flash: 2 MB
NAND: 128 MiB
*** Warning - bad CRC or NAND, using default environment
In: serial
Out: serial
Err: serial
[u-boot@MINI2440]# saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x4000000000002 -- 0% complete.
Writing to Nand... done
[u-boot@MINI2440]#
可以看到环境变量保存成功,将开发板重新上电后不会再有bad CRC告警,nand flash 移植成功。
接下来将进入u-boot的第四阶段,为u-boot-2009.08增加网卡DM9000驱动支持。
上一篇:u-boot-2009.08在mini2440上的移植 增加nor flash功能
下一篇:u-boot-2009.08在mini2440上的移植 增加DM9000网卡驱动
推荐阅读最新更新时间:2024-11-13 16:45
设计资源 培训 开发板 精华推荐
- DER-31 - 26W 多输出 DC/DC 转换器
- 3D打印机 WiFi SD卡 大卡 8266
- AD8319-EVAL,AD8319 评估板,1MHz 至 10GHz,45dB 对数检测器/控制器
- LT3091MPR 线性稳压器在并联器件中的典型应用
- Adafruit Bluefruit LE Shield - 适用于 Arduino 的蓝牙 LE | 2746
- 同步升压
- 《二次仿制》基于ARDUINO NANO 测光表 30元解决
- TLV431C 低压精密可调并联稳压器的典型应用
- Bidirectional 400-V/12-V DC/DC Converter Reference Design
- L6470 Discovery:探索L6470电机驱动器的开发工具