An executable image file usually consists of the following parts:
— One or more code segments, the properties of the code segments are read-only.
— Zero or more data segments containing initialized data. The data segments are readable and writable.
— Zero or more data segments that do not contain initialized data, and the attributes of the data segments are readable and writable.
The linker arranges each segment in the corresponding position in the memory according to the system default or user-defined rules. Therefore, the relative positions of the segments in the source program and the relative positions of the segments in the executable image file are generally different.
The following is the basic structure of an assembly language source program:
AREA Init , CODE , READONLY
ENTRY
Start
LDR R0 , =0x3FF5000
LDR R1 , 0xFF
STR R1 , [R0]
LDR R0 , =0x3FF5008
LDR R1 , 0x01
STR R1 , [R0]
┉┉
END
In assembly language programs, the AREA directive is used to define a segment and describe the relevant attributes of the defined segment. This example defines a code segment named Init with read-only attributes. The ENTRY directive identifies the entry point of the program, followed by a sequence of instructions. The end of the program is the END directive, which tells the compiler the end of the source file. Each assembly program segment must have an END directive to indicate the end of the code segment. Subroutine calls in ARM assembly language
In ARM assembly language programs, subroutine calls are generally implemented through BL instructions. In the program, use the instruction:
BL Subroutine name
The subroutine call is completed.
This instruction completes the following operations when executed: the return address of the subroutine is stored in the link register LR, and the program counter PC points to the entry point of the subroutine. When the subroutine is executed and needs to return to the calling place, it only needs to copy the return address stored in LR to the program counter PC. When calling a subroutine, it can also complete the transfer of parameters and the return of calculation results from the subroutine, which can usually be completed using registers R0 to R3.
The following is the basic structure of an assembly language source program that uses the BL instruction to call a subroutine:
AREA Init , CODE , READONLY
ENTRY
Start
LDR R0 , =0x3FF5000
LDR R1 , 0xFF
STR R1 , [R0]
LDR R0 , =0x3FF5008
LDR R1 , 0x01
STR R1 , [R0]
BL PRINT_TEXT
┉┉
PRINT_TEXT
┉┉
MOV PC,BL
┉┉
END
Previous article:LCD driver (FrameBuffer) example development explanation on S3C2440 (Part 2)
Next article:External RAM usage of LPC22xx under KEIL FOR ARM
Recommended ReadingLatest update time:2024-11-23 10:59
- 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?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- How to modify the IP address of the virtual machine Ubuntu14
- How is the current transformer used?
- Baosteel inverter application 2
- Sensor Basics and Common Terms
- 4412 development board one-click burning QT program to the development board - install ssh
- 【Xiaomeige SoC】Regenerate hps_0.h file after Altera SOC changes Qsys
- "Power supply obstacle" + voltage stress
- Design of clock circuit on computer motherboard
- 17 things not to do in an interview
- About LM2611