You can use C preprocessor commands in your assembly language source file. If you do this, you must use the --cpreproc command line option when invoking the assembler. This causes armasm to call armcc to preprocess the file before assembling it.
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 Table 23. Some of these options are converted to the armcc equivalent before passing to armcc. These are shown in Table 24.
Table 23. Command-line options
--16
| --arm_only
| --diag_remark
| --fpu
| --library_type
|
--32
| --bi
| --diag_style
| --fpumode
| --thumb
|
--apcs
| --cpu
| --diag_suppress
| --i
| --unaligned_access --no_unaligned_access
|
--arm
| --diag_error
| --diag_warning | --li | |
Table 24. armcc equivalent command line options
| armasm | armcc |
|---|
--16
| --thumb
|
--32
| --arm
|
--i
| --I
|
To pass other simple compiler options, such as the preprocessor option -D, you must use the --cpreproc_opts command line option. armasm correctly interprets the preprocessed #line commands. It can generate error messages and debug_line tables using the information in the #line commands.
Example 22 shows the commands you write to preprocess and assemble a file, source.s. The example also passes the compiler options to define a macro called RELEASE, and to undefine a macro called ALPHA.
Example 22. Preprocessing an assembly language source file
armasm --cpreproc --cpreproc_opts=-D,RELEASE,-U,ALPHA source.s
If you want to use complex preprocessor options, you must manually call armcc to preprocess the file before calling armasm. Example 23 shows the commands you write to manually preprocess and assemble a file, source.s. In this example, the preprocessor outputs a file called preprocessed.s, and armasm assembles preprocessed.s.
Example 23. Preprocessing an assembly language source file manually
armcc -E source.s > preprocessed.s
armasm preprocessed.s
See also