Introduction to ARM GNU Common Assembly Language

Publisher:JoyfulJourneyLatest update time:2016-05-10 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
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  
Keywords:ARM Reference address:Introduction to ARM GNU Common Assembly Language

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]
Design of embedded temperature control system based on ARM microprocessor
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 Architecture Learning 3
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]
ARM Embedded System Development: Software Design and Optimization--Chapter 2 ARM Processor Basics
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]
Implementation of 3DES encryption algorithm based on ARM
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号