ARM assembly language program format

Publisher:春林初盛Latest update time:2016-12-05 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:ARM Reference address:ARM assembly language program format

Previous article:ARM microprocessor architecture
Next article:Summary of ARM assembly instruction learning

Recommended ReadingLatest update time:2024-11-16 21:23

Analysis of the main factors that determine the performance and power consumption of ARM core MCU
After ARM launched the Cortex-M0+ core, its 32-bit MCU cores increased to 4. Not long ago, NXP also announced that it had obtained the Cortex-M0+ processor license, becoming the only semiconductor manufacturer that can provide a complete series of Cortex-M0, Cortex-M0+, Cortex-M3 and Cortex-M4 core MCUs. Freescale a
[Microcontroller]
ARM assembly language series based on Android 4: addressing mode of ARM processor
Chapter List Part 1: Introduction to ARM assembly language  Part 2: Analysis of the process of generating ARM assembly programs from C/C++ programs Part  3: ARM assembly language program structure  Part 4: Addressing methods of ARM processors  Part 5: ARM instruction set and Thumb instruction set  Part 6: NEON in
[Microcontroller]
A design scheme of barcode precision measurement system based on ARM microcontroller
  The typical instrument for precision measurement using barcode technology is the digital level NA2000 successfully developed by Leica in 1990. This new optoelectronic integrated instrument has many features, such as fast measurement speed, high accuracy, simple operation, intuitive reading, automatic calculation of
[Microcontroller]
A design scheme of barcode precision measurement system based on ARM microcontroller
ARM stack method
When the stack pointer points to the last data pushed into the stack, it is called a full stack. When the stack pointer points to the next empty location where data will be placed, it is called an empty stack. According to the battle generation method, it is divided into: Ascending Stack and Decreasing Sta
[Microcontroller]
Header file definitions and ARM instructions
Memory management: memory allocation and release, etc. Static and dynamic memory: the main difference is in the release method Static variables: Determined at compile time, defined outside the function Automatic variables: Determined in the stack only when the program is running Read-only data section: Where const
[Microcontroller]
Embedded ARM Learning Summary (IV)--LCD
1. Common display types 1) Digital tube: 0.7-1 yuan, low cost, can only display numbers and letters 2) Character LCD screen: LCD1602 15-25, display numbers and letters 3) Dot matrix black and white screen: LCD12864 50-90 can display Chinese characters and pictures 4) STN-LCD color screen has low cost, slow response sp
[Microcontroller]
Integrating analog components with Arm microcontroller cores to solve embedded system problems
The design of embedded systems presents complex challenges as there are aggressive goals for advancements in performance, cost, power, size, new features, and efficiency. However, there is an emerging design alternative that can address these complexities – the intelligent integration of analog components with ARM® mi
[Microcontroller]
Integrating analog components with Arm microcontroller cores to solve embedded system problems
Simulation and transplantation of MiniGUI based on ARM-Linux
In recent years, with the increasing development of embedded systems and the widespread application of 32-bit embedded processors and graphic display devices, the target products have an increasing demand for GUI (Graphical User Interface). Since embedded systems generally have high real-time requirements, the GUI unde
[Microcontroller]
Simulation and transplantation of MiniGUI based on ARM-Linux
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号