board_init_f在/u-boot-2018.07-fmxx/arch/arm/mach-fmxx/spl.c中定义

board_init_f
之后,和转载的部分有出入: u-boot-2018.07-fmxx/arch/arm/lib/crt0.S 来仔细分析如下代码: #if ! defined(CONFIG_SPL_BUILD) //不执行 /*
 * Set up intermediate environment (new sp and gd) and call
 * relocate_code(addr_moni). Trick here is that we'll return
 * 'here' but relocated.
 */     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
    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
here:
/*
 * now relocate vectors
 */     bl    relocate_vectors /* Set up final (full) environment */     bl    c_runtime_cpu_setup    /* we still call old routine here */
#endif //#if ! defined(CONFIG_SPL_BUILD) 因为定义了CONFIG_SPL_BUILD 所以不包含上述段落 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_FRAMEWORK) //!defined(CONFIG_SPL_BUILD)为假 defined(CONFIG_SPL_FRAMEWORK) 为真 下面代码执行
# ifdef CONFIG_SPL_BUILD //执行
    /* Use a DRAM stack for the rest of SPL, if requested */
    bl    spl_relocate_stack_gd //common/spl/spl.c中定义
    cmp    r0, #0
    movne    sp, r0
    movne    r9, r0
# endif
    ldr    r0, =__bss_start    /* this is auto-relocated! */ #ifdef CONFIG_USE_ARCH_MEMSET //执行
    ldr    r3, =__bss_end        /* this is auto-relocated! */
    mov    r1, #0x00000000        /* prepare zero to clear BSS */     subs    r2, r3, r0        /* r2 = memset len */
    bl    memset
#else //不执行
    ldr    r1, =__bss_end        /* this is auto-relocated! */
    mov    r2, #0x00000000        /* prepare zero to clear BSS */ clbss_l:cmp    r0, r1            /* while not at end of BSS */
#if defined(CONFIG_CPU_V7M) //不执行
    itt    lo
#endif
    strlo    r2, [r0]        /* clear 32-bit BSS word */
    addlo    r0, r0, #4        /* move to next */
    blo    clbss_l
#endif // CONFIG_USE_ARCH_MEMSET #if ! defined(CONFIG_SPL_BUILD) //不执行
    bl coloured_LED_init
    bl red_led_on
