uboot移植記錄之一
23小時前一,移植可以從Nor flash啓動的uboot
這個階段是移植一個最簡單的uboot,可以燒在Nor flash內運行.
二,移植支持Nand flash驅動的uboot
加入Nand flash驅動的支持,可以在uboot命令行下操作Nand flash.但還未能從Nand flash啓動,只能在Nor flash內運行.
三,移植可以從Nor flash啓動的uboot
可以燒錄在Nand flash,並設置從Nand flash啓動運行uboot.
1.編譯uboot1.1.4
#make smdk2410_config |
注:編譯針對arm的平臺時,uboot默認使用arm-linux-gcc編譯,若交叉編譯器名字不一樣,需要自行在Makefile裏修改。
cc1: Invalid option `abi=apcs-gnu'
make[1]: *** [hello_world.o] Error 1
make[1]: Leaving directory `/root/u-boot-1.1.4/examples'
make: *** [examples] Error 2
解決辦法:
出錯的文件是/cpu/arm920t/下的config.mk:
將
PLATform_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
PLATform_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))
make[1]: *** No rule to make target `hello_world.srec', needed by `all'. Stop.
make[1]: Leaving directory `/work/src/u-boot-1.1.4/examples'
解決方法:
打開 examples/Makefile
把example文件夾下的Makefile中的
第126行
%.srec: % 改成 %.srec: %.o
第129行的
%.bin: % 改成 %.bin: %.o
注意: 默認u-boot的smdk2410_config是不支持nandflash的,只能在nor flash內運行,所以只能燒錄到nor flash內運行。如果燒錄到nandflash下是不能運行的。
啓動信息如下:
U-Boot 1.1.4 (Dec 30 2007 - 23:25:02) |
1) 啓動時開發板蜂鳴器一直在響。
懷疑是我的開發板蜂鳴器對應的GPIO口和smdk2410的GPIO口地址不對應,從而導致啓動時誤賦了值,一直在響。
2) Warning - bad CRC, using default environment
這個問題是因爲第一次使用uboot時沒有設置過變量,設置保存一下就不會在出現了。
3) Flash: 512 kB
我的板子Nor flash是1MB的,而這裏顯示512KB
這裏主要根據開發板硬件的實際情況,基於smdk2410的源碼進行修改(主要是配置文件include/configs/smdk2410.h),並解決如上碰到的問題1和3。
首先修改include/configs/smdk2410.h。裏面包含了很多對目標板設置的宏。
#define CONFIG_BOOTDELAY 3
|
將
#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_AMD_LV800 1 /* uncomment this if you have a LV800 flash */
#if 0
#define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */
#endif
注意如下兩個地方:
#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE 0x00100000 /* 1MB */
這裏解決了u-boot啓動時的問題3即Nor Flash大小爲512 kB ,是因爲沒有選擇正確的Nor flash型號。
#define CFG_MAX_FLASH_SECT (19) /* max number of sectors on one chip */
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x0F0000) /* addr of environment */
宏CFG_ENV_ADDR定義了存放uboot變量的地址,換算一下爲1MB-64KB=960KB地方,而實際uboot編譯出來的大小僅爲120KB左右,由此可以得出,即使從新燒錄了新編譯的uboot到Nor flash內,也不會影響先前設定使用的uboot變量。
#endif
查看ARMSYS2410-B底板電路圖,在Reset Singal模塊裏可以看到蜂鳴器(BUZZER)控制口連接到TOUT1引腳,並且低電平響。如下:
修改smdk2410.c
#vi board/smdk2410/smdk2410.c
找到board_init()函數
在gpio->GPBUP = 0x000007FF;下面
添加如下內容:
/*******stop beep******/ |
#make clean
#make ARCH=arm
啓動信息:
U-Boot 1.1.4 (Jan 3 2008 - 23:11:07)
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 1 MB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
ARMSYS2410 #
|