原创文章版权所有!如需转载,请注明出处: http://hi.baidu.com/liushuiyue1/myhome 谢谢合作!!!!!
六.对 Nor flash 的支持:
从上图的启动信息可以看到 flash : 0kb 。 Uboot 还没有添加对 Nor flash 的支持。我们使用的 nor flash 型号是 EN29LV160AB ,与 AMD 的兼容,所以添加对 Nor flash 的支持。
#cd include/configs/ // #gedit smdk6410.h // /*----------------------------------------------------------------------- * FLASH and environment organization */ #define CONFIG_SYS_FLASH_BASE 0x00000000//0x10000000Flash 的基地址 #define CONFIG_SYS_MONITOR_BASE 0x00000000
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ // 一定要定义为>0 /* AM29LV160B has 35 sectors, AM29LV800B - 19 */ #define CONFIG_SYS_MAX_FLASH_SECT 35//40 硬件得来
#define CONFIG_AMD_LV800 //#define CONFIG_SYS_FLASH_CFI 1 /* Use CFI parameters (needed?) */ #define PHYS_FLASH_SIZE 0x200000 //2M Flash 的大小 #define PHYS_FLASH_1 0x00000000 /* Use drivers/cfi_flash.c, even though the flash is not CFI-compliant */ //CFI 相关的屏蔽掉 //#define CONFIG_FLASH_CFI_DRIVER 1 //#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT //#define CONFIG_FLASH_CFI_LEGACY //#define CONFIG_SYS_FLASH_LEGACY_512Kx16
/* timeout values are in ticks */ #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_ADDR 0x00000 #define CONFIG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ |
说明: Uboot2010.03 中支持 Nor flash 的两种读写方式: CFI 和 JEDEC 。本文章采用 JEDEC 的方式。因为 S3C2440 和 S3C6410 的 nor flash 接口兼容,所以将 S3C2440 目录下的 flash.c 复制到 ./board/samsung/s3c6410/ 下,并修改 Makefile 文件。
#cd board/samsung/s3c6410/Makefile // #gedit Makefile // COBJS-y := smdk6410.o flash.o |
重新编译 Uboot 并下载到 Nand Flash 中,串口打印信息如下。说明板子已经能检测到 Nor flash