Datasheet

ARM Compiler Reference
3-18 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
Inline assembler
The ARM C++ compilers support the syntax in the ISO/IEC C++ standard, with the
restriction that the string-literal must be a single string, for example:
asm("instruction[;instruction]");
The
asm
declaration must be inside a C++ function. You cannot include comments in the
string literal.
The ARM C and C++ compilers also support an extended inline assembler syntax,
introduced by the
asm
keyword (C++), or the
__asm
keyword (C and C++).
The inline assembler is invoked with the assembler specifier, and is followed by a list
of assembler instructions inside braces, for example:
__asm
{
instruction [; instruction]
...
[instruction]
}
If two instructions are on the same line, you must separate them with a semicolon. If an
instruction requires more than one line, line continuation must be specified with the
backslash character
\
. You can use C or C++ comments anywhere within an inline
assembly language block.
You can use an
asm
or
__asm
statement anywhere a statement is expected.
The ARM compilers support the full ARM instruction set, including generic
coprocessor instructions, but not
BX
and
BLX
.
The Thumb compilers support the full Thumb instruction set except for
BX
and
BLX
.
Using inline Thumb assembly routines, however, is deprecated and generates a warning
message.
See the chapter on Mixing C, C++, and assembly language in the ADS Developer Guide
for more information on inline C and C++ assemblers.
Keywords
ARM implements some keyword extensions for functions and variables. See:
Function keywords on page 3-6
Variable declaration keywords on page 3-9
Type qualifiers on page 3-12.