Learn ARM development(9)

Publisher:BlissfulBlissLatest update time:2024-11-14 Source: cnblogs Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Last time, I finished reading the boot assembly and prepared the C operating environment. Now I will start to learn the C source code and jump from the start.S file to the file
lib_arm/board.c to run.
/*
The boot program jumps from the assembly start.S to here to execute.
Cai Junsheng 2005/07/19
*/
void start_armboot (void)
{
/* Declare a global pointer, which points to a data structure for storing parameters.
And it occupies the r8 register, which is used to store memory addresses for global use.
*/
DECLARE_GLOBAL_DATA_PTR;

ulong size;
init_fnc_t **init_fnc_ptr;
char *s;

#if defined(CONFIG_VFD) || defined(CONFIG_LCD)
unsigned long addr;
#endif

/* The gd pointer can be written because a register has been assigned to it as a variable.
This is equivalent to saving the address calculated later to the r8 register.
*/
gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t));

/* The following sentence prevents GCC versions above 3.4 from optimizing the code and deletes the following code. */
__asm__ __volatile__("": ​​: :"memory");

/* Clear the structure pointed to by gd*/
memset ((void*)gd, 0, sizeof (gd_t));

/* */
gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
memset (gd->bd, 0, sizeof (bd_t));

monitor_flash_len = _bss_start - _armboot_start;
This section prepares the global variable area for saving parameters.
The following is a series of initializations and obtaining the correct parameters.

Reference address:Learn ARM development(9)

Previous article:Learn ARM development (10)
Next article:Learn ARM development(8)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号