| |||
| Home > Using the ARM Compiler > About the ARM compiler > Invoking the ARM compiler | |||
Typically, the ARM compiler is invoked as follows:
armcc [options] ifile_1 ... ifile_n
You can specify one or more input files .
If you specify a dash - for an input file, the compiler reads from ifile_1 ... ifile_nstdin.
You can use the POSIX option -- to specify that
all subsequent arguments are not treated as command switches. For
example, to compile a file named -ifile_1 type:
armcc -O2 -- -ifile_1
For backwards compatibility, you can still invoke the ARM compiler using one of the tool names supported in earlier compilation tools. The startup configuration associated with each of the older tool names is shown in Table 2.1.
Table 2.2 shows how the compiler startup configuration is adjusted by the filename extension you specify.
Table 2.2. 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 |
.tc | Thumb | C |
.tcpp | Thumb | C++ |
.ac | ARM | C |
.acpp | ARM | C++ |
When you compile multiple files with a single command, all
files must 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
See Setting the source language for details.
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.2) or the tool name you used to invoke the compiler (see Table 2.1). To do this, use the appropriate command-line option as shown in Table 2.3. See Pragmas controlling code generation for information on using pragmas to set source language.
Table 2.3. 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.4.
Table 2.4. 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.
To summarize:
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.
See Setting the source language and Targeting the instruction set for details on these options.