1

u-boot

/u-boot-2018.07-fmxx/include/config.h

/* Automatically generated - do not edit */
#define CONFIG_BOARDDIR board/fmxx/fmql
#include <config_defaults.h>
#include <config_uncmd_spl.h>
#include <configs/fmxx-common.h>
#include <asm/config.h>
#include <linux/kconfig.h>
#include <config_fallbacks.h>

就在想尖括号中的h文件都在哪里搜索

于是去Makefile中找找看线索:

搜索INCLUDE,找到了

UBOOTINCLUDE    := \
        -Iinclude \
        $(if $(KBUILD_SRC), -I$(srctree)/include) \
        $(if $(CONFIG_$(SPL_)SYS_THUMB_BUILD), \
            $(if $(CONFIG_HAS_THUMB2),, \
                -I$(srctree)/arch/$(ARCH)/thumb1/include),) \
        -I$(srctree)/arch/$(ARCH)/include \
        -include $(srctree)/include/linux/kconfig.h

gcc –o main –I../include -DDebug –g main.c
输出文件 头文件搜索目录 定义宏 用于调试 源文件

–I../include  头文件搜索目录

-I dir 在dir这个目录寻找被include的文

2

gd_t结构体在哪里定义呢

u-boot-2018.07-fmxx/common/board_r.c

中用到了DECLARE_GLOBAL_DATA_PTR

DECLARE_GLOBAL_DATA_PTR在arch/arm/include/asm/global_data.h中定义

#include <asm-generic/global_data.h>

#ifdef CONFIG_ARM64
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("x18")
#else
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r9")
#endif

gd_t在u-boot-2018.07-fmxx/include/asm-generic/global_data.h中定义

typedef struct global_data {
    bd_t *bd;
    unsigned long flags;
    unsigned int baudrate;
    unsigned long cpu_clk;        /* CPU clock in Hz!        */
    unsigned long bus_clk;
    /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
    unsigned long pci_clk;
    unsigned long mem_clk;
#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
    unsigned long fb_base;        /* Base address of framebuffer mem */
#endif
#if defined(CONFIG_POST)
    unsigned long post_log_word;    /* Record POST activities */
    unsigned long post_log_res;    /* success of POST test */
    unsigned long post_init_f_time;    /* When post_init_f started */
#endif
#ifdef CONFIG_BOARD_TYPES
    unsigned long board_type;
#endif
    unsigned long have_console;    /* serial_init() was called */
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
    unsigned long precon_buf_idx;    /* Pre-Console buffer index */
#endif
    unsigned long env_addr;        /* Address  of Environment struct */
    unsigned long env_valid;    /* Environment valid? enum env_valid */
    unsigned long env_has_init;    /* Bitmask of boolean of struct env_location offsets */
    int env_load_location;

unsigned long ram_top;        /* Top address of RAM used by U-Boot */
    unsigned long relocaddr;    /* Start address of U-Boot in RAM */
    phys_size_t ram_size;        /* RAM size */
    unsigned long mon_len;        /* monitor len */
    unsigned long irq_sp;        /* irq stack pointer */
    unsigned long start_addr_sp;    /* start_addr_stackpointer */
    unsigned long reloc_off;
    struct global_data *new_gd;    /* relocated global data */

#ifdef CONFIG_DM
    struct udevice    *dm_root;    /* Root instance for Driver Model */
    struct udevice    *dm_root_f;    /* Pre-relocation root instance */
    struct list_head uclass_root;    /* Head of core tree */
#endif
#ifdef CONFIG_TIMER
    struct udevice    *timer;        /* Timer instance for Driver Model */
#endif

const void *fdt_blob;        /* Our device tree, NULL if none */
    void *new_fdt;            /* Relocated FDT */
    unsigned long fdt_size;        /* Space reserved for relocated FDT */
#ifdef CONFIG_OF_LIVE
    struct device_node *of_root;
#endif
    struct jt_funcs *jt;        /* jump table */
    char env_buf[32];        /* buffer for env_get() before reloc. */
#ifdef CONFIG_TRACE
    void        *trace_buff;    /* The trace buffer */
#endif
#if defined(CONFIG_SYS_I2C)
    int        cur_i2c_bus;    /* current used i2c bus */
#endif
#ifdef CONFIG_SYS_I2C_MXC
    void *srdata[10];
#endif
    unsigned int timebase_h;
    unsigned int timebase_l;
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
    unsigned long malloc_base;    /* base address of early malloc() */
    unsigned long malloc_limit;    /* limit address */
    unsigned long malloc_ptr;    /* current address */
#endif
#ifdef CONFIG_PCI
    struct pci_controller *hose;    /* PCI hose for early use */
    phys_addr_t pci_ram_top;    /* top of region accessible to PCI */
#endif
#ifdef CONFIG_PCI_BOOTDELAY
    int pcidelay_done;
#endif
    struct udevice *cur_serial_dev;    /* current serial device */
    struct arch_global_data arch;    /* architecture-specific data */
#ifdef CONFIG_CONSOLE_RECORD
    struct membuff console_out;    /* console output */
    struct membuff console_in;    /* console input */
#endif
#ifdef CONFIG_DM_VIDEO
    ulong video_top;        /* Top of video frame buffer area */
    ulong video_bottom;        /* Bottom of video frame buffer area */
#endif
#ifdef CONFIG_BOOTSTAGE
    struct bootstage_data *bootstage;    /* Bootstage information */
    struct bootstage_data *new_bootstage;    /* Relocated bootstage info */
#endif
#ifdef CONFIG_LOG
    int log_drop_count;        /* Number of dropped log messages */
    int default_log_level;        /* For devices with no filters */
    struct list_head log_head;    /* List of struct log_device */
    int log_fmt;            /* Mask containing log format info */
#endif
} gd_t;

