当前位置:网站首页>Start of u-boot_ Armboot analysis (I)
Start of u-boot_ Armboot analysis (I)
2022-06-12 23:45:00 【Cheap sword】
- Skip all undefined macro definitions
- This is a uboot Entry function of the second stage
- Function in
lib_arm/board.cin
DECLARE_GLOBAL_DATA_PTR
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
- Defines a register to be placed in r8 Global variable in , Name is gd, A type is a pointer to gd_t Pointer to type variable .
- gd_t stay
include/asm-arm/global_data.hIn the definition of , The contents are as follows
typedef struct global_data {
bd_t *bd;
unsigned long flags;
unsigned long baudrate;
unsigned long have_console; /* serial_init() was called */
unsigned long reloc_off; /* Relocation Offset */
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid? */
unsigned long fb_base; /* base address of frame buffer */
#ifdef CONFIG_VFD
unsigned char vfd_type; /* display type */
#endif
void **jt; /* jump table */
} gd_t;
- These are some configuration files of the board .
bd->bi_arch_numberIt is the machine code of the boardbd->bi_boot_paramsIt's for linux The address of the startup parameter of
Distribution of memory
#ifdef CONFIG_MEMORY_UPPER_CODE
ulong gd_base;
gd_base = CFG_UBOOT_BASE + CFG_UBOOT_SIZE - CFG_MALLOC_LEN - CFG_STACK_SIZE - sizeof(gd_t);
#ifdef CONFIG_USE_IRQ
gd_base -= (CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ);
#endif //CONFIG_USE_IRQ
gd = (gd_t*)gd_base;
#else //CONFIG_MEMORY_UPPER_CODE
gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t));
#endif //CONFIG_MEMORY_UPPER_CODE
/* compiler optimization barrier needed for GCC >= 3.4 */
__asm__ __volatile__("": : :"memory");
memset ((void*)gd, 0, sizeof (gd_t));
gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
memset (gd->bd, 0, sizeof (bd_t));
- Only for the first time gd_base It works for us
- Variable gd_base Refers to gd stay DDR The starting address of memory allocation in
gd_base = CFG_UBOOT_BASE + CFG_UBOOT_SIZE - CFG_MALLOC_LEN - CFG_STACK_SIZE - sizeof(gd_t)The end result is0xc3e00000+(2x1024x1024) - 912*1024 - 512*1024 - 36 = 0xc3e9bfdc- Direct will gd_base Assigned to a global variable gd
- gd->bd stay gd Down
sizeof(bd_t)The location of - combination uboot Start the first phase for the last time sp Pointer setting , The final memory structure is as follows

Hardware initialization
monitor_flash_len = _bss_start - _armboot_start;
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
hang ();
}
}
- Is a global variable
monitor_flash_lenassignment init_fnc_ptrFor the definition ofinit_fnc_t **init_fnc_ptr, and init_func_t For the definition oftypedef int (init_fnc_t) (void);This shows that init_func_t Is a receive parameter void And the return value is int The function type ofinit_sequenceA series of functions are defined in , The function of this code is to execute the initialization function , If any function returns a value other than 0, Serial port output### ERROR ### Please RESET the board ###, And then it goes into an endless loop
边栏推荐
- Summary of MySQL foundation view
- Record 5 - the serial port of stm32f411ceu6 realizes the sending and receiving of fixed length data and variable length data
- Leetcode 2164. Sort odd and even subscripts separately (yes, once)
- Theory + practice will help you master the dynamic programming method
- 2022年G3锅炉水处理考题模拟考试平台操作
- Model over fitting - solution (II): dropout
- Restrictions on MySQL function creation
- How to get Matplotlib figure size
- [kubernetes guide ⑤] label quick start
- H5时代leaflet中还在用DivIcon?
猜你喜欢

2022 questions d'examen pour le personnel de gestion de la sécurité de l'unit é de gestion des produits chimiques dangereux et examen de simulation en ligne

For product managers, which of the two certificates, PMP and NPDP, is more authoritative?

Comprehensive analysis of C array

CV—BaseLine总结(从AlexNet到SENet的发展历程)

Test platform series (97) perfect the case part

NCF 的Dapr应用实例的运行

Based on three JS offshore wind power digital twin 3D effect

Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies

leaflet如何加载10万条数据

Is divicon still used in leaflet in H5 era?
随机推荐
数组
Unprecedented analysis of Milvus source code architecture
How to use Huawei cloud disaster tolerance solution to replace disaster recovery all-in-one machine
Enterprise wechat H5_ Authentication, PC website, enterprise wechat scanning code, authorized login
Talent Weekly - 5
Cherry Blossom powder Dudu
leaflet中如何通过透明度控制layerGroup的显示隐藏
Xi'an Jiaotong 22nd autumn e-commerce technology online expansion resources (IV) [standard answer]
实战 | UI 自动化测试框架设计与 PageObject 改造
Chapter 8 - shared model JUC
2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試
Online examination questions for September examination of financial management
2022年3月11日记:王老师的春天,奇异的模板模式
Abstract methods and abstract classes
How to load 100000 pieces of data in leaflet
2022年危险化学品经营单位安全管理人员考试试题及在线模拟考试
RT thread quick start - experience RT thread
Find out the data that can match the keyword key in field 1 or field 2 in the database table. If you want to display the matching data in field 1 first
OSM map local publishing - how to generate vector maps of provinces and cities
Leetcode 2164. Sort odd and even subscripts separately (yes, once)