现在的位置: 首页 > 综合 > 正文

NOR FLASH的U-Boot

2012年09月13日 ⁄ 综合 ⁄ 共 2696字 ⁄ 字号 评论关闭
由于NXP基于NAND的U-Boot使用了S1L的一些初始化工作,因此需要把S1L中的初始化工作放到U-Boot中。
修改u-boot.lds,将U-Bootd饿入口地址修改为NOR FLASH的物理地址0xE0000000.
 
24 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
25 OUTPUT_ARCH(arm)
26 ENTRY(_start)
27 SECTIONS
28 {
29     . = 0xE0000000;        #修改为NOR FLASH的物理地址
30
31     . = ALIGN(4);
32     .text      :
33     {
34       cpu/arm926ejs/start.o (.text)
35       *(.text)
36     }
37
38     . = ALIGN(4);
39     .rodata : { *(.rodata) }
40
41     . = ALIGN(4);
42     .data : { *(.data) }
43
44     . = ALIGN(4);
45     .got : { *(.got) }
46
47     . = .;
48     __u_boot_cmd_start = .;
49     .u_boot_cmd : { *(.u_boot_cmd) }
50     __u_boot_cmd_end = .;
51
52     . = ALIGN(4);
53     __bss_start = .;
54     .bss (NOLOAD) : { *(.bss) }
55     _end = .;
56 }
 
特别注意,LPC3250芯片,如果要能够基于NOR FLASH启动,必须在NOR FLASH的第一个字写入一个特殊的值,加在异常向量表之前,修改cpu/arm926ejs/start.S文件
51
52 .globl _start
53 _start:
54     .word 0x13579BD1   /* NOR FLASH BOOT, 16-bit Bus-width */
55     b   reset
56     ldr pc, _undefined_instruction
57     ldr pc, _software_interrupt
58     ldr pc, _prefetch_abort
59     ldr pc, _data_abort
60     ldr pc, _not_used
61     ldr pc, _irq
62     ldr pc, _fiq
 
 
 
文件:
include/configs/smartarm3250.h
直接从NOR FLASH启动,则不再需要S1L。可以在这个文件中配置,去掉CFG_BOOT_USES1L的宏定义。
34 /*
35  * There are 2 boot options for u-boot on the SmartARM3250 board. Option 1
36  * or option 2. In either cases, u-boot does not need to be relocated.
37  *
38  * Option 1 - define CFG_BOOT_USES1L
39  * With this option, the S1L loader present in the board initializes the
40  * system (including SDRAM, MMUs, some MUX states, etc.). U-boot is loaded
41  * into an already initialized system in SDRAM at address 0x83FC0000 (the
42  * end of SDRAM in a 64M system). Because most of the system is already
43  * initialized, system init is not performed again.
44  *
45  * Option 2 - undefine CFG_BOOT_USES1L
46  * With this option, u-boot is the primary boot loader that is loaded and
47  * started from the Phytec kickstart loader (see documentation with the
48  * Phytec board for the kickstart loader). In this configuration, u-boot
49  * loads and runs from RAM at address 0x00000000 and requires complete
50  * system initialization. The kickstart loader will copy the u-boot image
51  * from FLASH starting at block 1 into IRAM and start it at address 0x0.
52  */
53 #define CFG_BOOT_USES1L
54
55 #ifdef CFG_BOOT_USES1L
56 /*
57  * Skip low level init of MMU, SDRAM, muxing, etc. if u-boot is loaded
58  * and executed from S1L
59  */
60 #define CONFIG_SKIP_LOWLEVEL_INIT
61 #endif
 
 
 
 
文件:

board/zhiyuan/smartarm3250/lowlevelsys_init.c

 
212 /*
213  * Miscellaneous platform dependent initializations
214  */
215 void phy3250_sys_init(void)
216 {
217     /* Get board information to determine DRAM size and MAC address */
218     phy3250_get_board_info();
219
220 #ifndef CFG_BOOT_USES1L
221     /* Initialize system including clocking, SDRAM, muxing, MMU, etc. */
            //需要在这里进行时钟、SDRAM、MUXING、MMU等初始化。
222     /* TBD stubbed */
223 #endif
224 }
 
增加NOR FLASH支持:
   在board/zhiyuan/smartarm3250/目录下增加flash.c和flash_common.c两个文件(参考了EPC-8000的U-Boot)。

 

【上篇】
【下篇】

抱歉!评论已关闭.