Last time, I talked about learning ARM assembly. OK, let's start now. My boot program is modified from UBOOT1.1.2. You can download the source code of UBOOT. Maybe you will ask where to download it? I don't need to answer this question. Just use GOOGLE and search for u-boot. You can find it.
Since this boot program is modified from u-boot1.1.2, the compilation tool of uboot is still used. It is arm-linux-tools-20031127.tar.gz. You can download it from the website of uboot, and then install it under Linux, and you can compile the boot program. The compilation commands
are mainly:
make clean is to clear all temporary files, which is generally used to clear the directory and recompile the program.
make XXXX_config is to compile this boot program. XXXX is the development board defined by yourself, in the board directory.
make backup is to back up the source code of the boot program.
After the UBOOT compilation environment is established, you can modify and learn the source code of UBOOT and develop your own boot. The source code has been downloaded, so you can unzip it and find it in the directory u-boot-1.1.3. The latest UBOOT is 1.1.2, and 1.1.3 is my own UBOOT source code. If you want to change the name to 1.1.3, there will be some problems when compiling it under LINUX. Try it yourself. Haha.
Then, I go to the directory cpu/s3c44b0. This directory is the CPU boot program of S3C44B0. The first running code starts from here. So I have to start from here when I look at the code.
Take a look at this directory, including the files:
G:/Downloads/lichee/lichee/boot/src/u-boot-1.1.3/cpu/s3c44b0 Directory
2005-07-18 12:47
2005-07-18 12:47
2005-07-16 04:35 4,154 .depend 2004-02-24
08:16 1,066 config.mk
2004-10-18 05:12 9,878 cpu.c
2004-02-24 08:16 4,843 interrupts.c
2004-02-24 08:16 1,303 Makefile
2004-10-18 05:12 4,378 serial.c
2005-07-17 23:48 4,820 start.S
2005-07-17 23:47 4,784 start.S.bak
There are several files. You can think about their functions by yourself. If you don't understand, ask me. Now I will start to look at the start.S file, which is the first file to run.
This file is written in assembly language, but it is preprocessed by C, so macros in the header file .h can also be used. This is the breadth of GCC. When you see my directory, you may be surprised. Why is there the name "lichee"? Let me tell you, this is the name I gave, called "litchi". My BOOT code and my uClinux code are both called "litchi". People who have eaten "litchi" know that it is red on the outside and white on the inside, sweet and delicious. My BOOT and OS both look good on the outside, but the functions inside are ugly. But you have to understand them in depth to taste the fresh taste.
OK, now I will start to taste my "litchi", the first code:
/*
* S3C44B0 CPU startup code.
* Cai Junsheng 2005/07/17
*
*/
/*
* Include configuration files.
*/
#include
/*
Add version description.
2005/07/16
*/
#include
/*
* Interrupt vector table.
*/
/*
× Declare that the scalar is a global function. After the CPU is powered on, the code will be executed from here.
*/
.globl _start
_start: b reset /* Jump to the reset interrupt start position. */
add pc, pc, #0x0c000000
add pc, pc,
#0x0c000000 add pc
, pc, #0x0c000000 add pc, pc, #
0x0c000000 add pc, pc,
#0x0c000000
add pc, pc, #0x0c000000 add pc, pc, #0x0c000000
add pc, pc, #0x0c000000
.balignl 16,0xdeadbeef
Do you understand the above code? If you don't understand anything, please send me a question.
ARM instructions are used here. The b instruction is to jump to the reset position unconditionally. Reset is a mark, and it is a relative quantity.
add pc, pc, #0x0c000000, this sentence uses the 4G space jump technology, because the next value of ARM's CPU is based on the value of PC. Modifying the value of PC here is equivalent to jumping to the corresponding address to run. And because the width of ARM's instructions is 4 bytes, the PC value here is 0x0c000004. If you use the b instruction directly here, it will not work, because it does not exceed the 32M addressing space. Only by modifying the PC value can you achieve the purpose, so the ADD instruction is used to modify the PC value.
.balignl 16,0xdeadbeef
The above sentence is how many bytes are filled in the back.
The whole code implements the establishment of the interrupt vector table, which is written according to the ARM CPU.
OK, the first code is finished, and the second code will be read next time.
Previous article:Learn ARM development(7)
Next article:Learn ARM development (4)
Recommended ReadingLatest update time:2024-11-15 02:08
- 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
- Free gift of old punch card machine (for disassembly and research)
- I need help from an expert to look at the program and tell me how to modify it so that the buzzer can sound three times and then pause for 0.5 seconds before sounding again.
- Please help me look at this oscillator circuit
- About NCP1236 automatic recovery function test after removing short circuit and overload test
- Zigbee IoT module market: Differences between LTE standard Cat.1 and nbiot wireless communication modules
- A Brief Discussion on FPGA Resource Evaluation
- [Atria Development Board AT32F421 Review] - Experience Sharing
- MCU newbie asks for help regarding data transfer instructions
- MATLAB's UDP communication - How to send large batches of data packets via MATLAB's UDP
- [Blood Oximeter] Disassembly Part 4 Product Trial