fl2440的U-boot-2010.09移植(四) 添加NOR Flash启动支持
来源:互联网 发布:淘宝注册账号手机验证 编辑:程序博客网 时间:2024/04/28 13:18
我们知道S3C2440支持从NAND Flash启动和从NOR Flash启动两种模式,先来介绍u-boot的NOR Flash启动方式吧。
一、修改NOR Flash的读写程序
FL2440开发板中使用的NOR Flash是Intel的J3系列存储大小是4M字节,这个系列的NOR Flash支持标准的CFI指令(在最新的U-boot版本中只需要添加宏定义就可以支持CFI接口的NOR Flash了,但我们这个版本中还不行),将board/cmi/flash.c复制到board/fl2440/flash.c,这个文件中包含了我们开发板的NOR Flash读写函数,但是其中还有一点问题,需要修改flash.c文件中的函数write_buff,此函数需要将小端字节数进行short类型变换,即将低地址数放在低位,高地址数放在高位另外还要进行地址对其,因为该型号flash只支持16位写,不支持8位写,那么我们写8位时需要从flash中读取出不改写8位,在加上需要改写的8位组成16位后回写到flash中去,具体将原flash.c中的函数write_buff修改如下:
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt){ulong cp, wp;ushort data;int i, rc;if (info->flash_id == FLASH_UNKNOWN) {return 4;}wp = (addr & ~1);/* get lower word aligned address *//* * handle unaligned start byte */ /* for not to modify the origin data in flash*/if (addr - wp) {data = 0; for(i = 0, cp = wp; i < 1; ++i, ++cp){ data = (data >> 8) | (*(uchar *) cp << 8); } for(; i < 2 && cnt > 0; ++i){data = (data >> 8) | (*src++ <<8);--cnt; ++cp; } for(; cnt == 0 && i < 2; ++i, ++cp){ data = (data >> 8) | (*(uchar *) cp << 8); }if ((rc = write_short(info, wp, data)) != 0) {return (rc);}wp += 2;}/* * handle word aligned part */while (cnt >= 2) {/*data = 0;for (i=0; i<2; ++i) {data = (data << 8) | *src++;}*/ data = *((vu_short *) src) ;if ((rc = write_short(info, wp, data)) != 0) {return (rc);} src += 2;wp += 2;cnt -= 2;}if (cnt == 0) {return (0);}/* * handle unaligned tail bytes * read the origin high byte data and write again! * modified by yanghao */data = 0;for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) {data = (data >> 8) | (*src++ << 8);--cnt;}for (; i<2; ++i, ++cp) {data = (data >> 8) | (*(uchar *)cp << 8);}return (write_short(info, wp, data));}
还需要将flash.c文件中的NOR Flash块大小进行修改:
#define FLASH_BLOCK_SIZE 0x00020000 //数据手册p8说了32Mbit有32个128kBytes block组成
二、修改开发板头文件中的宏定义
为了添加对NOR Flash启动的支持,还需要在include/configs/fl2440.h头文件中添加对NOR Flash的信息描述和支持,将fl2440.h文件中159行附近:
#define CONFIG_AMD_LV4001/* uncomment this if you have a LV400 flash */#if 0#define CONFIG_AMD_LV8001/* uncomment this if you have a LV800 flash */#endif#define CONFIG_SYS_MAX_FLASH_BANKS1/* max number of memory banks */#ifdef CONFIG_AMD_LV800#define PHYS_FLASH_SIZE0x00100000 /* 1MB */#define CONFIG_SYS_MAX_FLASH_SECT(19)/* max number of sectors on one chip */#define CONFIG_ENV_ADDR(CONFIG_SYS_FLASH_BASE + 0x0F0000) /* addr of environment */#endif#ifdef CONFIG_AMD_LV400#define PHYS_FLASH_SIZE0x00080000 /* 512KB */#define CONFIG_SYS_MAX_FLASH_SECT(11)/* max number of sectors on one chip */#define CONFIG_ENV_ADDR(CONFIG_SYS_FLASH_BASE + 0x070000) /* addr of environment */#endif
全部删除,并修改为:
#define CONFIG_SYS_MAX_FLASH_BANKS1/* max number of memory banks */#ifdef CONFIG_FL2440#define PHYS_FLASH_SIZE0x00400000 /* 4MB */#define CONFIG_SYS_MAX_FLASH_SECT(32)/* max number of sectors on one chip */#define CONFIG_ENV_ADDR(CONFIG_SYS_FLASH_BASE + 0x0F0000) /* addr of environment */#define CONFIG_SYS_MONITOR_BASE TEXT_BASE /*CMI/flash.c need*/#define FLASH_BASE0_PRELIM PHYS_FLASH_1 /*CMI/flash.c need*/#endif
并将文件中
#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment
修改为:
#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment
再执行make,生成的u-boot.bin就可以烧写入NOR Flash中了(可以使用JLINK软件包中的JFlash来完成烧写过程),设置开发板启动方式为NOR Flash启动,再次上电启动NOR Flash就完成u-boot的启动了。
- fl2440的U-boot-2010.09移植(四) 添加NOR Flash启动支持
- U-Boot移植FL2440--2--支持从Nor FLASH启动
- u-boot-2009.08在飞凌OK2440/FL2440上的移植(二)——让u-boot支持从nor flash 启动
- fl2440的U-boot-2010.09移植(六)NAND Flash启动支持
- u-boot:从NOR FLASH启动并支持NAND FLASH读写的移植
- U-boot-2009.08移植(三)支持Nor FLASH
- U-boot-2009.08移植(三)支持Nor FLASH
- u-boot-2009.08在飞凌OK2440/FL2440上的移植(四)——让u-boot支持nand flash识别与操作
- 基于TQ2440的u-boot 1.1.6移植(二)(支持nor flash nand flash )
- U-boot-2010.09移植(六)NAND Flash启动支持
- fl2440 移植u-boot-2010.09全纪录4---------u-boot支持从nandflash启动
- fl2440的U-boot-2010.09移植(五)uboot架构中NAND Flash驱动修改
- U-boot-2014.04移植到MINI2440(9) nor flash启动和nand flash 启动
- TQ2440 u-boot-2012.04.01移植三支持NOR Flash
- U-boot-2014.04移植到MINI2440(5) Nor FLASH 读写支持移植
- u-boot-2014.10移植第22天----添加nand flash命令支持(四)
- fl2440的U-boot-2010.09移植(七)LCD的支持
- fl2440的U-boot-2010.09移植(七)LCD的支持
- 多函数压栈过程-参数总是在call后立即恢复
- zen-cart 批量插件easy populat错误黄条Deleting of product data debris failed! ...
- 继承含泛型的父类
- web前端性能分析--实践篇
- 黑马程序员-面向对象
- fl2440的U-boot-2010.09移植(四) 添加NOR Flash启动支持
- 6、C语言中的字符串
- 对目录下文件进行简单批处理的脚本
- 周记
- sql 语句
- 进程控制理论<三>---那些年我们一起学习linux程序设计
- 阿里巴巴QA架构组成长空间
- 同时处理多个window.onload事件
- 进程控制理论<四>---那些年我们一起学习linux程序设计 .