When we wrote bare metal programs before:
Initialization: turn off the watchdog, initialize the clock, and initialize SDRAM;
Copy the program from nand to SDRAM;
Set sp and call C language function;
Continue execution...
As an integrator of bare metal programs, uboot can do all of these, and it also needs to read the kernel and start the kernel.
As analyzed before, uboot will call cpu/arm920t/start.S first when it is powered on. Let's start the analysis from this file.
First it will jump to the reset section.
Then set the CPU to SVC32 mode (supervisory mode) and turn off the watchdog.
The fourth step is to set the clock. The video uses function calls, but I used assembly after patching locally. I won’t go into details here, just focus on understanding.
From here, we can see how the stack is divided. Starting from 0x33F80000, it is followed by the heap, bdinfo, interrupt stack, and 3-byte interrupt stack. Among them, the memory from 0x33F80000 to 0x34000000 is uboot, which has 512 bytes.
Then the clock initialization function is called.
Then relocate the code to the link address.
Finally, the start_armboot function is called, which is a C language function, and more complex functions are implemented in it.
Analyzing from top to bottom, start.S does the following:
Set to SVC mode;
Close the watchdog;
Shield interrupts;
Initialize SDRAM;
Set up the stack;
Clock configuration;
Relocation, copy the code from Flash to SDRAM;
Clear the bss segment (global variables and static variables whose initial value is 0 or uninitialized);
Call start_armboot;
The above are all hardware-related initializations. The last step is a C function. More complex functions are implemented in this function. 1 to 8 are called the first stage, and the second stage is after start_armboot.
Previous article:1_5.1.2_U-boot analysis and use_u-boot analysis Makefile structure analysis_P
Next article:1_5.1.5_U-boot analysis and use_u-boot analysis u-boot command implementation_P
- 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
- What exactly is the difference between IBUFDS and IBUFGDS
- RF Ground - RF is not what you think "ground" is
- Nuvoton 003 Series Platform MS51 Replacement Update N76E003 Guide V1.0
- I, I, I have a question about relays and analog switches...
- Smart TFT with LUA script, making Tetris is so easy
- Last day! Apply for GD32VF series development board and new ATMEGA4809 for free, grab the last train and get on it!
- "Thank you for being here, thank you for the gift" - Thanksgiving Day Grab the Building & Give Thank You Gift Event
- Electronic component failure analysis and typical cases
- Hongmeng Development Board Neptune (VI) - Source Code Compilation 3
- When TEA1062 is on a call, the receiver is very quiet and no sound comes out of the MIC