3

1.2.2 create_symlink的规则

# symbolic links
# If arch/$(ARCH)/mach-$(SOC)/include/mach exists,
# make a symbolic link to that directory.
# Otherwise, create a symbolic link to arch/$(ARCH)/include/asm/arch-$(SOC).
PHONY += create_symlink
create_symlink:
ifdef CONFIG_CREATE_ARCH_SYMLINK
ifneq ($(KBUILD_SRC),)
    $(Q)mkdir -p include/asm
    $(Q)if [ -d $(KBUILD_SRC)/arch/$(ARCH)/mach-$(SOC)/include/mach ]; then \
        dest=arch/$(ARCH)/mach-$(SOC)/include/mach;         \
    else                                    \
        dest=arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU));  \
    fi;                                 \
    ln -fsn $(KBUILD_SRC)/$$dest include/asm/arch
else
    $(Q)if [ -d arch/$(ARCH)/mach-$(SOC)/include/mach ]; then   \
        dest=../../mach-$(SOC)/include/mach;            \
    else                                \
        dest=arch-$(if $(SOC),$(SOC),$(CPU));           \
    fi;                             \
    ln -fsn $$dest arch/$(ARCH)/include/asm/arch
endif
endif

注释已经很好解释了create_symlink的行为:

如果arch/$(ARCH)/mach-$(SOC)/include/mach存在,则生成符号链接:arch/$(ARCH)/include/asm/arch --> arch/$(ARCH)/mach-$(SOC)/include/mach
    否则生成符号链接arch/$(ARCH)/include/asm/arch --> arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU));

对基于arm v7架构的bcm2837芯片,arch/arm/math-bcm283x文件夹存在,所以生成链接:
arch/arm/include/asm/arch --> arch/arm/mach-bcm283x/include/mach

简单说来,create_symlink就是将芯片指定的arch/$(ARCH)math-$(SOC)连接到跟芯片名字无关的arch/$(ARCH)/include/asm下。

