手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

移植Linux 2.6.26到S3C2410(ARM9)

[日期:2009-10-11] 来源:eslxf.blog.51cto.com  作者:eslxf [字体:大 中 小]

4.        u-boot移植
从http://www.denx.de下载u-boot-1.3.4.tar.bz2源代码包,用4.2.3的交叉工具链编译u-boot-1.3.4,以下各u-boot文件目录都相对于u-boot的根目录。
 
远峰I型开发板是基于smdk2410配置的开发板。但是其NOR FLASH为Intel公司E28F320J3A(4MB)芯片,不是u-boot-1.3.4 smdk2410_config配置所支持的AMD公司LV400与LV800的芯片。所以对开发板NOR FLASH需要做一些移植工作才可。
从u-boot-1.3.4开始smdk2410_config配置直接支持SAMSUNG公司的 K9S1208VOM(64MB)芯片,只需做点简单的配置就可使开发板的NAND FLASH正常工作。但u-boot-1.3.4并不支持从NAND FLASH直接启动的功能,需要做些移植工作才行。
4.1.      迈出第一步
在u-boot-1.3.4中添加YF2410_config的配置。按下列步骤进行修改就可使u-boot能够从NOR FLASH正常启动,我们将走好u-boot移植的第一步。
4.1.1.      修改Makefile文件
在/Makefile文件中设置交叉编译环境,同时添加YF2410_config配置,具体修改参见清单8。
清单8 修改Makefile文件

--------------------------------------------------------------------------------

[root@lxf u-boot-1.3.4]# vi Makefile
…
endif   # HOSTARCH,ARCH
endif   # CROSS_COMPILE
//添加下面两行配置语句,设置交叉编译环境
ARCH=arm
CROSS_COMPILE = arm-linux-
export  CROSS_COMPILE
…
smdk2410_config : unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
//添加下面两行配置语句,增加YF2410_config配置
YF2410_config : unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t YF2410 NULL s3c24x0
…

--------------------------------------------------------------------------------

4.1.2.      添加YF2410目录与相应的文件
把/board/smdk2410目录下的所有文件复制到/board/YF2410目录下,具体修改参见清单9。
清单9 添加/board/YF2410目录与相应文件

--------------------------------------------------------------------------------

