u-boot-2010.03在LT2440上的移植详解 (二)

u-boot-2010.03在LT2440上的移植详解 (二)

郑重声明,这系列文章改写自博客园 黄刚先生的《嵌入式Linux之我行——u-boot-2009.08在2440上的移植详解》

转载时请注明出处

文章出处:http://www.lt-net.cn

编译系统Ubuntu10.04
交叉编译器arm-linux-gcc 4.3.3
硬件设备LT2440开发板  
测试软件u-boot-2010.03
依赖库

uboot下载地址:http://ftp.denx.de/pub/u-boot/u-boot-2010.03.tar.bz2

本次移植在u-boot-2010.03原有功能的基础上增加如下特性:

  1.支持2KB  page Nand Flash读写
  2.支持Nand/Nor Flash启动自动识别
  3.支持D[size=+0]M9000AEP 10[size=+0]M/100[size=+0]M自适应网卡
  4.支持yaffs文件系统烧写
  5.支持USB下载功能
  6.支持一键式菜单
  7.支持启动Logo
  8.支持ubifs(待续)

上接:u-boot-2010.03在LT2440上的移植详解 (一)

4)准备进入u-boot的第二阶段(在u-boot中添加对我们开发板上Nor Flash的支持)
     通常,在嵌入式bootloader中,有两种方式来引导启动内核:从Nor Flash启动和从Nand Flash启动。u-boot中默认是从Nor Flash启动,再从上一节这个运行结果图中看,还发现几个问题:第一,我开发板的Nor Flash是2M的,而这里显示的是512kB;第二,出现Warning - bad CRC, using default environment的警告信息。不是u-boot默认是从Nor Flash启动的吗?为什么会有这些错误信息呢?这是因为我们还没有添加对我们自己的Nor Flash的支持,u-boot默认的是其他型号的Nor Flash,而我们的Nor Flash的型号是AM29LV160DB,支持CFI接口。
   下面我们一一来解决这些问题,让u-boot完全对我们Nor Flash的支持。由于我们的NorFlash支持CFI 接口,可以直接使用u-boot 提供的CFI驱动程序,只需要配置一些宏定义即可。首先我们修改头文件代码如下:

#gedit include/configs/lt2440.h //修改Nor Flash参数部分的定义
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
#if 0
#define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */
#if 0
#define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */
#endif
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */
#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE  0x00100000 /* 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_SIZE  0x00080000 /* 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
#endif
#define CONFIG_FLASH_CFI_DRIVER       1
#define CONFIG_SYS_FLASH_CFI   1
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */
#define CONFIG_SYS_MAX_FLASH_SECT  (38)
#define CONFIG_SYS_MONITOR_BASE     PHYS_FLASH_1
#define CONFIG_ENV_ADDR   (CONFIG_SYS_FLASH_BASE + 0x0F0000) /* addr of environment */

 

#gedit board/samsung/lt2440/Makefile     //修改默认板子的 Nor Flash驱动程序

 


include $(TOPDIR)/config.mkLIB = $(obj)lib$(BOARD).aCOBJS := lt2440.o   //去掉flash.o ,我们使用CFI的驱动程序,所以去掉这个
SOBJS := lowlevel_init.o


    修改完后重新编译u-boot,下载到RAM中运行结果如下图,从运行结果图看,Nor Flash的大小可以正确检测到了,但是还会出现bad CRC的警告信息,其实这并不是什么问题,只是还没有将环境变量设置到Nor Flash中,我们执行一下u-boot的:saveenv命令就可以了。如下图:

Hit any key to stop autoboot:  0
#####      LT2440 U-Boot -2010.03                 #####
#####     Welcome to Embeded World                #####
#####                        designed by: LuTong  #####
#####                         www.lt-net.cn        #####
Download u-boot or STEPLDR.nb1 to Nand Flash
[e] Download e-boot to Nand Flash
[n] Download u-boot to Nor Flash
[k] Download Linux Kernel uImage to Nand Flash
[y] Download YAFFS2 Image to Nand Flash
[g] Download to SDRAM and Run
[d] Download Linux Kernel to SDRAM and RUN
[f] Format the Nand Flash
[l] Low-level Format the entire Nand Flash
Set the boot parameters
Boot the system
[r] Reboot U-Boot
[ q] Quit from menu
Enter your selection: q
LT2440 # u 1 33f00000
USB host is connected. Waiting a download.
Now, Downloading [ADDRESS:33f00000h,TOTAL:105606]
RECEIVED FILE SIZE:  105606 (103KB/S, 1S)
LT2440 # go 33f00000
## Starting application at 0x33F00000 ...▲
U-Boot 2010.03 (12鏈?07 2010 - 14:14:06)
DRAM:  64 MB
Flash:   2 MB
*** Warning - bad CRC, using default environment
In:    serial
Out:   serial
Err:   serial
Net:   CS8900-0
LT2440 # saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
. done
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
LT2440 #

重启之后 无 *** Warning - bad CRC, using default environment

U-Boot 2010.03 (12鏈?07 2010 - 14:14:06)
DRAM:  64 MB
Flash:  2 MB
In:    serial
Out:   serial
Err:   serial
Net:   CS8900-0
LT2440 #


下接:u-boot-2010.03在LT2440上的移植详解 (三)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值