u-boot include目录 gd_t结构体 如何关联芯片指定的目录的更多相关文章

  1. C++遍历目录+_finddata_t结构体用法

    Struct _finddata_t是用来存储文件各种信息的结构体,使用这个结构体要引用的头文件为“ #include <io.h>”它的结构体定义如下: struct _finddata ...

  2. python如何将指定路径下的某类型文件,返回一个树形结构体,让前端显示为树形的目录结构

    最近遇到一个问题就是某个linux的目录下有各种文件现在的要求是只需要返回.kml格式的文件,并根据前端要求返回如下结构体即:[{'children': [{'children': [{'title' ...

  3. C/C++中的结构体

    结构体定义 结构体(struct)是由一系列具有相同类型或不同类型的数据构成的数据集合,也叫结构.   结构体作用 结构体和其他类型基础数据类型一样,例如int类型,char类型 只不过结构体可以做成 ...

  4. c++中结构体sort()排序

    //添加函数头 #include <algorithm> //定义结构体Yoy typedef struct { double totalprice;         //总价 doubl ...

  5. abap中结构体嵌套结构体。

    1: 结构体中嵌套结构体. *&---------------------------------------------------------------------* *& Re ...

  6. c语言学生信息管理系统-学习结构体

    #include<stdio.h> #include<stdlib.h> //结构体可以存放的学生信息最大个数,不可变变量 ; //学生信息结构体数组,最多可以存放100个学生 ...

  7. C语言基础(19)-结构体,联合体,枚举和typedef

    一.结构体 1.1 结构体struct定义及初始化 #include <stdio.h> // 这个头文件在系统目录下 #include <stdlib.h> // 使用了sy ...

  8. matlab结构体、数组和单元数组类型的创建

    matlab结构体.数组和单元数组类型的创建 @ 目录 matlab结构体.数组和单元数组类型的创建 matlab结构体类型 数组类型 单元数组类型 matlab结构体类型 通过字段赋值创建结构体 创 ...

  9. Go 语言 结构体和方法

    @ 目录 1. 结构体别名定义 2. 工厂模式 3. Tag 原信息 4. 匿名字段 5. 方法 1. 结构体别名定义 变量别名定义 package main import "fmt&quo ...

随机推荐

  1. Activity 的状态都有哪些?

    a) foreground activityb) visible activityc) background activityd) empty process

  2. Ruby小白入门笔记之<Rails项目目录结构>

    一 .流程分析 二.目录分析 DemoRails app (核心) assets  (web前端所需文件) images       (图片) javascripts  (JS代码) styleshe ...

  3. mysql的逻辑架构

    架构图 做Java开发时,项目一般会分为数据访问层.业务逻辑层.控制层等,每层处理不同的任务.类似的,mysql也不是单一的模块,其内部也分为几层.自己不会画,从网上找来了经典的mysql架构图: 分 ...

  4. Libvirt 版本降级过程记录 4.5.0 to 3.9.0

    前言 搞 OpenStack 开发 Libvirt 版本会随着 OpenStack 版本切来切去的,记录一下 Libvirt 从 4.5 降级到 3.9.0 的过程. 步骤 直接 downgrade ...

  5. 安装 Genymotion及其破解版

    https://blog.csdn.net/sxk874890728/article/details/82721746 安装 Genymotion及其破解版 2018年09月16日 11:18:09  ...

  6. vsftp新建用户及目录时遇到的坑

    1.有关vsftp配置及用户权限设置,请参考: http://blog.sina.com.cn/s/blog_3edc5e2e0102vzv8.html 2.需求:公司另一部门要求单独建一目录,来存在 ...

  7. Egret入门学习日记 --- 第五篇(书中 3.5节 内容)

    第五篇(书中 3.5节 内容) 今天得把昨天的问题解决了才行. 去了Q群,碰到一位大大,他给我解惑了.Thanks♪(・ω・)ノ 这是我之前按照书上写的方式写的,并没有效果. 然后大大给我解答了: 后 ...

  8. 如何解决idea本身的乱码以及解决代码中出现的乱码?

    1:解决idea中控制台的乱码现象(3中方法): 第一种: 如图需要找到idea的安装路径: idea\IntelliJ IDEA 2018.3.2\bin 在这个路径下面有一个文件叫:idea64. ...

  9. windows OS安全配置【持续更新20190618】

    https://www.52stu.org/?p=76 来源:5号暗区 5号黯区 五号黯区 5号暗区 windows系统的一些加固方法等 关闭445端口: REG ADD HKLM\SYSTEM\Cu ...

  10. CF-Div.3-B. Minimize the Permutation【模拟·需要清醒的脑子】

    题目传送门 根据字典序,是个人都会想到依次把目前最小的数尽量往前面移动,直到它不能再往前移动,或者已经到了它的期望位置(就是排列的那个位置 比如$i$就应该在位置$i$)为止. 所以我刚开始是这么写的 ...