1.3.1. Commonly Used Options

The commonly used options listed in the subsections below are available on the c29clang compiler command line.

1.3.1.1. Processor Options

1.3.1.1.1. Select a Target C29x Processor

-mcpu=<processor>

Select the target <processor> version.

The c29clang compiler currently supports only the following C29x processor variant:

  • -mcpu=c29.c0 - C29x instructions

If the -mcpu option is not specified on the c29clang command-line, the compiler assumes a default of -mcpu=c29.c0.

1.3.1.1.3. Endianness

C29x devices are always little-endian. No command-line options are provide to specify or change this.

1.3.1.1.4. Floating-Point Support Options

The C29 CPU can perform native 32-bit and 64-bit floating-point hardware operations on the CPU, without sending data to a separate FPU for processing.

-mfpu=<arg>

Native support for 32-bit floating-point operations is always provided for C29. Optionally, you can also enable 64-bit hardware instructions for floating-point operations using the -mfpu option, which can have either of the following settings:

  • -mfpu=none - Use native 32-bit floating-point hardware operations, but emulate 64-bit floating-point operations in software.

  • -mfpu=f64 - Use native 32-bit and 64-bit floating-point hardware operations.

1.3.1.2. Include Options

The c29clang compiler utilizes the include file directory search path to locate a header file that is included by a C/C++ source file via an #include preprocessor directive. The c29clang compiler implicitly defines an initial include file directory search path to contain directories relative to the tools installation area where C/C++ standard header files can be found. These C/C++ standard header files are considered part of the c29clang compiler package and should be used in combination with linker and the runtime libraries that are included in the c29clang compiler tools installation.

-I<dir>

The -I option lets you add your own directories to the include file directory path, allowing user-created header files to be easily accessible during compilation.

1.3.1.3. Predefined Symbol Options

In addition to the pre-defined macro symbols that the c29clang compiler defines depending on which processor options are selected, you can also manage your own symbols at compile-time using the -D and -U options. These options are useful when the source code is configured to behave differently based on whether a compile-time symbol is defined and/or what value it has.

-D<name>[=<value>]

A user-created pre-defined compile symbol can be defined and given a value using the -D option. In the following example, MySym will be defined and given a value 123 at compile-time. MySym will then be available for use during the compilation of the test.c source file.

c29clang -mcpu=c29.c0 -DMySym=123 -c test.c
-U<name>

The -U option can be used to cancel a previous definition of a specified <name> whether it was pre-defined implicitly by the compiler or with a prior -D option.

1.3.1.4. Optimization Options

To enable optimization passes in the c29clang compiler, select a level of optimization from among the following -O[0|1|2|3|fast|g|s|z] options. In general, the options below represent various levels of optimization with some options designed to favor smaller compiler generated code size over performance, while others favor performance at the cost of increased compiler generated code size.

Among the options listed below, -Oz is recommended as the optimization option to use if small compiler generated code size is a priority for an application. Using -Oz retains performance gains from many of the -O2 level optimizations that are performed.

-O0

No optimization. This setting is not recommended, because it can make debugging difficult.

-O1  or -O

Restricted optimizations, providing a good trade-off between code size and debug-ability.

-O2

Most optimizations enabled; some optimizations that require significantly additional compile time are disabled.

-O3

All optimizations available at -O2 plus others that require additional compile time to perform.

-Ofast

All optimizations available at -O3 plus additional aggressive optimizations with potential for additional performance gains, but also not guaranteed to be in strict compliance with language standards.

-Og

Restricted optimizations while preserving debuggability. All optimizations available at -O1 are performed with the addition of some optimizations from -O2.

-Os

All optimizations available at -O2 plus additional optimizations that are designed to reduce code size while mitigating negative impacts on performance.

-Oz

All optimizations available at -O2 plus additional optimizations to further reduce code size with the risk of sacrificing performance.

Note

Optimization Option Recommendations:

  • The -O1 option is recommended for maximum debuggability.

  • The -Oz option is recommended for optimizing code size.

  • The -O3 option is recommended for optimizing performance, but it is likely to increase compiler generated code size.

1.3.1.5. Debug Options

The c29clang compiler generates DWARF debug information if the -g or -gdwarf-3 option is selected.

-g or -gdwarf-3

Emit DWARF version 3 debug information

1.3.1.6. Control Options

The default behavior of the c29clang compiler is to compile the specified source files into temporary object files, then pass those object files along with any explicitly specified object files and any specified linker options to the linker.

Several c29clang compiler options can be used to change this behavior and halt compilation at different stages:

-c

Stop compilation after emitting compiler-generated object files; do not call linker.

-E

Stop compilation after the pre-processing phase of the compiler; this option can be used in conjunction with several other options that provide further control over the pre-processor output:

  • -dD - Print macro definitions in addition to normal preprocessor output.

  • -dI - Print include directives in addition to normal preprocessor output.

  • -dM - Print macro symbol definitions instead of normal preprocessor output.

-S

Stop compilation after emitting compiler-generated assembly files; do not call assembler or linker.

See Invoking the Compiler for examples.

1.3.1.7. Compiler Output Option

-o<file>

The -o option names the output file that results from a c29clang command. If c29clang is used to compile and link an executable output file, then the -o option’s <file> argument names that output file. If no -o option is specified in a compile and link invocation of c29clang, then the linker produces an executable output file named a.out.

If the compiler is used to process a single source file, then the -o option names the output of the compilation. This is sometimes useful in case there is a need to name the output file from the compiler something other than what the compiler produces by default.

In the following example, the output object file from the compilation of C source file task_42.c is named task.o by the -o option, replacing the task_42.o file that would normally be generated by the compiler:

c29clang -mcpu=c29.c0 -c task_42.c -o task.o