近期在做uboot中nand启动相关的工作,遇到一个问题一直纠结着。如今最终明确了这个问题,想想还有好多兄弟在某个黑暗的角落里或者某台电脑前纠结着呢,所以赶紧写下来以供查阅。

uboot version 2014.4

/* Architecture-specific global data */

struct arch_global_data {

#if defined(CONFIG_FSL_ESDHC)

u32 sdhc_clk;

#endif

#ifdef CONFIG_AT91FAMILY

/* "static data" needed by at91's clock.c */

unsigned long
cpu_clk_rate_hz;

unsigned long
main_clk_rate_hz;

unsigned long
mck_rate_hz;

unsigned long
plla_rate_hz;

unsigned long
pllb_rate_hz;

unsigned long
at91_pllb_usb_init;

#endif

/* "static data" needed by most of timer.c on ARM platforms */

unsigned long timer_rate_hz;

unsigned long tbu;

unsigned long tbl;

unsigned long lastinc;

unsigned long long timer_reset_value;

#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))

unsigned long tlb_addr;

unsigned long tlb_size;

#endif





#ifdef CONFIG_OMAP

struct omap_boot_parameters omap_boot_params;

#endif

};





#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的定义,而且能够知道气质这个结构体的定义是在:#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) || defined(CONFIG_LOGBUFFER)

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 */

#ifdef CONFIG_PRE_CONSOLE_BUFFER

unsigned long precon_buf_idx;
/* Pre-Console buffer index */

#endif

#ifdef CONFIG_MODEM_SUPPORT

unsigned long do_mdm_init;

unsigned long be_quiet;

#endif

unsigned long env_addr;
/* Address  of Environment struct */

unsigned long env_valid;
/* Checksum of Environment valid? */





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 device
*dm_root; /* Root instance for Driver Model */

struct list_head uclass_root;
/* Head of core tree */

#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 */

void **jt;
/* jump table */

char env_buf[32];
/* buffer for getenv() 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

unsigned long timebase_h;

unsigned long timebase_l;

struct arch_global_data arch;
/* architecture-specific data */





#ifdef CONFIG_xxxxx   //此处随便x

void *priv;
/* point to the private data */

#endif

} gd_t;

在使用的过程中包括头文件,就能够使用了。

uboot中gd的定义和使用的更多相关文章

  1. tiny4412 串口驱动分析一 --- u-boot中的串口驱动

    作者:彭东林 邮箱:pengdonglin137@163.com 开发板:tiny4412ADK+S700 4GB Flash 主机:Wind7 64位 虚拟机:Vmware+Ubuntu12_04 ...

  2. Uboot中start.S源码的指令级的详尽解析【转】

    本文转载自:http://www.crifan.com/files/doc/docbook/uboot_starts_analysis/release/html/uboot_starts_analys ...

  3. uboot中添加FIQ中断及相关问题

    本文主要说明了在uboot中添加FIQ中断时遇到的问题以及对应的解决办法. 首先交代一下项目的软硬件环境.硬件方面,使用s3c2440作为主控芯片,外接串口.网卡等设备.软件方面,主控芯片上电后运行u ...

  4. u-boot中nandflash初始化流程分析(转)

    u-boot中nandflash初始化流程分析(转) 原文地址http://zhuairlunjj.blog.163.com/blog/static/80050945201092011249136/ ...

  5. u-boot中分区和内核MTD分区关系

    一.u-boot中环境变量与uImage中MTD的分区关系 分区只是内核的概念,就是说A-B地址放内核,C-D地址放文件系统,(也就是规定哪个地址区间放内核或者文件系统)等等. 一般我们只需要分3-4 ...

  6. uboot-tiny4412启动流程(下)----如何将自己的裸板测试程序加入uboot中启动测试

    今天在工作上搞了一天高通的芯片uboot程序,目的是希望将一个裸板的程序移植到uboot中,并且开机让它运行.这个芯片是NXP4330,目前是高通的一个芯片,基于ARM-contexA9架构,那么就跟 ...

  7. 基于335X平台的UBOOT中交换芯片驱动移植

    基于335X平台的UBOOT中交换芯片驱动移植 一.软硬件平台资料 1.开发板:创龙AM3359核心板,网口采用RMII形式. 2.UBOOT版本:U-Boot-2016.05,采用FDT和DM. 3 ...

  8. uboot中的快捷菜单的制作说明 【转】

    转自:http://blog.chinaunix.net/uid-22030783-id-366971.html   在uboot中加入快捷操作菜单的方法非常简单,在论坛发布的uboot201003V ...

  9. 七、在U-boot中让LCD显示图片

    1. 增加Nandflash读取代码 因为要显示图片,而图片明显是放在Nandflash中比较合适,因此需要有能够操作Nandflash的函数.在U-boot中已经有能操作Nandflash的函数了, ...

随机推荐

  1. 8.20 usaco

    summary:14 1.k短路 2.tarjan缩无向图点 3.复习了SA 4.差分约束 5.求第二短路 洛谷3824:dfs优化背包.开始的时候mle了,然后我就把a[i],w[i]去掉....就 ...

  2. 使用hibernate tools插件生成POJO

    很多时候我们已经设计好了数据库,需要使用hibernate来做数据持久化,因此需要根据数据库中的表结构生成相应的POJO. 本例使用hibernatetools来自动创建pojo. 测试环境:ecli ...

  3. Java [Leetcode 273]Delete Node in a Linked List

    题目描述: Write a function to delete a node (except the tail) in a singly linked list, given only access ...

  4. 普通文件迁移ASM

    1.ASM Access Through FTP and HTML Using XDB Configuration 2.rman 3.dbms_file_transfer 4.11g asmcmd 利 ...

  5. (转)solr排序OOM解决方法

    转自 http://topcat.iteye.com/blog/1293650 问题 lucene使用排序时会将被排序字段全部加入内存再进行排序,当多次使用不同字段进行排序时会造成OOM问题 解决方案 ...

  6. HDU 3711 Binary Number

    Binary Number Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

  7. C# 有关文件路径的操作

    1. 由文件全路径,获取文件扩展名.文件名等信息 string fullPath = @"\WebSite1\Default.aspx"; string filename = Sy ...

  8. linux防火墙启动、停止、查看

    停止防火墙 service iptables stop 启动防火墙 service iptables start 查看防火墙配置 iptables -L -n 修改的内容只是暂时保存在内存中,如果重启 ...

  9. 《深入Java虚拟机学习笔记》- 第8章 连接模型

    Java虚拟机学习笔记(八)连接模型

  10. 解决session失效之后登陆后重新返回之前的页面

    在全局拦截器设置保存之前的url存入session中 登陆之后的地址再重session中存 request只用作一次请求 如果页面跳转几次的话原来的url就不存在了建议存在session @Overr ...