| |||
| Home > Using the ARM Compiler > About the ARM compiler > Invoking the ARM compiler | |||
Typically, the ARM compiler is invoked as follows:
armcc -c [options] ifile_1 ... ifile_n
You can specify one or more input files .
If you specify a dash ifile_1 ... ifile_n- for an input file, the
compiler reads from stdin. You can use the
POSIX option -- to specify that all subsequent
arguments are treated as filenames, not as command switches.
For backwards compatibility, you can still invoke the ARM compiler using one of the tool names supported in earlier compilation tools. See Appendix E Using Older Options for details.
The compiler startup configuration (that is, C or C++, ARM or Thumb) is determined by the compiler from the:
tool name used to invoke the compiler
filename extension
command-line options --c90 or --cpp.
From these rules it follows that:
the filename extension overrides the default configuration determined by the tool name used to invoke the ARM compiler
the command-line option overrides the default configuration determined by the filename extension.
Table 2.1 shows how the compiler startup configuration is adjusted by the filename extension you specify.
Table 2.1. Startup configuration as adjusted by filename extension
| Filename extension | Instruction set | Source language |
|---|---|---|
.cpp | No adjustment | C++ |
.c++ | No adjustment | C++ |
.cp | No adjustment | C++ |
.c | No adjustment | No adjustment |
.cc | No adjustment | C++ |
.tc | Thumb | C |
.tcpp | Thumb | C++ |
.ac | ARM | C |
.acpp | ARM | C++ |
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 compiler attempts to compile using
the source language of test1.c:
armcc -c test1.c test2.cpp
Error: C3472E: No source language specified (--cpp or --c90) and sourcefile extensions conflict
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, ,
a warning is given. See Setting the source
language for full details on how the compiler
determines the source language.filename.cmd
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 details.
You can override the adjustments that the ARM compiler makes based on the filename extension (see Table 2.1) or the tool name you used to invoke the compiler. To do this, use the appropriate command-line option as shown in Table 2.2. See Pragmas controlling code generation for information on using pragmas to set source language.
Table 2.2. Startup configuration as adjusted by overriding options
| Command-line option | Instruction set | Source language |
|---|---|---|
| No adjustment | C |
| No adjustment | C++ |
| ARM | No adjustment |
| Thumb | No adjustment |
For example, if you submit the following command:
tcpp foo.acpp --c90
The compiler makes determinations as shown in Table 2.3.
Table 2.3. Example configuration
| Command Component | Description | Defines instruction set | Defines source language |
|---|---|---|---|
| tcpp | Tool name | Thumb | C++ |
.acpp | Filename extension | ARM | C++ |
| Command-line option | No adjustment | C |
| Result | ARM | C |
The configuration that results from these considerations is shown in the Result row at the bottom of the table.
See Setting the source language and Targeting the instruction set for details on these options.