uboot dcc
arch\arm\lib crt0.S
1.设置sp为CONFIG_SYS_INIT_SP_ADDR
include/configs/xxx.h
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \
CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
#define CONFIG_SYS_INIT_RAM_ADDR 0x20000
#define CONFIG_SYS_INIT_RAM_SIZE 0x1000
include/generated/generic-asm-offsets.h
#define GENERATED_GBL_DATA_SIZE 192 /* (sizeof(struct global_data) + 15) & ~15 @ */
CONFIG_SYS_INIT_SP_ADDR=0x20F40
2.调用board_init_f_alloc_reserve
没有定义SYS_MALLOC_F_LEN,不执行。这里不对
make distclean后,CONFIG_SYS_MALLOC_F_LEN默认值0x400
top初始值0x20F40
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
top -= CONFIG_VAL(SYS_MALLOC_F_LEN); #top=0x20B40
#endif
top = rounddown(top-sizeof(struct global_data), 16); #top=0x20A80
3. r9(gd) = sp = top;
gd地址定了。CONFIG_SYS_INIT_SP_ADDR=0x20A80

4.调用board_init_f
注意:串口初始化之后才能打印输出。
setup_dest_addr
#ifdef CONFIG_SYS_SDRAM_BASE
gd->ram_top = CONFIG_SYS_SDRAM_BASE;
#endif
gd->ram_top += get_effective_memsize();
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
gd->relocaddr = gd->ram_top;
debug("Ram top: %08lX\n", (ulong)gd->ram_top);
gd->ram_top=0x20000+0x40000=0x60000
gd->relocaddr=gd->ram_top=0x60000
reserve_uboot --> Reserving 192k for U-Boot at: 0002f000 gd->relocaddr到此为止,之后gd->start_addr_sp出场
reserve_malloc --> Reserving 4k for malloc() at: 0002de70
reserve_board --> Reserving 80 Bytes for Board Info at: 0002de20
reserve_global_data --> Reserving 192 Bytes for Global Data at: 0002dd60 gd->new_gd
reloc_fdt --> 因为CONFIG_OF_EMBED,所以不执行什么
reloc_bootstage --> 因为没有定义CONFIG_BOOTSTAGE,所以不执行什么
reserve_arch --> 空
reserve_stacks --> gd->start_addr_sp -= 16; gd->start_addr_sp &= ~0xf; 调用arch_reserve_stacks(定义在arch\arm\lib\stack.c)gd->start_addr_sp -= 16; 一共减32byte
display_new_sp --> New Stack Pointer is: 0002dd40
setup_reloc --> gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start; gd->relocaddr=0002f000 __image_copy_start就是CONFIG_SYS_TEXT_BASE=0x2f000
Relocation Offset is: 00000000
Relocating to 0002f000, new gd at 0002dd60, sp at 0002dd40
ldr r0, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp */
bic r0, r0, #7 /* 8-byte alignment for ABI compliance */
mov sp, r0 //定义新sp 之前为0x21000
ldr r9, [r9, #GD_BD] /* r9 = gd->bd */
sub r9, r9, #GD_SIZE /* new GD is below bd */
adr lr, here
ldr r0, [r9, #GD_RELOC_OFF] /* r0 = gd->reloc_off */
add lr, lr, r0
#if defined(CONFIG_CPU_V7M)
orr lr, #1 /* As required by Thumb-only */
#endif
ldr r0, [r9, #GD_RELOCADDR] /* r0 = gd->relocaddr */
b relocate_code
如果gd->relocaddr和__image_copy_start相等
ldr r1, =__image_copy_start /* r1 <- SRC &__image_copy_start */
subs r4, r0, r1 /* r4 <- relocation offset */
beq relocate_done /* skip relocation */
就跳过搬移。
所以整个过程中,搬移的就只有gd_t。
如何计算defconfig中的CONFIG_SYS_TEXT_BASE
vi u-boot.map
setup_mon_len中
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
reserve_uboot
gd->relocaddr -= gd->mon_len;
__bss_end
0x000000000005f3a0
.__image_copy_start
0x0000000000033000
gd->mon_len=0x2c3a0
gd->relocaddr=gd->ram_top-gd->mon_len(u-boot)=0x60000-0x2c3a0=0x33c60
后三位清零,4K对齐 gd->relocaddr &= ~(4096 - 1);
gd->relocaddr=0x33000
即CONFIG_SYS_TEXT_BASE设置为gd->relocaddr=0x33000__image_copy_start
即可跳过搬移。
uboot dcc的更多相关文章
- 调试dcc 试图将u-boot放入ocm运行碰到的问题
1. 起因: gd->mon_len = (ulong)&__bss_end - (ulong)_start; 在u-boot.map中查找,发现__bss_end并不是u-boot.b ...
- 用Qemu模拟vexpress-a9 (五) --- u-boot引导kernel,device tree的使用
环境介绍 Win7 64 + Vmware 11 + ubuntu14.04 32 u-boot 版本:u-boot-2015-04 Linux kernel版本:linux-3.16.y busyb ...
- Linux主机上使用交叉编译移植u-boot到树莓派
0环境 Linux主机OS:Ubuntu14.04 64位,运行在wmware workstation 10虚拟机 树莓派版本:raspberry pi 2 B型. 树莓派OS: Debian Jes ...
- uboot环境配置
uboot环境配置 通过配置uboot让它在启动过程中从tftp获取内核和设备树,并从在加载内核之后把通过启动参数将"从nfs挂载根文件系统"传入内核.这个配置主要是通过uboot ...
- u-boot-2015.04 在tq2440上的移植(使用spl引导u-boot)
本次移植跟以往的不同之处是采用了spl来引导u-boot,参考了博客http://blog.csdn.net/fulinus/article/details/42738641 下载链接:http:// ...
- u-boot源码分析之C语言段
题外话: 最近一直在学习u-boot的源代码,从代码量到代码风格,都让我认识到什么才是真正的程序.以往我所学到的C语言知识和u-boot的源代码相比,实在不值一提.说到底,机器都是0和1控制的.感觉这 ...
- u-boot源码汇编段简要分析
Hi,大家好!我是CrazyCatJack,你们可以叫我CCJ或者疯猫.今天我给大家带来的是u-boot的源代码汇编段分析,以后还会给大家讲解后续的C代码,请持续关注哦^_^ 先简单说一下u-boot ...
- u-boot的配置、编译及链接
第一次写技术博客,还有些兴奋呢.我是CrazyCatJack,大家可以叫我CCJ或者疯猫.我即将成为一名嵌入式Linux的驱动工程师,现在还是一枚大四狗,呼呼~大学期间做了一些项目和比赛,都是基于32 ...
- uboot的配置流程分析
简单介绍一下uboot的基本配置流程.和绝大多数源码编译安装一样,uboot在执行make之前需要执行make XXXconfig来配置相关信息,而且uboot本身是针对多种平台的bootloader ...
随机推荐
- [Flask]通过render_form快捷渲染表单
依赖: Bootstrap-Flask 实例化方式与flask_bootstrap相同. 关于render_form(): Bootstrap-Flask内置了两个用于渲染WTForms表单类的宏,r ...
- 正向代理与反向代理以及Nginx【总结】(转)
今天在了解Nginx的时候,涉及到反向代理的问题,看到一篇博文写的清晰明了,转载记录一下,后续继续学习,再次感谢博主的分享. 原文地址:https://www.cnblogs.com/Anker/p/ ...
- http详解之post 2
-----------------------post请求示例----------------#请求行POST https://re.csdn.net/csdnbi HTTP/1.1 #请求头部开始H ...
- 新增存储用Parted分区并建LVM卷
新增存储用Parted分区并建LVM卷 一,Parted分区 1,parted分区 www.ahlinux.com # parted /dev/sda GNU Parted 2.1 使用 /dev/ ...
- mingw 编译 libopus 1.3.1 时 注意事项
OPUS_STACK_PROTECTOR 默认是使用的, 在 windows 上编译时一定要去掉选项不然 -lopus 链接时出现错误undefined reference to `__stack_c ...
- 【MM系列】SAP S/4 HANA 1511的BP角色创建及供应商数据的创建方法
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP S/4 HANA 1511的 ...
- python学习之数据类型(dic)
3.8 字典 3.8.1 字典的介绍 字典(dict)是python中唯一的一个映射类型,它是以{ }括起来的键值对组成,在dict中key是唯一的.在保存的时候,根据key来计算出一个内存地址, ...
- web.xml文件的的param-name
第一个阶段 配置阶段 web.xml配置,如下图 第二个阶段 初始化阶段 init(ServletConfig config) 1.加载配置文件 获取web.xml文件的的param-name ...
- windows VS2013中使用<pthread.h>
1. 下载pthreads-w32-2-9-1-realease.zip 地址:http://www.mirrorservice.org/sites/sourceware.org/pub/pthrea ...
- Notepad++ 不打开历史文件
1. 自己的很多虚拟机上面安装了notepad++ 提高编辑文件的速度. 但是发现 有时候总是默认打开 很多 历史文件 会造成很卡顿. 2. 解决办法 如下图 设置->首选项 3. 具体的位置为 ...