xcc [-c|-S|-E] [-g] [-O<level>] [-W<warn>...] [-I<dir>...] [-L<dir>...] [-D<macro>[=<defn>]] [-f<option>...] [-target=<platform>] [-o <outfile>] infile
Only the most useful options are listed here; see below for the remainder.
XCC is deliberately analogous to GCC and imitates many of its behaviours. XCC is a wrapper around a collection of tools to make the use of those tools simpler. Those tools perform the steps of preprocessing, compilation (both C/C++ and XC), assembly and ‘mapping’. Those tools may be used individually, but are more easily used via xcc.
XCC will normally run all of the steps. The first three steps are similar to GCC in that they are applied to an individual source file to produce an object file. The ‘mapping’ step, as the name suggests, is different. Rather than producing an executable for a single processor, the linker is invoked multiple times to produce an executable per processor. Furthermore, the process includes auto-generating source code, compiling it and invoking the linker further times. The resulting single output file is an XE file , which contains the multiple executables.
During compilation of a program, the compiler generates a temporary
header file named
platform.h that contains variable and macro
definitions, as defined by the target XN file, which include:
Many options are passed directly through to the tool performing the processing step. For instance, some options directly influence the behaviour of the compiler or the linker.
For the most part, the order you use for the options doesn’t matter. Order
does matter when you use several options of the same kind; for example, if you
-L more than once, the directories are searched in the order
specified. In other cases, such as with
-O repeated usage will
result in the rightmost usage to take precedence.
Many options have negative forms (for example,
A space between an option and its argument is permitted.
- -x <language>¶
Overrides default handling for the following input files. This option applies to all following input files until the next
-xoption. Supported values for language are:
none(turn off language specification)
Default handling of the input files is determined by their suffix:
Type of File
Preprocessed by XCC
XC source code
C source code
CPP source code (for compatability, the extensions
cxxare also recognized)
xSCOPE configuration file
xCORE Network Description
XC source code
C source code
C++ source code
Object file .o be given to the linker
Specifies the language variant for the following input C or C++ file. Supported values for
ISO C89 with GNU extensions
ISO C99 with GNU extensions (default for C programs)
ISO C++ (1998)
ISO C++ (1998) with GNU extensions (default for C++ programs)
In XC, allows selecting on channel inputs where the size of the desstination variable is less than 32 bits.
This is default for targets based on XS1-L devices. It is not default for targets based on XS1-G devices. For further details, see Channel Communication.
Convenience mechanism for specifying a pre-canned target platform. The platform configuration must be specified in the file
platform.xn, which is searched for in the paths specified by the
The use of this option is not recommended for long-lived projects due to the likelihood of the target platform changing in an uncontrolled fashion. It is best practice to specify a platform explicitly by defining and supplying a target platform as one of the xcc input files. For example:
$ xcc my_target.xn main.c
Enable support for memory overlays. Functions marked as overlay roots are placed in external memory and are loaded on demand at runtime. The option should be passed when compiling and linking. An overlay runtime should be supplied in the application.
Enable support for memory overlays linking in the flash overlay runtime. Overlays are only enabled on tiles which boot from flash.
Enable support for memory overlays linking in the syscall overlay runtime. Overlay are enabled on all tiles. Overlays are loaded from a host machine using a system call.
Enable support for tracing using xSCOPE (defaults to link). The XN file of the target must contain an xSCOPE link. The option should be passed when compiling and linking.
Add a buffer of size <n> bytes to be used to hold command line arguments.
Returns the numerically highest error code produced by any phase of compilation. (By default XCC returns 1 if any phase of the compiler returns non-success, otherwise it returns 0.)
Compiles or assembles the source files, producing an object file for each source file, but does not link/map. By default the object filename is formed by replacing the source file suffix with
Stops after compilation proper, producing an assembly code file for each nonassembly input file specified. By default the assembly filename is formed by replacing the source file suffix with .s.
Input files not requiring compilation are ignored.
Preprocesses the source files only, outputting the preprocessed source to stdout.
Input files not requiring preprocessing are ignored.
- -o <file>¶
Places output in
-ois not specified, the executable file is placed in
a.xe, the object file for
source.o, its assembly code file in
source.s, and all preprocessed C/C++/XC source on standard output.
Prints (on standard error) the commands executed at each stage of compilation. Also prints the version number of XCC, the preprocessor and the compiler proper.
The same as
-vexcept that the commands are not executed and all command arguments are quoted.
Displays the version number and copyrights.
Save intermediate files to current directory. Where possible, files are named based on the source file. The generated file
platform.his always written with the same name, and therefore parallel builds with this option enabled should be avoided.
This option is not forwarded to xmap; see
-Xmapperif this is the desired behaviour.
Many specific warnings can be controlled with options beginning
-W. Each of the following options has a negative form beginning
-Wno- to turn off warnings.
Checks the code for syntax errors only, then exits.
Turns off all warning messages.
Warns about the use of buffered ports not qualified with either
out. This warning is enabled by default.
Warns if an array subscript has type char.
Warns if a comment-start sequence
/*appears in a
/*comment, or if a backslash-newline appears in a
//comment. This is default.
Warns if a declaration does not specify a type. In C also warns about function declarations with no return type.
Warns if the type of
mainis not a function with external linkage returning
int. In XC also warns if main does not take zero arguments. In C also warns if
maindoes not take either zero or two arguments of appropriate type.
Warns if an aggregate or union initializer is not fully bracketed.
Warns if parentheses are omitted when there is an assignment in a context where a truth value is expected or if operators are nested whose precedence people often find confusing.
Warns if a function is defined with a return type that defaults to
intor if a return statement returns no value in a function whose return type is not
Warns if a
switchstatement does not have a
(XC only) Warns if a case in a
switchstatement with at least one statement can have control fall through to the following case.
Warns if timing constraints are not satisfied. This is default.
Warns about invalid syntax in timing scripts. This is default.
Warns if a static function is declared but not defined or a non-inline static function is unused.
Warns if a function parameter is unused except for its declaration.
Warns if a local variable or non-constant static variable is unused except for its declaration.
Turns on all of the above
-W... options are not implied by
- -Wextra, -W¶
Prints extra warning messages for the following:
A function can return either with or without a value (C, C++ only).
An expression statement or left-hand side of a comma expression contains no side effects. This warning can be suppressed by casting the unused expression to
void(C, C++ only).
An unsigned value is compared against zero with
Storage-class specifiers like
staticare not the first things in a declaration (C, C++ only).
A comparison such as
x<=y<=zappears (XC only).
The return type of a function has a redundant qualifier such as
Warns about unused arguments if
-Wunusedis also specified.
A comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. (Not warned if
-Wno-sign-compareis also specified.)
An aggregate has an initializer that does not initialize all members.
An initialized field without side effects is overridden when using designated initializers (C, C++ only).
A function parameter is declared without a type specifier in K&R-style functions (C, C++ only).
An empty body occurs in an
elsestatement (C, C++ only).
A pointer is compared against integer zero with
>=. (C, C++ only).
An enumerator and a non-enumerator both appear in a conditional expression. (C++ only).
A non-static reference or non-static const enumerator and a non-enumerator both appear in a conditional expression (C++ only).
Ambiguous virtual bases (C++ only).
Subscripting an array which has been declared
Taking the address of a variable which has been declared
A base class is not initialized in a derived class’ copy constructor (C++ only).
Warns if a negative integer constant expression is implicitly converted to an unsigned type.
Warns about compile-time integer division by zero. This is default.
Warns if floating point values are used in equality comparisons.
Warns if an object of larger than len bytes is defined.
Warns if a structure contains padding. (It may be possible to rearrange the fields of the structure to reduce padding and thus make the structure smaller.)
Warns when a reinterpret cast moves to a larger alignment.
Warns if a local variable shadows another local variable, parameter or global variable or if a built-in function is shadowed.
Warns if a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned.
Prints warning messages for constructs found in system header files. This is not default. See Directory Options.
Warns if an undefined macro is used in a
Treat all warnings as errors.
Turns a warning message into an error. The option should be one of the warning options to the compiler that can be prefixed with
By default, the flag
-Werror=timing-syntaxis set. Turning this warning into an error implies that timing warnings (
-Wtiming) are also errors and vice versa.
Produces debugging information.
Produces code in the executable that traps if a resource allocation fails. This causes resource errors to be detected as early as possible.
Produces extra compilation information as comments in intermediate assembly files.
Prints the target machine and exit.
Prints the compiler version and exit.
Prints the mapping from multilib directory names to compiler switches that enable them. The directory name is seperated from the switches by ‘
;’, and each switch starts with a ‘
@’ instead of the ‘
-‘, without spaces between multiple switches.
Lists the target platforms (XN files) found via
XCC_TARGET_PATH, excluding those in folders with name
Turning on optimization makes the compiler attempt to improve performance and/or code size at the expense of compilation time and the ability to debug the program.
Do not optimize. This is the default.
- -O, -O1¶
Optimize. Attempts to reduce execution time and code size without performing any optimizations that take a large amount of compilation time.
Optimize more. None of these optimizations involve a space-speed tradeoff.
Optimize even more. These optimizations may involve a space-speed tradeoff; high performance is preferred to small code size.
Optimize for the smallest code size possible.
Attempt to reorder instructions to increase performance. This is not default at any optimization level.
Unroll loops with small iteration counts. This is enabled at -O2 and above.
Integrate simple functions into their callers. This is enabled at -O2 and above and also at -Os.
The following options control the preprocessor.
Preprocesses only, then exit.
- -D <name>¶
Predefines name as a macro with definition 1.
- -D <name=definition>¶
Tokenizes and preprocesses the contents of definition as if it appeared in a
- -U <name>¶
Removes any previous definition of name.
Outputs to a file a rule suitable for make describing the dependencies of the source file. The default name of the dependency file is determined based on whether the
-ooption is specified. If
-ois specified, the filename is the basename of the argument to
-owith the suffix
-ois not specified, the filename is the basename of the input file with the suffix
.d. The name of the file may be overriden with
- -MF <file>¶
Write dependency information to
Emits phony targets for each dependency of the source file. Each phony target depends on nothing. These dummy rules work around errors
makegives if header files are removed without updating the
- -MT <file>¶
Specifies the target of the rule emitted by dependency generation.
The following options control the mapper and its linker.
- -l <library>¶
Searches the library library when linking. The linker searches and processes libraries and object files in the order specified. The actual library name searched for is
The directories searched include any specified with
Libraries are archive files whose members are object files. The linker scans the archive for its members which define symbols that have so far been referenced but not defined.
Do not link with the system startup files.
Do not link with the system libraries.
Do not link with the system startup files or system libraries.
Removes all symbol table and relocation information from the executable.
- -default-clkblk <clk>¶
Use clk as the default clock block. The clock block may be specified by its name in
<xs1.h>or by its resource number.
The startup code turns on the default clock block, configures it to be clocked off the reference clock with no divide and puts it into a running state. Ports declared in XC are initially attached to the default clock block. If this option is unspecified, the default clock block is set to
Passes option as an option to the linker/mapper. If option contains commas, it is split into multiple options at the commas.
To view the full set of advanced mapper options, type xmap --help.
- -Xmapper <option>¶
Passes option as an option to the linker/mapper. To pass an option that takes an argument use
Prints a summary of resource usage.
The following options specify directories to search for header files and libraries.
- -I <dir>¶
dirto the list of directories to be searched for header files.
- -isystem <dir>¶
dirfor header files after all directories specified by
-I. Marks it as a system directory.
The compiler suppresses warnings for header files in system directories.
- -iquote <dir>¶
dironly for header files requested with
#include "file"(not with
#include <file>) before all directories specified by
-Iand before the system directories.
The following environment variables affect the operation of XCC.
Multiple paths are separated by an OS-specific path separator
;’ for Windows, ‘
:’ for Mac and Linux).
A list of directories to be searched as if specified with
-I, but after any paths given with
-Ioptions on the command line.
Each of these environment variables applies only when preprocessing files of the named language. The variables specify lists of directories to be searched as if specified with
-isystem, but after any paths given with
-isystemoptions on the command line.
A list of directories to be searched as if specified with
-L, but after any paths given with
-Lon the command line.
A list of directories to be searched for device configuration files.
If set, subprograms executed by the compiler are prefixed with the value of this environment variable. No directory seperater is added when the prefix is combined with the name of a subprogram. The prefix is not applied when executing the assembler or the mapper.