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.
Previous article:Learn ARM development (10)
Next article:Learn ARM development(8)
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Please help me check if this circuit is an oscillating circuit.
- "Dating Spring" + A cherry tree in full bloom
- 【Silicon Labs Development Kit Review】+ Key Program Test
- Looking for a software and hardware embedded engineer who works from home, salary is optional
- Only by working hard can you win! The Infineon Gate Driver IC Jigsaw Puzzle Challenge has begun!
- What MCU chips are in short supply now?
- TMS320F28335——SCI serial port
- The sensor amplifier circuit has no output
- Can I create a C program with only a hex file?
- [NXP Rapid IoT Review] Unfinished "IKEA Alarm Clock" and Review Summary