| |||||||||||||
Technical Support On-Line Manuals RealView Assembler User's Guide | An example ARM assembly language module
Example 2.1 illustrates some of the core constituents of an assembly language module. The example is written in ARM assembly language. The constituent parts of this example are described in more detail in the following sections. Example 2.1.
AREA ARMex, CODE, READONLY
; Name this block of code ARMex
ENTRY ; Mark first instruction to execute
start
MOV r0, #10 ; Set up parameters
MOV r1, #3
ADD r0, r0, r1 ; r0 = r0 + r1
stop
MOV r0, #0x18 ; angel_SWIreason_ReportException
LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit
SVC #0x123456 ; ARM semihosting (formerly SWI)
END ; Mark end of file
Sections are independent, named, indivisible sequences of code or data. A single code section is the minimum required to produce an application. The output of an assembly or compilation can include:
The linker places each section in a program image according to section placement rules. Sections that are adjacent in source files are not necessarily adjacent in the application image. See Chapter 3 Using the Basic Linker Functionality in the RealView Compilation Tools Linker and Utilities Guide for more information on how the linker places sections. In a source file, the You can choose any name for your sections. However, names starting with any nonalphabetic character must be enclosed in bars, or an Example 2.1 defines a single section called The The application code in Example 2.1 begins executing at the label After executing the main code, the application terminates by returning control to the debugger. This is done using the ARM semihosting SVC (
| ||||||||||||
| |||||||||||||