2.1.1. Invoking the ARM compiler

The command for invoking the ARM compiler is:

armcc [help-options] [source-language] [search-paths] [project-template-options] [PCH-options] [preprocessor-options] [C++-language] [output-format] [target-options] [debug-options] [code-generation-options] [optimization-options] [diagnostic-options] [additional-checks] [PCS-options] [pass-thru-options] source

See Chapter 2 Compiler Command-line Options in the Compiler Reference Guide for more information on each of the following options:

help-options

Shows the main command-line options, the version number of the compiler and how the compiler has processed the command line:

source-language

Specifies the source language variants accepted by the compiler:

These language options can be combined. For example:

armcc --c90 --gnu
search-paths

Specifies the directories to search for included files:

See Include files for more information on how these options work together.

project-template-options

Controls the behavior of project templates:

PCH-options
preprocessor-options

Specifies preprocessor behavior, including preprocessor output and macro definitions:

C++-language
output-format

Specifies the format for the compiler output. You can use these options to generate object files, assembly language output listing files, and make file dependency files:

target-options

Specifies the target processor or architecture and the target instruction set in use at startup:

See Specifying the target processor or architecture for more information.

debug-options

Controls the format and generation of debug tables:

code-generation-options
optimization-options

Controls the level and type of code optimization:

Note

Optimization criteria can limit the debug information generated by the compiler.

diagnostic-options
multiple compilations

Specifies the feedback file that contains information about a previous build:

PCS-options

Specifies the procedure call standard to use:

See Specifying the procedure call standard (AAPCS) for more information.

pass-thru-options

Instructs the compiler to pass options to other RVCT tools:

source

Provides the filenames of one or more text files containing C or C++ source code. By default, the compiler looks for source files, and creates output files, in the current directory.

If a source file is an assembly file, that is, one with an extension of .s, the compiler activates the ARM assembler to process the source file.

The ARM compiler accepts one or more input files, for example:

armcc -c [options] ifile_1 ... ifile_n

Specifying a dash - for an input file causes the compiler to read from stdin. To specify that all subsequent arguments are treated as filenames, not as command switches, use the POSIX option --. See Using command-line options for more information.

Default behavior

The compiler startup configuration is determined by the compiler according to the specified command-line options and the filename extensions. Command-line options override the default configuration determined by the filename extension. The compiler startup language can be C or C++ and the instruction set can be ARM or Thumb.

When you compile multiple files with a single command, all files must be of the same type, either C or C++. The compiler cannot switch the language based on the file extension. The following example produces an error, because the specified source files have different languages:

armcc -c test1.c test2.cpp

If you specify files with conflicting file extensions you can force the compiler to compile either for C or for C++, regardless of file extension. For example:

armcc -c --cpp test1.c test2.cpp

Where an unrecognized extension begins with .c, for example, filename.cmd, a warning is given.

Support for processing PreCompiled Header (PCH) files is not available when you specify multiple source files in a single compilation. If you request PCH processing and specify more than one primary source file, the compiler issues an error message, and aborts the compilation.

See Precompiled header files for more information.

Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0205H
Non-Confidential