Writing ARM and Thumb Assembly Language
2-16
Copyright © 2000, 2001 ARM Limited. All rights reserved.
ARM DUI 0068B
In an ARM assembly language source file, the start of a section is marked by the
AREA
directive. This directive names the section and sets its attributes. The attributes are
placed after the name, separated by commas. Refer to
AREA
on page 7-52 for a detailed
description of the syntax of the
AREA
directive.
You can choose any name for your sections. However, names starting with any
nonalphabetic character must be enclosed in bars, or an
AREA name missing
error is
generated. For example:
|1_DataArea|
.
Example 2-1 on page 2-15 defines a single section called
ARMex
that contains code and
is marked as being
READONLY
.
The ENTRY directive
The
ENTRY
directive marks the first instruction to be executed. In applications containing
C code, an entry point is also contained within the C library initialization code.
Initialization code and exception handlers also contain entry points.
Application execution
The application code in Example 2-1 on page 2-15 begins executing at the label
start
,
where it loads the decimal values 10 and 3 into registers r0 and r1. These registers are
added together and the result placed in r0.
Application termination
After executing the main code, the application terminates by returning control to the
debugger. This is done using the ARM semihosting SWI (
0x123456 by default
), with
the following parameters:
•
r0 equal to
angel_SWIreason_ReportException
(
0x18
)
•
r1 equal to
ADP_Stopped_ApplicationExit
(
0x20026
).
Refer to the
Semihosting SWIs
chapter in
ADS Debug Target Guide
for additional
information.
The END directive
This directive instructs the assembler to stop processing this source file. Every assembly
language source module must finish with an
END
directive on a line by itself.