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)
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Europe's three largest chip giants re-examine their supply chains
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- The agency predicts that my country's public electric vehicle charging piles will reach 3.6 million this year, accounting for nearly 70% of the world
- U.S. senators urge NHTSA to issue new vehicle safety rules
- Giants step up investment, accelerating the application of solid-state batteries
- Guangzhou Auto Show: End-to-end competition accelerates, autonomous driving fully impacts luxury...
- AD8226 amplifies signal into square wave, please help
- Design and Test of a 2-GHz CMOS RF Low-Noise Amplifier
- Applications of mentor graphics
- Solve the problem that IAR cannot jump to function definition
- Technical parameters of the best 6G vector network analyzer AV3620 in China!
- 430 MCU driver
- Please give me some guidance!
- Free Download | TE White Paper "The Importance of Pressure Sensors in HVAC Refrigeration Systems"
- Things to note when routing high-frequency and high-speed signal lines along the edge of a PCB
- lwip stability issue?