[root@lxf u-boot-1.3.4]# cd board
[root@lxf board]# cp -r smdk2410 YF2410
[root@lxf YF2410]# tree.
|-- Makefile
|-- config.mk
|-- flash.c
|-- lowlevel_init.S
|-- smdk2410.c
`-- u-boot.lds
 
0 directories, 6 files

--------------------------------------------------------------------------------

4.1.3.      添加YF2410.h文件
在/include/configs目录下把smdk2410.h文件复制为YF2410.h文件,具体修改参见清单10。
清单10 创建/include/configs YF2410.h文件

--------------------------------------------------------------------------------

[root@lxf u-boot-1.3.4]# cd include/
[root@lxf include]# cd configs/
[root@lxf configs]# cp smdk2410.h YF2410.h

--------------------------------------------------------------------------------

4.1.4.      测试YF2410_config配置
采用YF2410_config的默认配置,编译生成u-boot.bin文件,把u-boot.bin烧写到开发板NOR FLASH上,启动开发板测试。具体操作步骤参见清单11、清单12与清单13。
此处利用BDI2000把u-boot.bin文件烧写到NOR FLASH,通过仿真器一样也可烧写。
清单11 编译生成u-boot.bin文件

--------------------------------------------------------------------------------

[root@lxf configs]# cd ..
[root@lxf include]# cd ..
[root@lxf u-boot-1.3.4]# make YF2410_config
Configuring for YF2410 board...
[root@lxf u-boot-1.3.4]# make
…
<编译生成u-boot.bin文件>
//把u-boot.bin 放置到tftp网络服务的根目录/tftpboot下
[root@lxf u-boot-1.3.4]# cp u-boot.bin /tftpboot/

--------------------------------------------------------------------------------

清单12 利用BDI2000把u-boot.bin文件烧写到NOR FLASH

--------------------------------------------------------------------------------

//135.1.2.145为BDI2000的IP地址
[root@lxf u-boot-1.3.4]# telnet 135.1.2.145
Trying 135.1.2.145...
Connected to 135.1.2.145.
Escape character is '^]'.
BDI Debugger for ARM
====================
MD    [<address>] [<count>]  display target memory as word (32bit)
MDH   [<address>] [<count>]  display target memory as half word (16bit)
MDB   [<address>] [<count>]  display target memory as byte (8bit)
DUMP  <addr> <size> [<file>] dump target memory to a file
MM    <addr> <value> [<cnt>] modify word(s) (32bit) in target memory
MMH   <addr> <value> [<cnt>] modify half word(s) (16bit) in target memory
MMB   <addr> <value> [<cnt>] modify byte(s) (8bit) in target memory
MT    <addr> <count>         memory test
MC    [<address>] [<count>]  calculates a checksum over a memory range
MV                           verifies the last calculated checksum
RD    [<name>]               display general purpose or user defined register
RDUMP [<file>]               dump all user defined register to a file
RDALL                        display all ARM registers
RDCP  <number>               display control processor 15 register
RDIB  [<number>]             display IceBreaker register
RM    {<nbr>?<name>} <value> modify general purpose or user defined register
RMCP  <number>   <value>     modify control processor 15 register
RMIB  <number>   <value>     modify IceBreaker register
BOOT                         reset the BDI and reload the configuration
RESET [HALT | RUN [time]]    reset the target system, change startup mode
GO    [<pc>]                 set PC and start current core
GO    <n> <n> [<n>[<n>]]     start multiple cores in requested order
TI    [<pc>]                 single step an instruction
HALT  [<n>[<n>[<n>[<n>]]]]   force core(s) to debug mode (n = core number)
BI  <addr> [<mask>]          set instruction breakpoint
CI  [<id>]                   clear instruction breakpoint(s)
BD  [R|W] <addr> [<data>]    set data watchpoint (32bit access)
BDH [R|W] <addr> [<data>]    set data watchpoint (16bit access)
BDB [R|W] <addr> [<data>]    set data watchpoint ( 8bit access)
BDM [R|W] <addr> [<mask>]    set data watchpoint with address mask
CD [<id>]                    clear data watchpoint(s)
INFO                         display information about the current state
LOAD   [<offset>] [<file> [<format>]] load program file to target memory
VERIFY [<offset>] [<file> [<format>]] verify a program file to target memory
PROG   [<offset>] [<file> [<format>]] program flash memory
                           <format>  : SREC, BIN, AOUT, ELF or COFF
ERASE  [<address> [<mode>]]  erase a flash memory sector, chip or block
                   <mode>  : CHIP, BLOCK or SECTOR (default is sector)
ERASE  <addr> <step> <count> erase multiple flash sectors
UNLOCK [<addr> [<delay>]]    unlock a flash sector
UNLOCK <addr> <step> <count> unlock multiple flash sectors
FLASH  <type> <size> <bus>   change flash configuration
FENA   <addr> <size>         enable autoamtic programming to flash memory
FDIS                         disable autoamtic programming to flash memory
DELAY  <ms>                  delay for a number of milliseconds
SELECT <core>                change the current core
SCAN <nbr><len>[<...b2b1b0>] Access a JTAG scan chain, b0 is first scanned
                             len : the number of bits 1..256
                             bx  : a data byte, two hex digits
HOST   <ip>                  change IP address of program file host
PROMPT <string>              defines a new prompt string
CONFIG                       display or update BDI configuration
CONFIG <file> [<hostIP> [<bdiIP> [<gateway> [<mask>]]]]
HELP                         display command list
QUIT                         terminate the Telnet session
//对NOR FLASH 从0x0到0x7ffff的内容进行擦除操作
YF2410-I>erase 0x0
Erasing flash at 0x00000000
Erasing flash passed
YF2410-I>erase 0x20000
Erasing flash at 0x00020000
Erasing flash passed
YF2410-I>erase 0x40000
Erasing flash at 0x00040000
Erasing flash passed
YF2410-I>erase 0x60000
Erasing flash at 0x00060000
Erasing flash passed
//从NOR FLASH的0x0地址开始烧写u-boot.bin
YF2410-I>prog 0x0 u-boot.bin bin
Programming u-boot.bin , please wait ....
Programming flash passed
//启动U-boot
YF2410-I>go 0x0

--------------------------------------------------------------------------------

清单13 查看U-boot启动信息

--------------------------------------------------------------------------------

//切换到另外的终端,打开minicom查看U-boot启动信息:
U-Boot 1.3.4 (Aug 27 2008 - 16:14:13)                                         
 
DRAM:  64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
SMDK2410#

--------------------------------------------------------------------------------

   u-boot启动成功,但是NOR FLASH的大小不对。

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款