近期在做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. C#中判断一个网址是否可以打开

    public static void GetPage(String url) { try { // Creates an HttpWebRequest for the specified URL. H ...

  2. Nginx SPDY缓冲区溢出漏洞

    漏洞版本: nginx 1.3.15 nginx 1.5.x 漏洞描述: CVE ID:CVE-2014-0133 Nginx是HTTP及反向代理服务器,同时也用作邮件代理服务器,由Igor Syso ...

  3. ↗☻【HTML5秘籍 #BOOK#】第4章 Web表单

    from元素用于组织所有表单部件,负责告诉浏览器把数据提交到哪里,方法是在action属性中提供一个URL.假如你只想在客户端使用JavaScript操作表单,那么只要在action属性中指定一个#即 ...

  4. jquery Ajax应用总结

    常见应用: 下面是Jquery中AJAX参数详细列表: 参数名 类型 描述 url String (默认: 当前页地址) 发送请求的地址. type String (默认: "GET&quo ...

  5. CentOS6.5_Nginx1.40_Php5.57_MySQL5.5.35编译安装全记录

    环境说明:CentOS 6.5 32位  PHP Version 5.5.7  mysql version _5.6.16 一.准备工作 配置防火墙,允许防火墙通过22(sshd).80(WEB).3 ...

  6. apache开源项目--OpenMeetings

    OpenMeetings是一个多语言可定制的视频会议和协作系统.它支持音频.视频,能让你查看每个与会者的桌面.OpenMeetings还包含一个白板,通过白板可以导入各种格式的图片和涂鸦. 在线演示: ...

  7. 20个非常绚丽的 CSS3 特性应用演示

    这篇文章收集了20个非常绚丽的 CSS3 效果应用演示,这些示例演示了 CSS3 各种新特性的强大能力.随着越来越多的浏览器对 CSS3 支持的不断完善,设计师和开发者们有了更多的选择,以前需要使用  ...

  8. 设计模式_Proxy_代理模式

    形象例子: 跟MM在网上聊天,一开头总是“hi,你好”,“你从哪儿来呀?”“你多大了?”“身高多少呀?”这些话,真烦人,写个程序做为我的Proxy吧,凡是接收到这些话都设置好了自动的回答,接收到其他的 ...

  9. Mongodb操作总结

    1.Mongovue里面可以直接group by ,这个时候一定要注意,group by的任何条件的是 json, 注意当值是Int,非string型的时候,值不要加上双引号 2.注意group by ...

  10. activemq 异步和同步接收

    来点实在的代码,用例子来说明: 1.异步接收,主要设置messageListener.,然后编写onmessage方法,很简单 a.客户端发送5条消息 package ch02.chat; impor ...