ARM assembly language organizes source files in segments (divided into code segments and data segments). An ARM source program must have at least one code segment, and a large program can contain multiple code segments and data segments.
Code segments are usually read-only.
Zero or more data sections containing initial values. Usually readable.
Zero or more data segments that do not contain initial values. These data segments are initialized to zero and are usually readable.
like:
1. Entrance
AREA Init,CODE,READONLY
ENTRY
--------------------The ENTRY pseudo-operation identifies the first instruction executed by the program. An ARM program must have at least one ENTRY.
END tells the assembly compiler to end compiling the source file. Every assembly must contain an END
2. Subroutine call
BL Subroutine call name
The BL instruction performs two operations: placing the subroutine return address in the LR register and setting the PC register value to the first instruction address of the target subroutine. Subroutine calls usually use registers R0 to R3 to return results and pass parameters.
There are a lot of subroutine call examples in 2440init.s
;================================================== ==========
ReadNandID
mov r7,#NFCONF
ldr r0,[r7,#4] ;NFChipEn();
bic r0,r0,#2
str r0,[r7,#4]
mov r0,# 0x90 ;WrNFCmd(RdIDCMD);
strb r0,[r7,#8]
mov r4,#0 ;WrNFAddr(0);
strb r4,[r7,#0xc]
;================================================== ==========
1 ;while(NFIsBusy());
ldr r0,[r7,#0x20]
tst r0,#1
beq %B1
ldrb r0,[r7,#0x10] ;id = RdNFDat( )<<8;
mov r0,r0,lsl #8
ldrb r1,[r7,#0x10] ;id |= RdNFDat();
orr r5,r1,r0
ldr r0,[r7,#4] ;NFChipDs();
orr r0,r0,#2
str r0,[r7,#4]
mov pc,lr
-----------------------------------Looking at the two examples above, the only difference is that the latter one has mov pc,lr, which indicates that after the program is completed, it will return to the next sentence of the program BL for execution.
Previous article:ARM microprocessor architecture
Next article:Summary of ARM assembly instruction learning
Recommended ReadingLatest update time:2024-11-16 21:23
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Two modes of offline programming for F28379D
- Proteus8.9 detailed Chinese tutorial help
- Solution to the error when downloading the CCS program
- Image of square wave-triangle wave waveform transformation
- A simple tutorial on using the domestic FPGA GOWIN software
- Problems of electromagnetic flowmeter in daily water supply application
- Please share the minimum system schematic of dsPIC33EP32MC204
- TI eSMO library Fsmopos and Gsmopos parameter analysis
- MOS tube gate drive circuit
- Data Structures in Embedded System Software Design