#endif
    /* call board_init_r(gd_t *id, ulong dest_addr) */
    mov     r0, r9                  /* gd_t */
    ldr    r1, [r9, #GD_RELOCADDR]    /* dest_addr */
    /* call board_init_r */
#if CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
    ldr    lr, =board_init_r    /* this is auto-relocated! */
    bx    lr
#else //执行
    ldr    pc, =board_init_r    /* this is auto-relocated! */
#endif //CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
    /* we should not return here. */
#endif ENDPROC(_main) 大概流程是
bl    spl_relocate_stack_gd
bl    memset  //bss清零
ldr    pc, =board_init_r //跳转到board_init_r

一般SPL会定义CONFIG_SPL,
在common/spl/Kconfig中
config SPL_FRAMEWORK
    bool "Support SPL based upon the common SPL framework"
    depends on SPL
    default y
默认选中SPL_FRAMEWORK 到底使用那个函数,要看Makefile和config的值 board_init_r在common/spl/spl.c中定义 该函数中有些调用
比如spl_board_init 在/u-boot-2018.07-fmxx/arch/arm/mach-fmxx/spl.c中定义
而spl_board_init又调用了preloader_console_init在common/spl/spl.c中定义
https://blog.csdn.net/voice_shen/article/details/17373671

https://www.cnblogs.com/maxpak/p/5593019.html

[uboot] (第三章)uboot流程——uboot-spl代码流程 后续2018版本分析的更多相关文章

  1. u-boot移植(三)---修改前工作:代码流程分析2

    一.vectors.S 1.1 代码地址 vectors.S (arch\arm\lib) 1.2 流程跳转 跳转符号 B 为 start.S 中的 reset 执行代码,暂且先不看,先看看 vect ...

  2. 第三章、Tiny4412 U-BOOT移植三 时钟设置【转】

    本文转自:http://blog.csdn.net/eshing/article/details/37521789 这一章说明配置时钟频率基本原理 OK,接着说,这次先讲讲CPU的系统时钟.U-BOO ...

  3. C语言 第三章 关系、逻辑运算与分支流程控制

    目录 一.关系运算 二.逻辑运算 三.运算优先级 四.if语句 4.0.代码块 4.1.单if语句 4.2.if else 4.3.多重if 4.4.?号:号表达式 五.switch语句 一.关系运算 ...

  4. SpringMvc执行流程及底层代码流程

    SpringMVC执行流程   01.客户端发送请求被我们在web.xml中配置DispatcherServlet(核心控制器)拦截: 默认执行DispatcherServlet中的 protecte ...

  5. git 一般的开发流程中的代码管理

    一般的开发流程中的代码管理 1. 从版本库中下载代码 git clone ssh://wenbin@192.168.1.3:29418/mustang-web 2. 针对某个feature(比如ins ...

  6. [uboot] (第三章)uboot流程——uboot-spl代码流程

    http://blog.csdn.net/ooonebook/article/details/52957395 以下例子都以project X项目tiny210(s5pv210平台,armv7架构)为 ...

  7. [uboot] (第三章)uboot流程——uboot-spl代码流程(转)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/ooonebook/article/det ...

  8. [uboot] (第五章)uboot流程——uboot启动流程

    http://blog.csdn.net/ooonebook/article/details/53070065 以下例子都以project X项目tiny210(s5pv210平台,armv7架构)为 ...

  9. [uboot] (第四章)uboot流程——uboot编译流程

    http://blog.csdn.net/ooonebook/article/details/53000893 以下例子都以project X项目tiny210(s5pv210平台,armv7架构)为 ...

随机推荐

  1. cmake生成Makefile时指定c/c++编译器

    cmake .. -DCMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/g++ -DCMAKE_C_COMPILER:FILEPATH=/usr/local/bin ...

  2. Aes加密/解密示例项目

    #AesEncrypt:Aes加密/解密示例项目 <br> 附件中的“AesEncrypt.zip”是本项目的exe文件,可直接下载下来运行和查看. *高级加密标准(英语:Advanced ...

  3. Docker在windows环境下的安装部署

    一.准备 系统环境:Windows 10 64bit Docker安装包:Docker for Windows Installer.exe 二.安装步骤 1.开启系统的hyper-v 2. 重启电脑后 ...

  4. python高级 之(一) --- 函数类型

    函数 模块 模块: 一个py文件就是一个模块, 每个模块之间是可以相互访问的 访问之前需要进行导入 分类: 1.系统提供的模块 math random 2.自己自定义的,自己封装的常用功能的的py文件 ...

  5. 网络编程介绍,C/S 架构,网络通讯协议,osi七层

    网络编程: 什么是网络编程: 网络通常指的是计算机中的互联网,是由多台计算机通过网线或其他媒介相互链接组成的 编写基于网络的应用程序的过程序称之为网络编程 为什么要学习网络编程: 我们已经知道计算机, ...

  6. CentOS下Subversion(SVN)的快速安装与配置

    如果你是一个软件开发者,你一定对Subversion不会感到陌生.Subversion是一个自由开源的版本控制系统.在Subversion管理下,文件和目录可以超越时空.Subversion将文件存放 ...

  7. SLAM+语音机器人DIY系列:前言

    ------SLAM+语音机器人DIY系列[目录]快速导览------ 第1章:Linux基础 1.Linux简介 2.安装Linux发行版ubuntu系统 3.Linux命令行基础操作 第2章:RO ...

  8. java初学者编译简单的计算机

    package com.yj.test; import java.awt.BorderLayout; import java.awt.Font; import java.awt.GridLayout; ...

  9. delphi 连接各中数据库方法

    ---恢复内容开始--- 数据库连接字符串的拼写规则的决定条件: • 连接的数据库的类型:SQL Server,Oracle,MySQL,Acess,MogoDB,Visual FoxPro(dBAS ...

  10. 2019中山纪念中学夏令营-Day19 数论初步【GCD(最大公约数),素数相关】

    关于GCD的一些定理或运用的学习: 1. 2.二进制算法求GCD 思想:使得最后的GCD没有2(提前把2提出来) 代码实现: #include <cstdio> #define int l ...