DM3730 uboot 分析
記錄下啟動log
Texas Instruments X-Loader 1.42 BSP-dm37x-2.4-2 for dm3730logic (2013-06-18 15:59:36) DRAM: 256MB (MT29C4G48MAZAPAKQ5) Starting U-boot on MMC Reading boot sector 454540 bytes read from MMC to 80400000U-Boot 2011.06 BSP-dm37x-2.4-2 (Jun 18 2013 - 15:35:26)OMAP3630/3730-GP ES2.1, CPU-OPP2, L3-200MHz, Max CPU Clock 1 Ghz Logic DM37x/OMAP35x reference board + LPDDR/NAND I2C: ready DRAM: 256 MiB Board: DM37xx SOM LV NOR: no flash device detected NAND: 512 MiB NAND: Internal to NAND ECC selected *** Warning - bad CRC or ECC error, using default environmentFound '28' display panel In: serial Out: serial Err: serial Product ID data cached to: 40200000 at88_send_packet:82 NACK idx 3 at88_send_packet:82 NACK idx 3 at88_send_packet:82 NACK idx 3 at88_send_packet:82 NACK idx 3 at88_send_packet:82 NACK idx 3 at88_send_packet:82 NACK idx 3 Die ID #74ae00229ff84000013c124c1700c017 OTG_SYSCONFIG: 00001008 - needs to be 00002001ID data ROM : Gen 1 Part Number : L3-5000518 Model Name : SOMDM3730-PHI02-0301R-A Serial Number: 2520M01457 LAN ethaddr : 00:08:ee:10:92:adData (writethrough) Cache is ON Net: smc911x-0=================================== NOTICE =================================== The U-Boot environment was not found. If the display is not set properly linux will not have video support.Valid display options are:2 == LQ121S1DG31 TFT SVGA (12.1) Sharp3 == LQ036Q1DA01 TFT QVGA (3.6) Sharp w/ASIC5 == LQ064D343 TFT VGA (6.4) Sharp7 == LQ10D368 TFT VGA (10.4) Sharp15 == LQ043T1DG01 TFT WQVGA (4.3) Sharp28 == LQ043T1DG28 TFT WQVGA (4.3) Sharp (DEFAULT)vga[-16 OR -24] LCD VGA 640x480svga[-16 OR -24] LCD SVGA 800x600xga[-16 OR -24] LCD XGA 1024x768720p[-16 OR -24] LCD 720P 1280x720sxga[-16 OR -24] LCD SXGA 1280x1024uxga[-16 OR -24] LCD UXGA 1600x1200Default `display` environment variable is now being set to: 28At the U-Boot prompt type commands: `setenv display <num>`, then type `saveenv` to save the environment to NAND flash. This will avoid seeing this notice on future boots =================================== NOTICE ===================================Hit any key to stop autoboot: 3 2 1 0 == Checking mmc1 for alternate boot script boot.scr == mmc1 is available reading boot.scr129 bytes read== Found script on mmc 1, starting == ## Executing script at 80ff0000 ## Resetting to default environment kernel_location: mmc , rootfs_location: mmc , rootfs_type: ramdisk== Loading kernel file uImage to 0x81000000 == mmc1 is available reading uImage3977032 bytes read== Loading rootfs file rootfs.ext2.gz.uboot to 0x82000000 == reading rootfs.ext2.gz.uboot28842095 bytes read== Kernel bootargs == nand-ecc=chip console=ttyO0,115200n8 display=28 ignore_loglevel early_printk no_console_suspend mtdparts=omap2-nand.0:512k(x-loader),1664k(u-boot),384k(u-boot-env),5m(kernel),20m(ramdisk),-(fs) root=/dev/ram rw ramdisk_size=128000bootm 0x81000000 0x82000000## Booting kernel from Legacy Image at 81000000 ...Image Name: Linux-3.0.0-BSP-dm37x-2.4-2Image Type: ARM Linux Kernel Image (uncompressed)Data Size: 3976968 Bytes = 3.8 MiBLoad Address: 80008000Entry Point: 80008000Verifying Checksum ... OK ## Loading init Ramdisk from Legacy Image at 82000000 ...Image Name: uboot ext2 ramdisk rootfsImage Type: ARM Linux RAMDisk Image (gzip compressed)Data Size: 28842031 Bytes = 27.5 MiBLoad Address: 00000000Entry Point: 00000000Verifying Checksum ... OKLoading Kernel Image ... OK OKStarting kernel ...代碼過程
連接腳本 arch/arm/cpu/armv7/u-boot.lds
再看arch/arm/cpu/armv7/start.S? 最后調(diào)用 arch/arm/lib/board.c的board_init_f().
該函數(shù)中,首先調(diào)用arch/arm/lib/board.c: init_sequence序列初始化,初始化gpmc/arch_cpu/timer/clk/env/serial/bandrate/console/display/print/board_info/i2c/dram等
init_fnc_t *init_sequence[] = { #if defined(CONFIG_ARCH_CPU_INIT)arch_cpu_init, /* basic arch cpu dependent setup */ #endif #if defined(CONFIG_BOARD_EARLY_INIT_F)board_early_init_f, #endiftimer_init, /* initialize timer */ #ifdef CONFIG_FSL_ESDHCget_clocks, #endifenv_init, /* initialize environment */init_baudrate, /* initialze baudrate settings */serial_init, /* serial communications setup */console_init_f, /* stage 1 init of console */display_banner, /* say that we are here */ #if defined(CONFIG_DISPLAY_CPUINFO)print_cpuinfo, /* display cpu info (and speed) */ #endif #if defined(CONFIG_DISPLAY_BOARDINFO)checkboard, /* display board info */ #endif #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)init_func_i2c, #endifdram_init, /* configure available RAM banks */NULL, };然后保存ram_size 到gd,初始化gb->fb_base 等gb信息
最后調(diào)用relocate_code----》start.S里實現(xiàn)
為什么要relocate_code??
1.由x-loade可知,其將uboot前的部分代碼(比如16k)拷貝到內(nèi)部RAM的基地址,然后直接跳轉到這個地址執(zhí)行,但是一般的,uboot總是大于16K的,也就是說內(nèi)部RAM不能完整執(zhí)行uboot,需要把剩下的uboot搬移到外部RAM的高端地址執(zhí)行。kernel是在DDR低地址執(zhí)行的,為避免kernel與uboot地址重疊,需要把uboot搬移到DDR的高端地址執(zhí)行。
2.某些uboot是從Nor等啟動的,需要拷貝到DDR中才能完整執(zhí)行。
參考[uboot] uboot relocation介紹_Andy_0755的博客-CSDN博客
uboot 跳轉入ram執(zhí)行代碼分析(重映射分析)-erlei_2013-ChinaUnix博客
start.S中relocate_code段的如下代碼,實現(xiàn)uboot的重定位,跳轉到RAM中繼續(xù)執(zhí)行uboot
jump_2_ram:
 ?? ?ldr?? ?r0, _board_init_r_ofs
 ?? ?adr?? ?r1, _start
 ?? ?add?? ?lr, r0, r1
 ?? ?add?? ?lr, lr, r9
 ?? ?/* setup parameters for board_init_r */
 ?? ?mov?? ?r0, r5?? ??? ?/* gd_t */
 ?? ?mov?? ?r1, r6?? ??? ?/* dest_addr */
 ?? ?/* jump to it ... */
 ?? ?mov?? ?pc, lr
_start表示uboot.bin的絕對開始地址,_board_init_r_ofs是uboot.bin編譯過程中生成的全部符號表board_init_r的地址,由此可以得出board_init_r與——start的偏移地址。
R9存儲拷貝uboot到RAM中的地址,在根據(jù)函數(shù)的偏移地址,可以得出board_init_r函數(shù)在RAM中的地址,直接跳轉到這個地址,即直接執(zhí)行了board_init_r()函數(shù)。
該函數(shù)在arch/arm/lib/board.c中,
該函數(shù)繼續(xù)初始化一些總線與外設,然后進入main_loop() ; 這里面執(zhí)行bootm啟動命令,從Nand等加載uImage執(zhí)行內(nèi)核啟動。
總結
以上是生活随笔為你收集整理的DM3730 uboot 分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: (9) SyGate 4.0实现局域网共
- 下一篇: 第六届全国信息技术应用水平大赛比赛说明(
