12. 修改对nor flash的支持。本实验箱采用的是32M型号为28F128J3A150芯片。
将/board/jx2410/flash.c中的代码替换为:
见PDF文档中名为flash.c代码
U-Boot在JX2410上的移植 PDF 版下载地址:
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2011年资料/嵌入式Linux/U-Boot在JX2410上的移植/
将include/configs/zfxjx2410.h中的flash and environment organization替换为:
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
#define PHYS_FLASH_SECT_SIZE 0x00040000 /* 256 KB sectors (x2) */
#if 0
#define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */
#endif
#if 0
#define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */
#endif
#if 1
#define CONFIG_AMD_LV1600 1 /* uncomment this if you have a LV1600 flash */
#endif
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
#ifdef CONFIG_AMD_LV1600
#define PHYS_FLASH_SIZE 0x01000000 /* 2MB */
#define CFG_MAX_FLASH_SECT (128) /* max number of sectors on one chip */
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x40000) /* addr of environme
nt */
#endif
#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE 0x00100000 /* 1MB */
#define CFG_MAX_FLASH_SECT (19) /* max number of sectors on one chip */
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x0F0000) /* addr of environment */
#endif
#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE 0x00080000 /* 512KB */
#define CFG_MAX_FLASH_SECT (11) /* max number of sectors on one chip */
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x070000) /* addr of environment */
#endif
/* timeout values are in ticks */
#define CFG_FLASH_ERASE_TOUT (5*CFG_HZ) /* Timeout for Flash Erase */
#define CFG_FLASH_WRITE_TOUT (5*CFG_HZ) /* Timeout for Flash Write */
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_ENV_SIZE 0x40000 /* Total Size of Environment Sector */
至此,即可配置编译链接,产生u-boot.bin文件。下载,测试是否可以读写nor flash。也可使用flinfo命令查看nor flash信息。将产生如下信息:
Bank # 1: INTEL 28F128J3A
Size: 32 MB in 128 Sectors
Sector Start Addresses:
00000000 (RO) 00040000 (RO) 00080000 000C0000 00100000
00140000 00180000 001C0000 00200000 00240000
00280000 002C0000 00300000 00340000 00380000
003C0000 00400000 00440000 00480000 004C0000
00500000 00540000 00580000 005C0000 00600000
00640000 00680000 006C0000 00700000 00740000
00780000 007C0000 00800000 00840000 00880000
008C0000 00900000 00940000 00980000 009C0000
00A00000 00A40000 00A80000 00AC0000 00B00000
00B40000 00B80000 00BC0000 00C00000 00C40000
00C80000 00CC0000 00D00000 00D40000 00D80000
00DC0000 00E00000 00E40000 00E80000 00EC0000
00F00000 00F40000 00F80000 00FC0000 01000000
01040000 01080000 010C0000 01100000 01140000
01180000 011C0000 01200000 01240000 01280000 。。。。。。。。。(省略部分)
到目前为止,即完成了u-boot基本功能。以后可以添加更多功能。例如做成一个快捷方式,添加命令,引导linux内核等。
