Learn ARM development (6)

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

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.
Reference address:Learn ARM development (6)

Previous article:Learn ARM development(7)
Next article:Learn ARM development (4)

Recommended ReadingLatest update time:2024-11-15 02:08

TQ210——S5PV210 uboot top-level config.mk analysis
# # (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this # project. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Soft
[Microcontroller]
uboot porting on s3c2440 (6)
1. Transplantation Environment Host: VMWare--Fedora 9 Development board: Mini2440--64MB Nand, Kernel: 2.6.30.4 Compiler: arm-linux-gcc-4.3.2.tgz u-boot:u-boot-2009.08.tar.bz2 2. Transplantation Steps 10) u-boot uses tftp service to download the kernel and use
[Microcontroller]
uboot porting on s3c2440 (6)
51 single-chip 8-bit digital tube electronic clock simulation diagram and source code
The 8-digit digital tube is used to display the time. The principle is basically the same as that of the 4-digit digital tube display. Simulation diagram: Program source code: This program has been produced through online software simulation and hardware. org 0000h ; program start entry address sjmp main ; jump to
[Microcontroller]
51 single-chip 8-bit digital tube electronic clock simulation diagram and source code
The uboot in the OK6410 CD cannot download files using TFTP?
Whether using ping or tftp, it shows CS8900 Ethernet chip not found?! I checked uboot1.1.6/include/configs/smdk6410.h, and it is indeed configured to use CS8900 as the network card. When will the uboot source code configured for DM9000 be released? Or a patch will be fine The solution to this problem is very sim
[Microcontroller]
TQ210 study notes - uboot code migration
Learning materials: TQ210 development board + Guoqian teaching video ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Code migration: refers to the process of moving the remaining boot code to the memory during the boot process (for 210, when the bootloader code is larger than 96KB, BL2 must be moved to the memor
[Microcontroller]
TQ210 study notes - uboot code migration
Simple and easy-to-understand startup process of uboot
static ulong get_PLLCLK(int pllreg) {     S3C24X0_CLOCK_POWER* const clk_power = S3C24X0_GetBase_CLOCK_POWER();     ulong r, m, p, s;     if (pllreg == MPLL)     r = clk_power- MPLLCON;     else if (pllreg == UPLL)     r = clk_power- UPLLCON;     else     hang();     m = ((r & 0xFF000) 12) + 8;     p = ((r & 0x00
[Microcontroller]
Simple and easy-to-understand startup process of uboot
S5PV210 development board flashing (SD card uboot, serial port + USB-OTG flashing method)
1. Introduction        Jiuding's S5PV210 development board has been flashed with Android 4.0 system by default before leaving the factory. If you need to flash other systems or cannot start due to system problems, you need to flash the board.        In fact, flashing the machine is a basic learning of the 210 developm
[Microcontroller]
Single chip heart rate meter source code
Place your index finger gently on the sensor, and you will see the LED indicator light flashing with your heartbeat. The arteries in the fingertips of the human body are well developed. When the arteries contract and relax periodically with the heart, the blood volume in the blood vessels will also change. The abo
[Microcontroller]
Single chip heart rate meter source code
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号