Introduction to ARM GNU Common Assembly Language
Keywords:ARM
Reference address:Introduction to ARM GNU Common Assembly Language
ARM assembly language source program statements are generally composed of instructions, pseudo operations, macro instructions and pseudo instructions. The design basis of ARM assembly language is assembly pseudo-instructions, assembly pseudo-operations and macro instructions. Pseudo operations are some special instruction mnemonics in ARM assembly language programs. Their main function is to make various preparations for completing the assembly program. The source program is processed when the assembler is run, but there is no machine execution during the computer operation. In other words, these pseudo operations only work during the assembly process. Once the compilation is finished, the purpose of the pseudo operation disappears. A macro instruction is an independent piece of program code that can be inserted into a program and is defined through pseudo-operations. 1>Macros must be defined in advance before they are used. Macros can call each other and can also call themselves recursively. 2>Use the macro by directly writing the macro name and input and output parameters in the format of macro instructions. 3>The macro definition itself does not generate code, but inserts the macro body into the original program when calling it. 4>Macro is similar to the calling of sub-function parameters and actual parameters in C language. When calling macro, actual instructions are used to replace the macro body to implement a related section of code. However, there is an essential difference between macro calling and subroutine calling, that is, macro does not save program space. Its advantages are to simplify program code, improve program readability, and macro content can be modified synchronously. Pseudo-operations and macro instructions are generally related to compilers, so the pseudo-operations and macro instructions of ARM assembly language have different writing forms and rules in different compilation environments. Pseudo-instructions are also special mnemonics in ARM assembly language programs, and are not executed by the machine during the operation of the processor. They will be replaced by appropriate machine instructions into ARM or Thumb instructions during assembly, thereby realizing the real instruction operation. There are currently two commonly used ARM compilation environments: 1>ADS/SDT IDE: developed by ARM, using the CodeWarrior compiler. 2> An IDE development environment that integrates GNU development tools; it consists of the GNU assembler as, the cross assembler gcc, and the linker id. For ARM pseudo-operations and macro instructions in the ADS compilation environment, please refer to "ARM Microcontroller Fundamentals and Practice" (by Zhou Ligong) published by Beihang University Press. This mainly describes the commonly used ARM GNU assembly language. 4.1 Introduction to ARM GNU Common Assembly Pseudo-Instructions 1.abort .abort: stop compilation .align absexpr1,absexpr2: Fill unused memory area with values at a certain alignment. The first value indicates the alignment, 4, 8, 16 or 32. The second expression value indicates the value to fill. 2.if...else...endif .if .else .endif: Support conditional precompilation 3.include .include "file": Include the specified header file. You can put an assembly constant definition in the header file. 4.comm .comm symbol, length: Apply for a namespace in the bss segment. The name of the space is symbol and the length is length. Make room for it. 5.data .data subsection: Indicates that the following definition belongs to the subsection data segment. 6.equ .equ symbol, expression: defines a symbol as a value (expression). This instruction does not allocate space. 7.global .global symbol: defines a global symbol, usually used by ld. 8.ascii .ascii "string": defines a string and allocates space for it. 9.byte .byte expressions: define a byte and allocate space for it. 10.short .short expressions: Define a short integer and allocate space for it. 11.int .int expressions: Define an integer and allocate space for it. 12.long .long expressions: Define a long integer and allocate space for it. 13.word .word expressions: define a word and allocate space for it, 4 bytes. 14.macro/endm .macro: defines a macro code, .macro indicates the beginning of the code, and .endm indicates the end of the code. 15.req name .req register name: Define an alias for the register. 16.code .code [1632]: specifies the length of the instruction code generated, 16 for Thumb instructions, 32 for ARM instructions. 17.ltorg .ltorg: Indicates that the next definition is attributed to the current segment and space is allocated for it. 4.2 ARM GNU-specific symbols 1.@ The characters representing a comment from the current position to the end of the line. 2.# Comment out an entire line. 3.; New line separator. 4.3 Operation Code 1. NOP nop No operation, equivalent to MOV r0, r0 2.LDR ldr, = Equivalent to a long transfer of the PC register or other registers. 3.ADR adr
Previous article:ARM linux common assembly syntax
Next article:ARM assembly syntax under Linux
Recommended ReadingLatest update time:2024-11-16 17:53
Design of embedded temperature control system based on ARM microprocessor
Aiming at the problem of color temperature control in shadowless lighting system, this paper designs an embedded temperature regulator based on ARM microprocessor. The whole intelligent temperature controller consists of microcontroller, digital display module, temperature sensor, PWM heating module, clock circuit and
[Microcontroller]
ARM porting OSGi framework
At present, embedded computing applications have been widely used in various fields and run on various platforms. How to achieve mutual discovery and interaction between these applications running in dynamic environments or on different platforms, or how these applications can be automatically and flexibly configured a
[Microcontroller]
Design of obstacle monitoring and early warning system for loaders based on ARM single chip microcomputer
1 Introduction
With the development of informatization, intelligence and networking, embedded system technology has gained a broad space for development. The field of industrial control is also undergoing a huge transformation. Real-time embedded software and hardware technology based on 32-bit high-end pro
[Microcontroller]
ARM Architecture Learning 3
ARM program status register:
The ARM architecture contains a Current Program Status Register (CPSR) and five Separate Program Status Registers (SPSRs). These registers are set and read using the MSR and MRS instructions.
The Current Program Status Register (CPSR) holds information about the current processor state
[Microcontroller]
ARM Embedded System Development: Software Design and Optimization--Chapter 2 ARM Processor Basics
1. Register: There are 37 registers in total, and up to 17 registers can be active (16 data registers, 2 status registers: CPSR and SPSR) R13: Stack pointer: points to the top of the stack in the current processor mode R14: Link register, saves the return address of the subroutine. R15: Programmer, the address
[Microcontroller]
ARM11 (S3C6410) CP15 Registers
There are several documents that you should consult frequently regarding MMU programming. I have compiled them into a document here, so it is too long, so I have only posted excerpts and put the full content in the attached PDF. This document has three main contents 1. Full description of registers in protocol pr
[Microcontroller]
ARM Study Notes 12——GNU ARM Assembly Pseudo-Operation
1. .section 1.1 Syntax format .section section_name ]] 1.2 Function Define a segment. Each segment starts with the segment name and ends with the next segment name or the end of the file. The segment flags allowed by the ELF format are: a: allocatable w: writable segment
[Microcontroller]
Implementation of 3DES encryption algorithm based on ARM
Introduction
Modern cryptography divides encryption algorithms into symmetric encryption algorithms and public key encryption algorithms according to different key types. As a symmetric encryption algorithm, the 3DES algorithm has been proven to be a highly secure encryption algorithm in practice and has been wi
[Microcontroller]
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- Effects of ESR and ESL in Decoupling Applications
- The new computer I bought can't be turned on, please help
- Solution to the failure of IAR programming MSP430
- MicroPython sets up a separate factory reset code file
- Use ustruct to reorganize byte values, Pandora development board gyroscope
- Display community logo on three-color E-Ink Gizmo
- 【GD32450I-EVAL】UART
- Simple VGA driver for MicroPython
- How to solve CAN bus test problems
- Fudan Micro FM33LG0xx Series Data Summary