Assembler User GuidePreface Overview of the Assembler Overview of the ARM Architecture Structure of Assembly Language Modules Writing ARM Assembly Language Condition Codes Using the Assembler armasm command-line syntax Specify command-line options with an environment v Using stdin to input source code to the assembler Built-in variables and constants Identifying versions of armasm in source code Diagnostic messages Interlocks diagnostics Automatic IT block generation Thumb branch target alignment Thumb code size diagnostics ARM and Thumb instruction portability diagnostics Instruction width diagnostics Two pass assembler diagnostics Conditional assembly Using the C preprocessor Address alignment Instruction width selection in Thumb Symbols, Literals, Expressions, and Operators VFP Programming Assembler Command-line Options ARM and Thumb Instructions VFP Instructions Directives Reference Via File Syntax
Using the C preprocessor
6.15 Using the C preprocessor
The assembler can invoke the compiler to preprocess an assembly language source file before assembling it. This allows you to use C preprocessor commands in assembly source code.
If you do this, you must use the
armasm looks for the armcc binary in the same directory as the armasm binary. If it does not find the binary, it expects it to be on the PATH.
armasm passes certain options to armcc if present on the command line. These are shown in the following table:
Table 6-5 Command-line options
Some of the options that armasm passes to armcc are converted to the armcc equivalent beforehand. These are shown in the following table:
Table 6-6 armcc equivalent command-line options
To pass other simple compiler options, such as the preprocessor option
Preprocessing an assembly language source file
The following example shows the command you write to preprocess and assemble a file, source.s. The example also passes the compiler options to define a macro called
armasm --cpreproc --cpreproc_opts=-D,RELEASE,-U,ALPHA source.s
Preprocessing an assembly language source file manually
If you want to use complex preprocessor options, you must manually call armcc to preprocess the file before calling armasm. The following example shows the commands you write to manually preprocess and assemble a file, source.s:
armcc -E source.s > preprocessed.s armasm preprocessed.s
In this example, the preprocessor outputs a file called preprocessed.s, and armasm assembles it.
of your data.