栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

DM3730 uboot 分析

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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 80400000


U-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 environment

Found '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 00002001

ID data ROM  : Gen 1
Part Number  : L3-5000518
Model Name   : SOMDM3730-PHI02-0301R-A
Serial Number: 2520M01457
LAN ethaddr  : 00:08:ee:10:92:ad

Data (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)  Sharp
  3 == LQ036Q1DA01     TFT QVGA    (3.6)   Sharp w/ASIC
  5 == LQ064D343       TFT VGA     (6.4)   Sharp
  7 == LQ10D368        TFT VGA     (10.4)  Sharp
 15 == LQ043T1DG01     TFT WQVGA   (4.3)   Sharp
 28 == LQ043T1DG28     TFT WQVGA   (4.3)   Sharp (DEFAULT)
 vga[-16 OR -24]       LCD VGA     640x480
 svga[-16 OR -24]      LCD SVGA    800x600
 xga[-16 OR -24]       LCD XGA     1024x768
 720p[-16 OR -24]      LCD 720P    1280x720
 sxga[-16 OR -24]      LCD SXGA    1280x1024
 uxga[-16 OR -24]      LCD UXGA    1600x1200

Default `display` environment variable is now being set to: 28

At the U-Boot prompt type commands: `setenv display `, 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.scr

129 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 uImage

3977032 bytes read

== Loading rootfs file rootfs.ext2.gz.uboot to 0x82000000 ==
reading rootfs.ext2.gz.uboot

28842095 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=128000

bootm 0x81000000 0x82000000

## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux-3.0.0-BSP-dm37x-2.4-2
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3976968 Bytes = 3.8 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 82000000 ...
   Image Name:   uboot ext2 ramdisk rootfs
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    28842031 Bytes = 27.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

代码过程

连接脚本 arch/arm/cpu/armv7/u-boot.lds

再看arch/arm/cpu/armv7/start.S  最后调用 arch/arm/lib/board.c的board_init_f().

该函数中,首先调用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,		
#endif
#if defined(CONFIG_BOARD_EARLY_INIT_F)
	board_early_init_f,
#endif
	timer_init,		
#ifdef CONFIG_FSL_ESDHC
	get_clocks,
#endif
	env_init,		
	init_baudrate,		
	serial_init,		
	console_init_f,		
	display_banner,		
#if defined(CONFIG_DISPLAY_CPUINFO)
	print_cpuinfo,		
#endif
#if defined(CONFIG_DISPLAY_BOARDINFO)
	checkboard,		
#endif
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
	init_func_i2c,
#endif
	dram_init,		
	NULL,
};

然后保存ram_size 到gd,初始化gb->fb_base 等gb信息

最后调用relocate_code----》start.S里实现

为什么要relocate_code? 

1.由x-loade可知,其将uboot前的部分代码(比如16k)拷贝到内部RAM的基地址,然后直接跳转到这个地址执行,但是一般的,uboot总是大于16K的,也就是说内部RAM不能完整执行uboot,需要把剩下的uboot搬移到外部RAM的高端地址执行。kernel是在DDR低地址执行的,为避免kernel与uboot地址重叠,需要把uboot搬移到DDR的高端地址执行。

2.某些uboot是从Nor等启动的,需要拷贝到DDR中才能完整执行。

参考[uboot] uboot relocation介绍_Andy_0755的博客-CSDN博客

uboot 跳转入ram执行代码分析(重映射分析)-erlei_2013-ChinaUnix博客

start.S中relocate_code段的如下代码,实现uboot的重定位,跳转到RAM中继续执行uboot

jump_2_ram:
    ldr    r0, _board_init_r_ofs
    adr    r1, _start
    add    lr, r0, r1
    add    lr, lr, r9
    
    mov    r0, r5        
    mov    r1, r6        
    
    mov    pc, lr

_start表示uboot.bin的绝对开始地址,_board_init_r_ofs是uboot.bin编译过程中生成的全部符号表board_init_r的地址,由此可以得出board_init_r与——start的偏移地址。

R9存储拷贝uboot到RAM中的地址,在根据函数的偏移地址,可以得出board_init_r函数在RAM中的地址,直接跳转到这个地址,即直接执行了board_init_r()函数。

该函数在arch/arm/lib/board.c中,

该函数继续初始化一些总线与外设,然后进入main_loop() ; 这里面执行bootm启动命令,从Nand等加载uImage执行内核启动。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1035886.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号