Chapter 11. Tool Options
This chapter provides a detailed description of the options for the compiler, assembler, linker, control program, make utility and the archiver.
Tool options in Eclipse (Menu entry)
For each tool option that you can set from within Eclipse, a Menu entry description is available. In Eclipse you can customize the tools and tool options in the following dialog:
1.
From the Project menu, select Properties
The Properties dialog appears.
2.
In the left pane, expand C/C++ Build and select Settings.
In the right pane the Settings appear.
3.
Open the Tool Settings tab.
You can set all tool options here.
Unless stated otherwise, all Menu entry descriptions expect that you have this Tool Settings tab open.
11.1. C Compiler Options
This section lists all C compiler options.
Options in Eclipse versus options on the command line
Most command line options have an equivalent option in Eclipse but some options are only available on the command line. Eclipse invokes the compiler via the control program. Therefore, it uses the syntax of the control program to pass options and files to the C compiler. If there is no equivalent option in Eclipse, you can specify a command line option in Eclipse as follows:
1.
From the Project menu, select Properties
The Properties dialog appears.
2.
In the left pane, expand C/C++ Build and select Settings.
In the right pane the Settings appear.
3.
On the Tool Settings tab, select C/C++ Compiler » Miscellaneous.
4.
In the Additional options field, enter one or more command line options.
Because Eclipse uses the control program, you have to precede the option with -Wc to pass the option via the control program directly to the C compiler.
285
TASKING VX-toolset for TriCore User Guide
Be aware that some command line options are not useful in Eclipse or just do not have any effect. For example, the option -n sends output to stdout instead of a file and has no effect in Eclipse.
Short and long option names
Options can have both short and long names. Short option names always begin with a single minus (-) character, long option names always begin with two minus (--) characters.You can abbreviate long option names as long as it forms a unique name. You can mix short and long option names on the command line.
Options can have flags or suboptions. To switch a flag 'on', use a lowercase letter or a +longflag. To switch a flag off, use an uppercase letter or a -longflag. Separate longflags with commas. The following two invocations are equivalent: ctc -Oac test.c
ctc --optimize=+coalesce,+cse test.c
When you do not specify an option, a default value may become active.
286
Tool Options
C compiler option: --align
Menu entry
1.
Select C/C++ Compiler » Code Generation.
2.
Enter a value in the Minimum alignment field.
Command line syntax
--align=value
Default: --align=1
Description
By default the C compiler aligns objects to the minimum alignment required by the architecture. With this option you can increase this alignment for objects of four bytes or larger. The value must be a power of two.
Example
To align all objects of four bytes or larger on a 4-byte boundary, enter: ctc --align=4 test.c
Instead of this option you can also specify the following pragma in your C source:
#pragma align 4
With
#pragma align restore
you can return to the previous alignment setting.
Related information
Pragma align
287
TASKING VX-toolset for TriCore User Guide
C compiler option: --check
Menu entry
-
Command line syntax
--check
Description
With this option you can check the source code for syntax errors, without generating code. This saves time in developing your application because the code will not actually be compiled.
The compiler reports any warnings and/or errors.
This option is available on the command line only.
Related information
Assembler option --check
(Check syntax)
288
Tool Options
C compiler option: --compact-max-size
Menu entry
1.
Select C/C++ Compiler » Optimization.
2.
In the Maximum size for code compaction field, enter the maximum size of a match.
Command line syntax
--compact-max-size=value
Default: 200
Description
This option is related to the compiler optimization --optimize=+compact (Code compaction or reverse inlining). Code compaction is the opposite of inlining functions: large sequences of code that occur more than once, are transformed into a function. This reduces code size (possibly at the cost of execution speed).
However, in the process of finding sequences of matching instructions, compile time and compiler memory usage increase quadratically with the number of instructions considered for code compaction. With this option you tell the compiler to limit the number of matching instructions it considers for code compaction.
Example
To limit the maximum number of instructions in functions that the compiler generates during code compaction: ctc --optimize=+compact --compact-max-size=100 test.c
Related information
C compiler option --optimize=+compact
(Optimization: code compaction)
C compiler option --max-call-depth
(Maximum call depth for code compaction)
289
TASKING VX-toolset for TriCore User Guide
C compiler option: --core
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --core to the Additional options field.
Command line syntax
--core=core
You can specify the following core arguments:
tc1.2
tc1.3
tc1.3.1
tc2
TriCore 1.2 architecture
TriCore 1.3 architecture
TriCore 1.3.1 architecture, TriCore 1.3.1 instructions may be generated
TriCore 2 architecture, TriCore 2 instructions may be generated
Default: derived from
--cpu
, if used, otherwise tc1.3
Description
With this option you specify the core architecture for a custom target processor for which you create your application. By default the TriCore toolset derives the core from the processor you selected.
With --core=tc1.3.1, the compiler can generate TriCore 1.3.1 instructions in the assembly file. The macro
__TC131__
is defined in the C source file.
With --core=tc2, the compiler can generate TriCore 2 instructions in the assembly file. The macro
__TC2__ is defined in the C source file.
If you select a valid target processor (
command line option --cpu (-C) ), the core is automatically set,
based on the chosen target processor.
Example
Specify a custom core: ctc --core=tc2 test.c
Related information
C compiler option --cpu (Select processor)
C compiler option --fpu-present (FPU present)
C compiler option --mmu-present (MMU present)
290
Tool Options
C compiler option: --cpu (-C)
Menu entry
1.
Expand C/C++ Build and select Processor.
2.
From the Processor Selection list, select a processor or select User defined TriCore ....
Command line syntax
--cpu=cpu
-Ccpu
Description
With this option you define the target processor for which you create your application.
Based on this option the compiler always includes the special function register file reg
cpu
.sfr
, unless you disable the option Automatic inclusion of '.sfr' file on the Preprocessing page (
option
--no-tasking-sfr
).
Based on the target processor the compiler automatically detects whether a FPU-unit is present and whether the architecture is a TriCore2. This means you do not have to specify the compiler options
--fpu-present
and
--core=tc2
explicitly when one of the supported derivatives is selected.
To avoid conflicts, make sure you specify the same target processor to the assembler (Eclipse and the control program do this automatically).
Example
To compile the file test.c
for the TC1165 processor and use the SFR file regtc1165.sfr
: ctc --cpu=tc1165 test.c
Related information
Assembler option --cpu
(Select CPU)
C compiler option --no-tasking-sfr
(Do not include SFR file)
Section 1.3.2, Accessing Hardware from C
291
TASKING VX-toolset for TriCore User Guide
C compiler option: --cse-all-addresses
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --cse-all-addresses to the Additional options field.
Command line syntax
--cse-all-addresses
Description
With this option you tell the C compiler to make all addresses available for common subexpression evaluation.
Normally the C compiler ignores
__near
and
__a
x addresses for common subexpressions. However, depending on the use of address registers and whether stack and/or addressed memory are internal or external, it might be wise to consider them for CSE.
Example
With the following invocation the C compiler makes all addresses available for common subexpression evaluation.
ctc --cse-all-addresses -Oc test.c
Related information
C compiler option --optimize=+cse (Optimization: common subexpression elimination)
292
Tool Options
C compiler option: --debug-info (-g)
Menu entry
1.
Select C/C++ Compiler » Debugging.
2.
To generate symbolic debug information, select Default, Call-frame only or Full.
To disable the generation of debug information, select None.
Command line syntax
--debug-info[=suboption]
-g[suboption]
You can set the following suboptions:
all call-frame default a c d
Emit full symbolic debug information.
Emit DWARF call-frame information only.
Emit default symbolic debug information.
Default:
--debug-info
(same as
--debug-info=default
)
Description
With this option you tell the compiler to add directives to the output file for including symbolic information.
This facilitates high level debugging but increases the size of the resulting assembler file (and thus the size of the object file). For the final application, compile your C files without debug information.
Call-frame information only
With this suboption only call-frame information is generated. This enables you to inspect parameters of nested functions.
Default debug information
This provides all debug information you need to debug your application. It meets the debugging requirements in most cases without resulting in oversized assembler/object files.
Full debug information
With this information extra debug information is generated. In extraordinary cases you may use this debug information (for instance, if you use your own debugger which makes use of this information). With this suboption, the resulting assembler/object file increases significantly.
-
Related information
293
TASKING VX-toolset for TriCore User Guide
C compiler option: --default-a0-size (-Z)
Menu entry
1.
Select C/C++ Compiler » Allocation
2.
Enable the option Default __a0 allocations for objects below threshold, and enter a threshold value in bytes.
Command line syntax
--default-a0-size[=threshold]
-Z[threshold]
Default:
--default-a0-size=0
Description
With this option you can specify a threshold value for
__a0
allocation. If you do not specify a memory qualifier such as
__near
or
__far
in the declaration of an object, the compiler chooses where to place the object based on the size of the object.
First, the size of the object is checked against the near size threshold, according to the description of the
--default-near-size (-N) option. If the size of the object is larger than the near size threshold, but lower or equal to the a0 size threshold, the object is allocated in
__a0
memory. Larger objects, arrays and strings will be allocated
__far
.
By default the a0 size threshold is zero, which means that the compiler will never use
__a0
memory unless you specify the --default-a0-size (-Z) option. If you omit a threshold value, all objects not allocated
__near
, including arrays and string constants, will be allocated in
__a0
memory.
Allocation in
__a0
memory means that the object is addressed indirectly, using A0 as the base pointer.
The total amount of memory that can be addressed this way is 64 kB.
Instead of this option you can also use
#pragma default_a0_size
in the C source.
Example
To put all data objects with a size of 12 bytes or smaller, but larger than the default near threshold of 8, in
__a0
sections: ctc --default-a0-size=12 test.c
Related information
C compiler option --default-a1-size (-Y) (maximum size in bytes for data elements that are by default
located in
__a1
sections)
C compiler option --default-near-size (-N) (maximum size in bytes for data elements that are by default
located in
__near
sections)
294
Section 1.2.1, Memory Qualifiers
Tool Options
295
TASKING VX-toolset for TriCore User Guide
C compiler option: --default-a1-size (-Y)
Menu entry
1.
Select C/C++ Compiler » Allocation
2.
Enable the option Default __a1 allocations for objects below threshold, and enter a threshold value in bytes.
Command line syntax
--default-a1-size[=threshold]
-Y[threshold]
Default:
--default-a1-size=0
Description
With this option you can specify a threshold value for
__a1
allocation. If you do not specify a memory qualifier such as
__near
or
__far
in the declaration of an object, the compiler chooses where to place the object based on the size of the object.
First, the size of the object is checked against the near size threshold, according to the description of the
--default-near-size (-N) option. If the size of the object is larger than the near size threshold, but lower or equal to the a1 size threshold, the object is allocated in
__a1
memory. Larger objects, arrays and strings will be allocated
__far
.
By default the a1 size threshold is zero, which means that the compiler will never use
__a1
memory unless you specify the --default-a1-size (-Y) option. If you omit a threshold value, all objects not allocated
__near
, including arrays and string constants, will be allocated in
__a1
memory.
Allocation in
__a1
memory means that the object is addressed indirectly, using A1 as the base pointer.
The total amount of memory that can be addressed this way is 64 kB.
Instead of this option you can also use
#pragma default_a1_size
in the C source.
Example
To put all data objects with a size of 12 bytes or smaller, but larger than the default near threshold of 8, in
__a1
sections: ctc --default-a1-size=12 test.c
Related information
C compiler option --default-a0-size (-Z) (maximum size in bytes for data elements that are by default
located in
__a0
sections)
C compiler option --default-near-size (-N) (maximum size in bytes for data elements that are by default
located in
__near
sections)
296
Section 1.2.1, Memory Qualifiers
Tool Options
297
TASKING VX-toolset for TriCore User Guide
C compiler option: --default-near-size (-N)
Menu entry
1.
Select C/C++ Compiler » Allocation
2.
In the Threshold for putting data in __near field, enter a value in bytes.
Command line syntax
--default-near-size[=threshold]
-N[threshold]
Default:
--default-near-size=8
Description
With this option you can specify a threshold value for
__near
allocation. If you do not specify
__near or
__far
in the declaration of an object, the compiler chooses where to place the object. The compiler allocates objects smaller or equal to the threshold in
__near
sections. Larger objects are allocated in
__a0
,
__a1
or
__far
sections.
If you omit a threshold value, all objects will be allocated
__near
, including arrays and string constants.
Instead of this option you can also use
#pragma default_near_size
in the C source.
Example
To put all data objects with a size of 12 bytes or smaller in
__near
sections: ctc --default-near-size=12 test.c
Related information
C compiler option --default-a0-size (-Z) (maximum size in bytes for data elements that are by default
located in
__a0
sections)
C compiler option --default-a1-size (-Y) (maximum size in bytes for data elements that are by default
located in
__a1
sections)
Section 1.2.1, Memory Qualifiers
298
Tool Options
C compiler option: --define (-D)
Menu entry
1.
Select C/C++ Compiler » Preprocessing.
The Defined symbols box shows the symbols that are currently defined.
2.
To define a new symbol, click on the Add button in the Defined symbols box.
3.
Type the symbol definition (for example, demo=1
)
Use the Edit and Delete button to change a macro definition or to remove a macro from the list.
Command line syntax
--define=macro_name[=macro_definition]
-Dmacro_name[=macro_definition]
Description
With this option you can define a macro and specify it to the preprocessor. If you only specify a macro name (no macro definition), the macro expands as '1'.
You can specify as many macros as you like. Simply use the Add button to add new macro definitions.
On the command line, use the option --define (-D) multiple times. If the command line exceeds the limit of the operating system, you can define the macros in an option file which you then must specify to the compiler with the option --option-file (-f) file.
Defining macros with this option (instead of in the C source) is, for example, useful to compile conditional
C source as shown in the example below.
Example
Consider the following C program with conditional code to compile a demo program and a real program: void main( void )
{
#if DEMO
demo_func(); /* compile for the demo program */
#else
real_func(); /* compile for the real program */
#endif
}
You can now use a macro definition to set the DEMO flag:
299
TASKING VX-toolset for TriCore User Guide
ctc --define=DEMO test.c
ctc --define=DEMO=1 test.c
Note that both invocations have the same effect.
The next example shows how to define a macro with arguments. Note that the macro name and definition are placed between double quotes because otherwise the spaces would indicate a new option.
ctc --define="MAX(A,B)=((A) > (B) ? (A) : (B))" test.c
Related information
C compiler option --undefine (Remove preprocessor macro)
C compiler option --option-file (Specify an option file)
300
Tool Options
C compiler option: --dep-file
Menu entry
-
Command line syntax
--dep-file[=file]
Description
With this option you tell the compiler to generate dependency lines that can be used in a Makefile. In contrast to the option --preprocess=+make, the dependency information will be generated in addition to the normal output file.
By default, the information is written to a file with extension
.d
(one for every input file). When you specify a filename, all dependencies will be combined in the specified file.
Example
ctc --dep-file=test.dep test.c
The compiler compiles the file test.c
, which results in the output file test.src
, and generates dependency lines in the file test.dep
.
Related information
C compiler option --preprocess=+make (Generate dependencies for make)
301
TASKING VX-toolset for TriCore User Guide
C compiler option: --diag
Menu entry
1.
From the Window menu, select Show View » Other » Basic » Problems.
The Problems view is added to the current perspective.
2.
In the Problems view right-click on a message.
A popup menu appears.
3.
Select Detailed Diagnostics Info.
A dialog box appears with additional information.
Command line syntax
--diag=[format:]{all | nr,...}
You can set the following output formats:
html rtf text
HTML output.
Rich Text Format.
ASCII text.
Default format: text
Description
With this option you can ask for an extended description of error messages in the format you choose.
The output is directed to stdout (normally your screen) and in the format you specify. You can specify the following formats: html, rtf or text (default). To create a file with the descriptions, you must redirect the output.
With the suboption all, the descriptions of all error messages are given. If you want the description of one or more selected error messages, you can specify the error message numbers, separated by commas.
Example
To display an explanation of message number 282, enter: ctc --diag=282
This results in the following message and explanation:
E282: unterminated comment
Make sure that every comment starting with /* has a matching */.
Nested comments are not possible.
302
Tool Options
To write an explanation of all errors and warnings in HTML format to file cerrors.html
, use redirection and enter: ctc --diag=html:all > cerrors.html
Related information
Section 4.8, C Compiler Error Messages
303
TASKING VX-toolset for TriCore User Guide
C compiler option: --error-file
Menu entry
-
Command line syntax
--error-file[=file]
Description
With this option the compiler redirects error messages to a file. If you do not specify a filename, the error file will be named after the input file with extension
.err
.
Example
To write errors to errors.err
instead of stderr
, enter:
ctc --error-file=errors.err test.c
Related information
304
Tool Options
C compiler option: --fp-trap
Menu entry
1.
Select Linker » Libraries.
2.
Enable the option Use trapped floating-point library.
Command line syntax
--fp-trap
Description
With this option you tell the compiler to allow trapping of floating-point exceptions.
The floating-point instructions, as implemented in the FPU, need to be handled in a special way if floating-point trapping behavior is expected from the generated code. A trapped floating-point library is required.
Related information
Control program option --fp-trap (Use trapped floating-point library)
Section 8.3, Linking with Libraries
305
TASKING VX-toolset for TriCore User Guide
C compiler option: --fpu-present
Menu entry
1.
Expand C/C++ Build and select Processor.
2.
From the Processor Selection list, select a processor that has an FPU.
Command line syntax
--fpu-present
Description
With this option the compiler can generate single precision floating-point instructions in the assembly file.
When you select this option, the macro
__FPU__
is defined in the C source file.
If you select a valid target processor (
command line option --cpu (-C) ), this option is automatically set,
based on the chosen target processor.
Example
To allow the use of floating-point unit (FPU) instructions in the assembly code, enter: ctc --fpu-present test.c
Related information
C compiler option --core
(Select TriCore architecture)
C compiler option --cpu (Select processor)
306
Tool Options
C compiler option: --help (-?)
Menu entry
-
Command line syntax
--help[=item]
-?
You can specify the following arguments:
intrinsics options pragmas typedefs i t o p
Show the list of intrinsic functions
Show extended option descriptions
Show the list of supported pragmas
Show the list of predefined typedefs
Description
Displays an overview of all command line options. With an argument you can specify which extended information is shown.
Example
The following invocations all display a list of the available command line options: ctc -?
ctc --help ctc
The following invocation displays a list of the available pragmas:
ctc --help=pragmas
Related information
307
TASKING VX-toolset for TriCore User Guide
C compiler option: --immediate-in-code
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --immediate-in-code to the Additional options field.
Command line syntax
--immediate-in-code
Description
By default the TriCore C compiler creates a data object to represent an immediate value of 32 or 64 bits, then loading this constant value directly into a register. With this option you can tell the compiler to code the immediate values directly into the instructions, thus using less data, but more code.
Actually when option --default-near-size < 4, 32-bit immediates will be coded into instructions anyhow, when it is >= 4 they will be located in neardata. When --default-near-size < 8, 64-bit immediates will be located in fardata, when it is >= 8 they will be located in neardata as well.
Instead of this option you can also specify the following pragma in your C source:
#pragma immediate_in_code
Related information
C compiler option --default-near-size (Maximum size for objects to be allocated by default in
__near sections)
Pragma immediate_in_code
308
Tool Options
C compiler option: --include-directory (-I)
Menu entry
1.
Select C/C++ Compiler » Include Paths.
The Include paths box shows the directories that are added to the search path for include files.
2.
To define a new directory for the search path, click on the Add button in the Include paths box.
3.
Type or select a path.
Use the Edit and Delete button to change a path or to remove a path from the list.
Command line syntax
--include-directory=path,...
-Ipath,...
Description
With this option you can specify the path where your include files are located. A relative path will be relative to the current directory,
The order in which the compiler searches for include files is:
1. The pathname in the C source file and the directory of the C source (only for #include files that are enclosed in "")
2. The path that is specified with this option.
3. The path that is specified in the environment variable
CTCINC
when the product was installed.
4. The default directory
$(PRODDIR)\include
.
Example
Suppose that the C source file test.c
contains the following lines:
#include <stdio.h>
#include "myinc.h"
You can call the compiler as follows: ctc --include-directory=myinclude test.c
First the compiler looks for the file stdio.h
in the directory myinclude
relative to the current directory.
If it was not found, the compiler searches in the environment variable and then in the default include directory.
309
TASKING VX-toolset for TriCore User Guide
The compiler now looks for the file myinc.h
in the directory where test.c
is located. If the file is not there the compiler searches in the directory myinclude
. If it was still not found, the compiler searches in the environment variable and then in the default include directory.
Related information
C compiler option --include-file (Include file at the start of a compilation)
310
Tool Options
C compiler option: --include-file (-H)
Menu entry
1.
Select C/C++ Compiler » Preprocessing.
The Pre-include files box shows the files that are currently included before the compilation starts.
2.
To define a new file, click on the Add button in the Pre-include files box.
3.
Type the full path and file name or select a file.
Use the Edit and Delete button to change a file name or to remove a file from the list.
Command line syntax
--include-file=file,...
-Hfile,...
Description
With this option you include one or more extra files at the beginning of each C source file, before other includes. This is the same as specifying
#include "file"
at the beginning of each of your C sources.
Example
ctc --include-file=stdio.h test1.c test2.c
The file stdio.h
is included at the beginning of both test1.c
and test2.c
.
Related information
C compiler option --include-directory
(Add directory to include file search path)
311
TASKING VX-toolset for TriCore User Guide
C compiler option: --indirect
Menu entry
1.
Select C/C++ Compiler » Code Generation.
2.
Enable the option Call functions indirectly.
Command line syntax
--indirect
Description
With this option you tell the compiler to generate code for indirect function calling.
Instead of this option you can also specify the following pragma in your C source:
#pragma indirect
Example
With the following command the compiler generates far calls for all functions: ctc --indirect test.c
Related information
C compiler option --indirect-runtime
(Call run-time functions indirectly)
Section 1.8.1, “Function Calling Modes: __indirect”
312
Tool Options
C compiler option: --indirect-runtime
Menu entry
1.
Select C/C++ Compiler » Code Generation.
2.
Enable the option Call run-time functions indirectly.
Command line syntax
--indirect-runtime
Description
With this option you tell the compiler to generate code for indirect calls to run-time functions. Use this option if you locate the entire run-time library in far memory.
Instead of this option you can also specify the following pragma in your C source:
#pragma indirect_runtime
Example
With the following command the compiler generates far calls for all run-time functions: ctc --indirect-runtime test.c
Related information
C compiler option --indirect (Call functions indirectly)
Section 1.8.1, “Function Calling Modes: __indirect”
313
TASKING VX-toolset for TriCore User Guide
C compiler option: --inline
Menu entry
1.
Select C/C++ Compiler » Optimization.
2.
Enable the option Always inline function calls.
Command line syntax
--inline
Description
With this option you instruct the compiler to inline calls to functions without the
__noinline
function qualifier whenever possible. This option has the same effect as a
#pragma inline
at the start of the source file.
This option can be useful to increase the possibilities for code compaction (C compiler option
--optimize=+compact).
Example
To always inline function calls: ctc --optimize=+compact --inline test.c
Related information
C compiler option --optimize=+compact (Optimization: code compaction)
314
Tool Options
C compiler option: --inline-max-incr / --inline-max-size
Menu entry
1.
Select C/C++ Compiler » Optimization.
2.
In the Maximum increment when inlining field, enter a value (default 35).
3.
In the Maximum size for functions to inline field, enter a value (default 10).
Command line syntax
--inline-max-incr=percentage (default: 35)
--inline-max-size=threshold (default: 10)
Description
With these options you can control the automatic function inlining optimization process of the compiler.
These options have only effect when you have enabled the inlining optimization (option --optimize=+inline or Optimize most).
Regardless of the optimization process, the compiler always inlines all functions that have the function qualifier inline
.
With the option --inline-max-size you can specify the maximum size of functions that the compiler inlines as part of the optimization process. The compiler always inlines all functions that are smaller than the specified threshold. The threshold is measured in compiler internal units and the compiler uses this measure to decide which functions are small enough to inline. The default threshold is 10.
After the compiler has inlined all functions that have the function qualifier inline
and all functions that are smaller than the specified threshold, the compiler looks whether it can inline more functions without increasing the code size too much. With the option --inline-max-incr you can specify how much the code size is allowed to increase. By default, this is 35% which means that the compiler continues inlining functions until the resulting code size is 35% larger than the original size.
Example
ctc --inline-max-incr=40 --inline-max-size=15 test.c
The compiler first inlines all functions with the function qualifier inline
and all functions that are smaller than the specified threshold of 15. If the code size has still not increased with 40%, the compiler decides which other functions it can inline.
Related information
C compiler option --optimize=+inline (Optimization: automatic function inlining)
Section 1.8.3, Inlining Functions: inline
315
TASKING VX-toolset for TriCore User Guide
C compiler option: --integer-enumeration
Menu entry
1.
Select C/C++ Compiler » Language.
2.
Enable the option Treat enumerated types always as integer.
Command line syntax
--integer-enumeration
Description
Normally the compiler treats enumerated types as the smallest data type possible ( char
or short
instead of int
). This reduces code size. With this option the compiler always treats enum-types as int
as defined in the ISO C99 standard.
Related information
Section 1.1, Data Types
316
Tool Options
C compiler option: --iso (-c)
Menu entry
1.
Select C/C++ Compiler » Language.
2.
From the Comply to C standard list, select ISO C99 or ISO C90.
Command line syntax
--iso={90|99}
-c{90|99}
Default:
--iso=99
Description
With this option you select the ISO C standard. C90 is also referred to as the "ANSI C standard". C99 refers to the newer ISO/IEC 9899:1999 (E) standard. C99 is the default.
Example
To select the ISO C90 standard on the command line: ctc --iso=90 test.c
Related information
C compiler option --language
(Language extensions)
317
TASKING VX-toolset for TriCore User Guide
C compiler option: --keep-output-files (-k)
Menu entry
Eclipse always removes the
.src
file when errors occur during compilation.
Command line syntax
--keep-output-files
-k
Description
If an error occurs during compilation, the resulting
.src
file may be incomplete or incorrect. With this option you keep the generated output file (
.src
) when an error occurs.
By default the compiler removes the generated output file (
.src
) when an error occurs. This is useful when you use the make utility. If the erroneous files are not removed, the make utility may process corrupt files on a subsequent invocation.
Use this option when you still want to inspect the generated assembly source. Even if it is incomplete or incorrect.
Example
ctc --keep-output-files test.c
When an error occurs during compilation, the generated output file test.src
will not be removed.
Related information
C compiler option --warnings-as-errors
(Treat warnings as errors)
318
Tool Options
C compiler option: --language (-A)
Menu entry
1.
Select C/C++ Compiler » Language.
2.
Enable or disable one or more of the following options:
• Allow GNU C extensions
• Allow // comments in ISO C90 mode
• Check assignment const/non-const string pointer
Command line syntax
--language=[flags]
-A[flags]
You can set the following flags:
+/-gcc
+/-comments
+/-strings g/G p/P x/X
enable a number of gcc extensions
// comments in ISO C90 mode relaxed const check for string literals
Default:
-AGpx
Default (without flags):
-AGPX
Description
With this option you control the language extensions the compiler can accept. By default the TriCore compiler allows all language extensions, except for gcc extensions.
The option --language (-A) without flags disables all language extensions.
GNU C extensions
The --language=+gcc (-Ag) option enables the following gcc language extensions:
• The identifier __FUNCTION__ expands to the current function name.
• Alternative syntax for variadic macros.
• Alternative syntax for designated initializers.
• Allow zero sized arrays.
• Allow empty struct/union.
319
TASKING VX-toolset for TriCore User Guide
• Allow empty initializer list.
• Allow initialization of static objects by compound literals.
• The middle operand of a
? :
operator may be omitted.
• Allow a compound statement inside braces as expression.
• Allow arithmetic on void pointers and function pointers.
• Allow a range of values after a single case label.
• Additional preprocessor directive
#warning
.
• Allow comma operator, conditional operator and cast as lvalue.
• An inline function without " static
" or " extern
" will be global.
• An " extern inline
" function will not be compiled on its own.
• An
__attribute__
directly following a struct/union definition relates to that tag instead of to the objects in the declaration.
For a more complete description of these extensions, you can refer to the UNIX gcc info pages (info
gcc).
Comments in ISO C90 mode
With --language=+comments (-Ap) you tell the compiler to allow C++ style comments (//) in ISO C90 mode (option --iso=90). In ISO C99 mode this style of comments is always accepted.
Check assignment const/non-const string pointer
With --language=+strings (-Ax) you disable warnings about discarded const
qualifiers when a string literal is assigned to a non-const pointer.
char *p; void main( void ) { p = "hello"; }
Example
ctc --language=-comments,+strings --iso=90 test.c
ctc -APx -c90 test.c
The compiler compiles in ISO C90 mode, accepts assignments of a constant string to a non-constant string pointer and does not allow C++ style comments.
Related information
C compiler option --iso
(ISO C standard)
320
Tool Options
C compiler option: --make-target
Menu entry
-
Command line syntax
--make-target=name
Description
With this option you can overrule the default target name in the make dependencies generated by the options --preprocess=+make (-Em) and --dep-file. The default target name is the basename of the input file, with extension
.o
.
Example
ctc --preprocess=+make --make-target=mytarget.o test.c
The compiler generates dependency lines with the default target name mytarget.o
instead of test.o
.
Related information
C compiler option --preprocess=+make (Generate dependencies for make)
C compiler option --dep-file
(Generate dependencies in a file)
321
TASKING VX-toolset for TriCore User Guide
C compiler option: --max-call-depth
Menu entry
1.
Select C/C++ Compiler » Optimization.
2.
In the Maximum call depth for code compaction field, enter a value.
Command line syntax
--max-call-depth=value
Default: -1
Description
This option is related to the compiler optimization --optimize=+compact (Code compaction or reverse inlining). Code compaction is the opposite of inlining functions: large sequences of code that occur more than once, are transformed into a function. This reduces code size (possibly at the cost of execution speed).
During code compaction it is possible that the compiler generates nested calls. This may cause the program to run out of its stack. To prevent stack overflow caused by too deeply nested function calls, you can use this option to limit the call depth. This option can have the following values:
-1
0
> 0
Poses no limit to the call depth (default)
The compiler will not generate any function calls. (Effectively the same as if you turned of code compaction with option --optimize=-compact)
Code sequences are only reversed if this will not lead to code at a call depth larger than specified with value. Function calls will be placed at a call depth no larger than value-1.
(Note that if you specified a value of 1, the option --optimize=+compact may remain without effect when code sequences for reversing contain function calls.)
This option does not influence the call depth of user written functions.
If you use this option with various C modules, the call depth is valid for each individual module.
The call depth after linking may differ, depending on the nature of the modules.
Related information
C compiler option --optimize=+compact (Optimization: code compaction)
C compiler option --compact-max-size (Maximum size of a match for code compaction)
322
Tool Options
C compiler option: --mil / --mil-split
Menu entry
-
Command line syntax
--mil
--mil-split[=file,...]
Description
With option --mil the C compiler skips the code generator phase and writes the optimized intermediate representation (MIL) to a file with the suffix
.mil
. The C compiler accepts
.mil
files as input files on the command line.
Option --mil-split does the same as option --mil, but in addition, the C compiler splits the MIL representation and writes it to separate files with suffix
.ms
. One file is written for each input file or MIL library specified on the command line. The
.ms
files are only updated on a change. The C compiler accepts
.ms
files as input files on the command line.
With option --mil-split you can perform application-wide optimizations during the frontend phase by specifying all modules at once, and still invoke the backend phase one module at a time to reduce the total compilation time.
Optionally, you can specify another filename for the
.ms
file the C compiler generates. Without an argument, the basename of the C source file is used to create the
.ms
filename. Note that if you specify a filename, you have to specify one filename for every input file.
Related information
Section 4.1, Compilation Process
Control program option --mil-link / --mil-split
323
TASKING VX-toolset for TriCore User Guide
C compiler option: --misrac
Menu entry
1.
Select C/C++ Compiler » MISRA-C.
2.
Make a selection from the MISRA-C checking list.
3.
If you selected Custom, expand the Custom 2004 or Custom 1998 entry and enable one or more individual rules.
Command line syntax
--misrac={all | nr[-nr]},...
Description
With this option you specify to the compiler which MISRA-C rules must be checked. With the option
--misrac=all the compiler checks for all supported MISRA-C rules.
Example
ctc --misrac=9-13 test.c
The compiler generates an error for each MISRA-C rule 9, 10, 11, 12 or 13 violation in file test.c
.
Related information
Section 4.7, C Code Checking: MISRA-C
C compiler option --misrac-advisory-warnings
C compiler option --misrac-required-warnings
Linker option --misrac-report
324
Tool Options
C compiler option: --misrac-advisory-warnings / --misrac-required-warnings
Menu entry
1.
Select C/C++ Compiler » MISRA-C.
2.
Make a selection from the MISRA-C checking list.
3.
Enable one or both options Warnings instead of errors for required rules and Warnings instead
of errors for advisory rules.
Command line syntax
--misrac-advisory-warnings
--misrac-required-warnings
Description
Normally, if an advisory rule or required rule is violated, the compiler generates an error. As a consequence, no output file is generated. With this option, the compiler generates a warning instead of an error.
Related information
Section 4.7, C Code Checking: MISRA-C
C compiler option --misrac
Linker option --misrac-report
325
TASKING VX-toolset for TriCore User Guide
C compiler option: --misrac-version
Menu entry
1.
Select C/C++ Compiler » MISRA-C.
2.
Select the MISRA-C version: 2004 or 1998.
Command line syntax
--misrac-version={1998|2004}
Default: 2004
Description
MISRA-C rules exist in two versions: MISRA-C:1998 and MISRA-C:2004. By default, the C source is checked against the MISRA-C:2004 rules. With this option you can specify to check against the
MISRA-C:1998 rules.
Related information
Section 4.7, C Code Checking: MISRA-C
C compiler option --misrac
326
Tool Options
C compiler option: --mmu-present / --mmu-on
Menu entry
1.
Expand C/C++ Build and select Processor.
2.
From the Processor Selection list, select a processor that has an MMU or select a user defined processor.
3.
(Optional) Select C/C++ Compiler » Miscellaneous.
4.
(Optional) Add the option --mmu-present to the Additional options field.
5.
Select C/C++ Compiler » Code Generation.
6.
Enable the option Use the MMU if present.
For predefined TriCore processors, the option --mmu-present is set automatically, so you only need to enable the option Use the MMU if present. For user defined processors you need to enable them both.
Command line syntax
--mmu-present
--mmu-on
Description
If the processor you are using has an MMU which is activated, you can tell the compiler to use the MMU.
The compiler then will align data naturally. To instruct the compiler to use the MMU, you must set both the option --mmu-present and the option --mmu-on.
With the option --mmu-present you tell the compiler that an MMU is physically present. With the option
--mmu-on you tell the compiler the MMU is activated. In this case the compiler needs to align data naturally. Both options are necessary.
If you select a valid target processor ( command line option --cpu (-C)
), the option --mmu-present is set automatically, based on the chosen target processor. If you are using a target processor with MMU that is not predefined, you need to set this option manually.
Example
To instruct the compiler to use the activated MMU: ctc --mmu-present --mmu-on test.c
Related information
C compiler option --fpu-present
(FPU present)
C compiler option --cpu
(Select processor)
327
TASKING VX-toolset for TriCore User Guide
C compiler option: --no-default-section-alignment
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --no-default-section-alignment to the Additional options field.
Command line syntax
--no-default-section-alignment
Description
By default the TriCore C compiler gives all sections an alignment of 4 bytes. This is required for the initialization algorithm in the startup code (as provided by the compiler). When you use this option, sections are no longer forced to a 4-byte alignment.You will need to use a custom made startup code. Furthermore you will have to remove the copy_unit = 4
part of the copytable
declaration within the LSL file.
Related information
Section 1.9.3, Change Section Alignment
328
Tool Options
C compiler option: --no-double (-F)
Menu entry
1.
Select C/C++ Compiler » Language.
2.
Enable the option Treat double as float.
Command line syntax
--no-double
-F
Description
With this option you tell the compiler to treat variables of the type double
as float
. Because the float type takes less space, execution speed increases and code size decreases, both at the cost of less precision.
Example
ctc --no-double test.c
The file test.c
is compiled where variables of the type double are treated as float.
-
Related information
329
TASKING VX-toolset for TriCore User Guide
C compiler option: --no-stdinc
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --no-stdinc to the Additional options field.
Command line syntax
--no-stdinc
Description
With this option you tell the compiler not to look in the default include
directory relative to the installation directory, when searching for include files. This way the compiler only searches in the include file search paths you specified.
Related information
Section 4.4, How the Compiler Searches Include Files
330
Tool Options
C compiler option: --no-tasking-sfr
Menu entry
1.
Select C/C++ Compiler » Preprocessing.
2.
Disable the option Automatic inclusion of '.sfr' file.
Command line syntax
--no-tasking-sfr
Description
Normally, the compiler includes a special function register (SFR) file before compiling. The compiler automatically selects the SFR file belonging to the target you selected on the Processor page (C compiler option --cpu).
With this option the compiler does not include the register file reg
cpu
.sfr
as based on the selected target processor.
Use this option if you want to use your own set of SFR files.
Related information
C compiler option --cpu
(Select processor)
Section 1.3.2, Accessing Hardware from C
331
TASKING VX-toolset for TriCore User Guide
C compiler option: --no-warnings (-w)
Menu entry
1.
Select C/C++ Compiler » Diagnostics.
The Suppress C compiler warnings box shows the warnings that are currently suppressed.
2.
To suppress a warning, click on the Add button in the Suppress warnings box.
3.
Enter the numbers, separated by commas, of the warnings you want to suppress (for example
537,538
). Or you can use the Add button multiple times.
4.
To suppress all warnings, enable the option Suppress all warnings.
Use the Edit and Delete button to change a warning number or to remove a number from the list.
Command line syntax
--no-warnings[=number,...]
-w[number,...]
Description
With this option you can suppresses all warning messages or specific warning messages.
On the command line this option works as follows:
• If you do not specify this option, all warnings are reported.
• If you specify this option but without numbers, all warnings are suppressed.
• If you specify this option with a number, only the specified warning is suppressed. You can specify the option --no-warnings=number multiple times.
Example
To suppress warnings 537 and 538, enter: ctc test.c --no-warnings=537,538
Related information
C compiler option --warnings-as-errors
(Treat warnings as errors)
Pragma warning
332
Tool Options
C compiler option: --object-comment
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add your comment to the Comment in object file field.
Command line syntax
--object-comment=comment
Description
With this option the compiler generates a
.comment
section at the end of the assembly file. The section contains the comment specified with this option. After assembling, this text is included in the
.o
object and
.elf
files. Place the comment between double quotes.
Instead of this option you can also specify the following pragma in your C source:
#pragma object_comment comment
Example
ctc --object-comment="Created by Altium" test.c
The compiler creates the file test.src
with a
.comment
section at the end of the file. After assembling this file, the text "Created by Altium" is incorporated in the generated object file.
-
Related information
333
TASKING VX-toolset for TriCore User Guide
C compiler option: --optimize (-O)
Menu entry
1.
Select C/C++ Compiler » Optimization.
2.
Select an optimization level in the Optimization level box.
Command line syntax
--optimize[=flags]
-Oflags
You can set the following flags:
+/-coalesce
+/-cse
+/-expression
+/-flow
+/-glo
+/-inline
+/-schedule
+/-loop
+/-simd
+/-align-loop
+/-forward
+/-propagate
+/-compact
+/-subscript
+/-ifconvert
+/-pipeline
+/-peephole m/M n/N o/O p/P r/R s/S v/V w/W y/Y a/A c/C e/E f/F g/G i/I k/K l/L
Coalescer: remove unnecessary moves
Common subexpression elimination
Expression simplification
Control flow simplification
Generic assembly code optimizations
Automatic function inlining
Instruction scheduler
Loop transformations
Perform SIMD optimizations
Align loop bodies
Forward store
Constant propagation
Code compaction (reverse inlining)
Subscript strength reduction
Convert IF statements using predicates
Software pipelining
Peephole optimizations
Use the following options for predefined sets of flags:
--optimize=0 -O0
No optimization
Alias for -OACEFGIKLMNOPRSVWY
No optimizations are performed. The compiler tries to achieve an optimal resemblance between source code and produced code. Expressions are evaluated in the same order as written in the source code, associative and commutative properties are not used.
334
Tool Options
--optimize=1
--optimize=2
-O1
Optimize
Alias for -OaCefgIKLMNOPRSVWy
Enables optimizations that do not affect the debug ability of the source code. Use this level when you encounter problems during debugging your source code with optimization level 2.
-O2
Optimize more (default)
Alias for -OacefgIklMNopRsvwy
Enables more optimizations to reduce code size and/or execution time. This is the default optimization level.
--optimize=3 -O3
Optimize most
Alias for -OacefgiklmnopRsvwy
This is the highest optimization level. Use this level to decrease execution time to meet your real-time requirements.
Default:
--optimize=2
Description
With this option you can control the level of optimization. If you do not use this option, the default optimization level is Optimize more (option --optimize=2 or --optimize).
When you use this option to specify a set of optimizations, you can overrule these settings in your C source file with
#pragma optimize flag
/
#pragma endoptimize
.
In addition to the option --optimize, you can specify the option --tradeoff (-t). With this option you specify whether the used optimizations should optimize for more speed (regardless of code size) or for smaller code size (regardless of speed).
Example
The following invocations are equivalent and result all in the default optimization set: ctc test.c
ctc --optimize=2 test.c
ctc -O2 test.c
ctc --optimize test.c
ctc -O test.c
ctc -OacefgIklMNopRsvwy test.c
ctc --optimize=+coalesce,+cse,+expression,+flow,+glo,-inline,
+schedule,+loop,-simd,-align-loop,+forward,+propagate,
-compact,+subscript,+ifconvert,+pipeline,+peephole test.c
335
TASKING VX-toolset for TriCore User Guide
Related information
C compiler option --tradeoff (Trade off between speed and size)
Pragma optimize/endoptimize
Section 4.6, Compiler Optimizations
336
Tool Options
C compiler option: --option-file (-f)
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --option-file to the Additional options field.
Be aware that the options in the option file are added to the C compiler options you have set in the other pages. Only in extraordinary cases you may want to use them in combination.
Command line syntax
--option-file=file,...
-f file,...
Description
This option is primarily intended for command line use. Instead of typing all options on the command line, you can create an option file which contains all options and flags you want to specify. With this option you specify the option file to the compiler.
Use an option file when the command line would exceed the limits of the operating system, or just to store options and save typing.
You can specify the option --option-file multiple times.
Format of an option file
• Multiple arguments on one line in the option file are allowed.
• To include whitespace in an argument, surround the argument with single or double quotes.
• If you want to use single quotes as part of the argument, surround the argument by double quotes and vise versa:
"This has a single quote ' embedded"
'This has a double quote " embedded'
'This has a double quote " and a single quote '"' embedded"
• When a text line reaches its length limit, use a \ to continue the line. Whitespace between quotes is preserved.
"This is a continuation \ line"
-> "This is a continuation line"
337
TASKING VX-toolset for TriCore User Guide
• It is possible to nest command line files up to 25 levels.
Example
Suppose the file myoptions
contains the following lines:
--debug-info
--define=DEMO=1 test.c
Specify the option file to the compiler: ctc --option-file=myoptions
This is equivalent to the following command line:
ctc --debug-info --define=DEMO=1 test.c
Related information
338
Tool Options
C compiler option: --output (-o)
Menu entry
Eclipse names the output file always after the C source file.
Command line syntax
--output=file
-o file
Description
With this option you can specify another filename for the output file of the compiler. Without this option the basename of the C source file is used with extension
.src
.
Example
To create the file output.src
instead of test.src
, enter: ctc --output=output.src test.c
-
Related information
339
TASKING VX-toolset for TriCore User Guide
C compiler option: --preprocess (-E)
Menu entry
1.
Select C/C++ Compiler » Preprocessing.
2.
Enable the option Store C preprocessor output in <file>.pre.
Command line syntax
--preprocess[=flags]
-E[flags]
You can set the following flags:
+/-comments
+/-make
+/-noline c/C m/M p/P
keep comments generate dependencies for make strip #line source position information
Default:
-ECMP
Description
With this option you tell the compiler to preprocess the C source. Under Eclipse the compiler sends the preprocessed output to the file
name.pre
(where name is the name of the C source file to compile).
Eclipse also compiles the C source.
On the command line, the compiler sends the preprocessed file to stdout. To capture the information in a file, specify an output file with the option --output.
With --preprocess=+comments you tell the preprocessor to keep the comments from the C source file in the preprocessed output.
With --preprocess=+make the compiler will generate dependency lines that can be used in a Makefile.
The preprocessor output is discarded. The default target name is the basename of the input file, with the extension
.o
. With the
option --make-target you can specify a target name which overrules the default
target name.
With --preprocess=+noline you tell the preprocessor to strip the #line source position information (lines starting with
#line
). These lines are normally processed by the assembler and not needed in the preprocessed output. When you leave these lines out, the output is easier to read.
Example
ctc --preprocess=+comments,-make,-noline test.c --output=test.pre
The compiler preprocesses the file test.c
and sends the output to the file test.pre
. Comments are included but no dependencies are generated and the line source position information is not stripped from the output file.
340
Related information
C compiler option --dep-file
(Generate dependencies in a file)
C compiler option --make-target
(Specify target name for -Em output)
Tool Options
341
TASKING VX-toolset for TriCore User Guide
C compiler option: --profile (-p)
Menu entry
1.
Select C/C++ Compiler » Debugging.
2.
Enable or disable Static profiling.
3.
Enable or disable one or more of the following Generate profiling information options (dynamic profiling):
• for block counters (not in combination with Call graph or Function timers)
• to build a call graph
• for function counters
• for function timers
Note that the more detailed information you request, the larger the overhead in terms of execution time, code size and heap space needed. The option --debug does not affect profiling, execution time or code size.
Command line syntax
--profile[=flag,...]
-p[flags]
Use the following option for a predefined set of flags:
--profile=g -pg
Profiling with call graph and function timers.
Alias for: -pBcFSt
You can set the following flags:
+/-block
+/-callgraph
+/-function
+/-static
+/-time b/B c/C f/F s/S t/T
block counters call graph function counters static profile generation function timers
Default (without flags):
-pBCfST
Description
Profiling is the process of collecting statistical data about a running application. With these data you can analyze which functions are called, how often they are called and what their execution time is.
342
Tool Options
Several methods of profiling exist. One method is code instrumentation which adds code to your application that takes care of the profiling process when the application is executed. Another method is static profiling.
For an extensive description of profiling refer to Chapter 6, Profiling .
You can obtain the following profiling data (see flags above):
Block counters (not in combination with Call graph or Time)
This will instrument the code to perform basic block counting. As the program runs, it counts the number of executions of each branch in an if statement, each iteration of a for loop, and so on. Note that though you can combine Block counters with Function counters, this has no effect because Function counters is only a subset of Block counters.
Call graph (not in combination with Block counters)
This will instrument the code to reconstruct the run-time call graph. As the program runs it associates the caller with the gathered profiling data.
Function counters
This will instrument the code to perform function call counting. This is a subset of the basic Block counters.
Time (not in combination with Block counters)
This will instrument the code to measure the time spent in a function. This includes the time spent in all sub functions (callees).
Static profiling
With this option you do not need to run the application to get profiling results. The compiler generates profiling information at compile time, without adding extra code to your application.
If you use one or more profiling options that use code instrumentation, you must link the corresponding
libraries too! Refer to Section 8.3, Linking with Libraries
, for an overview of the (profiling) libraries. In
Eclipse the correct libraries are linked automatically.
Example
To generate block count information for the module test.c
during execution, compile as follows: ctc --profile=+block test.c
In this case you must link the library libpb.a
.
Related information
Chapter 6, Profiling
343
TASKING VX-toolset for TriCore User Guide
C compiler option: --rename-sections (-R)
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --rename-sections to the Additional options field.
Command line syntax
--rename-sections[=name]
-R[name]
Description
The compiler defaults to a section naming convention, using a prefix indicating the section type, the module name and a symbol name:
section_type_prefix.module_name.symbol_name
For example,
.text.
module_name.symbol_name for code sections.
In case a module must be loaded at a fixed address, or a data section needs a special place in memory, you can use this option to generate different section names (section_type_prefix.name where name replaces the part module_name.symbol_name). You can then use this unique section name in the linker script file for locating.
If you use this option without a value, the compiler uses the default section naming.
Example
To generate the section name section_type_prefix
.NEW
instead of the default section name
section_type_prefix.module_name.symbol_name, enter: ctc -RNEW test.c
To generate the section name section_type_prefix instead of the default section name
section_type_prefix.module_name.symbol_name, enter: ctc -R" " test.c (note the space between the quotes)
Related information
Section 1.9, Compiler Generated Sections
344
Tool Options
C compiler option: --runtime (-r)
Menu entry
1.
Select C/C++ Compiler » Debugging.
2.
Enable or disable one or more of the following run-time error checking options:
• Generate code for bounds checking
• Generate code to detect unhandled case in a switch
• Generate code for malloc consistency checks
Command line syntax
--runtime[=flag,...]
-r[flags]
You can set the following flags:
+/-bounds
+/-case
+/-malloc b/B c/C m/M
bounds checking report unhandled case in a switch malloc consistency checks
Default (without flags):
-rbcm
Description
This option controls a number of run-time checks to detect errors during program execution. Some of these checks require additional code to be inserted in the generated code, and may therefore slow down the program execution. The following checks are available:
bounds
Every pointer update and dereference will be checked to detect out-of-bounds accesses, null pointers and uninitialized automatic pointer variables. This check will increase the code size and slow down the program considerably. In addition, some heap memory is allocated to store the bounds information. You may enable bounds checking for individual modules or even parts of modules only (see
#pragma runtime
).
case
Report an unhandled case value in a switch without a default part. This check will add one function call to every switch without a default part, but it will have little impact on the execution speed.
malloc
This option enables the use of wrappers around the functions malloc/realloc/free that will check for common dynamic memory allocation errors like:
345
TASKING VX-toolset for TriCore User Guide
• buffer overflow
• write to freed memory
• multiple calls to free
• passing invalid pointer to free
Enabling this check will extract some additional code from the library, but it will not enlarge your application code. The dynamic memory usage will increase by a couple of bytes per allocation.
Related information
Pragma runtime
346
Tool Options
C compiler option: --section-name-with-symbol
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --section-name-with-symbol to the Additional options field.
Command line syntax
--section-name-with-symbol
Description
Normally, when you use an option or pragma to influence section naming, the symbol name is not included.
With this option you tell the compiler to include the symbol name in the section name.
Instead of this option you can use the following pragma:
#pragma section_name_with_symbol
Related information
Section 1.9.1, Rename Sections
347
TASKING VX-toolset for TriCore User Guide
C compiler option: --section-per-data-object
Menu entry
1.
Select C/C++ Compiler » Code Generation.
2.
Enable the option Generate a section for each data object.
Command line syntax
--section-per-data-object
Description
Normally the compiler generates one section for each data type in a module (such as .data, .rodata, .bss,
.zdata, ...).
With this option you force the compiler to generate a separate section for each data object. This provides more control about allocation during the linking process.
Instead of this option you can use the following pragma:
#pragma section_per_data_object
Related information
Section 1.9.2, Influence Section Definition
348
Tool Options
all-tc1762 all-tc1764 all-tc1765 all-tc1766 all-tc1775 all-tc1792 all-tc1796 all-tc1910 all-tc1912 all-tc1920 all-tc11ib all-tc1100 all-tc1115 all-tc1130 all-tc1161 all-tc1162 all-tc1163 all-tc1164 all-tc1165 all-tc1166
C compiler option: --silicon-bug
Menu entry
1.
Expand C/C++ Build and select Processor.
2.
From the Processor Selection list, select a processor.
The CPU Problem Bypasses and Checks box shows the available workarounds/checks available for the selected processor.
3.
(Optional) Select Show all CPU problem bypasses and checks.
4.
Click Select All or select one or more individual options.
Command line syntax
--silicon-bug=arg,...
You can give one or more of the following arguments:
All TriCore TC11IB workarounds
All TriCore TC1100 workarounds
All TriCore TC1115 workarounds
All TriCore TC1130 workarounds
All TriCore TC1161 workarounds
All TriCore TC1162 workarounds
All TriCore TC1163 workarounds
All TriCore TC1164 workarounds
All TriCore TC1165 workarounds
All TriCore TC1166 workarounds
All TriCore TC1762 workarounds
All TriCore TC1764 workarounds
All TriCore TC1765 workarounds
All TriCore TC1766 workarounds
All TriCore TC1775 workarounds
All TriCore TC1792 workarounds
All TriCore TC1796 workarounds
All TriCore TC1910 workarounds
All TriCore TC1912 workarounds
All TriCore TC1920 workarounds
cpu-tc013
Workaround for CPU_TC.013
349
TASKING VX-toolset for TriCore User Guide
cpu-tc018 cpu-tc021 cpu-tc024 cpu-tc030 cpu-tc031 cpu-tc033 cpu-tc034 cpu-tc048 cpu-tc050 cpu-tc052 cpu-tc060 cpu-tc065 cpu-tc068 cpu-tc069 cpu-tc070 cpu-tc071 cpu-tc072 cpu-tc082 cpu-tc083 cpu-tc094 cpu-tc095 cpu-tc096 cpu-tc103 cpu-tc104 dmu-tc001
Workaround for CPU_TC.018
Workaround for CPU_TC.021
Workaround for CPU_TC.024
Workaround for CPU_TC.030
Workaround for CPU_TC.031
Workaround for CPU_TC.033
Workaround for CPU_TC.034
Workaround for CPU_TC.048
Workaround for CPU_TC.050
Workaround for CPU_TC.052
Workaround for CPU_TC.060
Workaround for CPU_TC.065
Workaround for CPU_TC.068
Workaround for CPU_TC.069
Workaround for CPU_TC.070
Workaround for CPU_TC.071
Workaround for CPU_TC.072
Workaround for CPU_TC.082
Workaround for CPU_TC.083
Workaround for CPU_TC.094
Workaround for CPU_TC.095
Workaround for CPU_TC.096
Workaround for CPU_TC.103
Workaround for CPU_TC.104
Workaround for DMU_TC.001
Description
With this option you specify for which hardware problems the compiler should generate workarounds.
Please refer to Chapter 16, CPU Problem Bypasses and Checks
for more information about the individual problems and workarounds.
Instead of this option you can use the following pragmas:
#pragma CPU_functional_problem
#pragma DMU_functional_problem
Example
To enable workarounds for problems CPU_TC.024 and CPU_TC.030, enter: ctc --silicon-bug=cpu-tc024,cpu-tc030 test.c
350
Related information
Chapter 16, CPU Problem Bypasses and Checks
Assembler option --silicon-bug
Tool Options
351
TASKING VX-toolset for TriCore User Guide
C compiler option: --source (-s)
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Enable the option Merge C source code with generated assembly.
Command line syntax
--source
-s
Description
With this option you tell the compiler to merge C source code with generated assembly code in the output file. The C source lines are included as comments.
Related information
Pragmas source/nosource
352
Tool Options
C compiler option: --static
Menu entry
-
Command line syntax
--static
Description
With this option, the compiler treats external definitions at file scope (except for main
) as if they were declared static
. As a result, unused functions will be eliminated, and the alias checking algorithm assumes that objects with static storage cannot be referenced from functions outside the current module.
This option only makes sense when you specify all modules of an application on the command line.
Example
ctc --static module1.c module2.c module3.c ...
Related information
353
TASKING VX-toolset for TriCore User Guide
C compiler option: --stdout (-n)
Menu entry
-
Command line syntax
--stdout
-n
Description
With this option you tell the compiler to send the output to stdout
(usually your screen). No files are created. This option is for example useful to quickly inspect the output or to redirect the output to other tools.
-
Related information
354
Tool Options
C compiler option: --switch
Menu entry
1.
Select C/C++ Compiler » Code Generation.
2.
Select an Algorithm for switch statements.
Command line syntax
--switch==arg
You can give one of the following arguments:
auto jumptab linear lookup
Choose most optimal code
Generate jump tables
Use linear jump chain code
Generate lookup tables
Default:
--switch=auto
Description
With this option you tell the compiler which code must be generated for a switch statement: a jump chain
(linear switch), a jump table or a lookup table. By default, the compiler will automatically choose the most efficient switch implementation based on code and data size and execution speed.
Instead of this option you can use the following pragma:
#pragma switch arg
Example
To use a table filled with target addresses for each possible switch value, enter: ctc --switch=jumptab test.c
Related information
Section 1.7, Switch Statement
355
TASKING VX-toolset for TriCore User Guide
C compiler option: --tradeoff (-t)
Menu entry
1.
Select C/C++ Compiler » Optimization.
2.
Select a trade-off level in the Trade-off between speed and size box.
Command line syntax
--tradeoff={0|1|2|3|4}
-t{0|1|2|3|4}
Default:
--tradeoff=2
Description
If the compiler uses certain optimizations (option --optimize), you can use this option to specify whether the used optimizations should optimize for more speed (regardless of code size) or for smaller code size
(regardless of speed).
By default the compiler balances speed and size while optimizing (--tradeoff=2).
If you have not specified the option --optimize, the compiler uses the default Optimize more optimization. In this case it is still useful to specify a trade-off level.
Example
To set the trade-off level for the used optimizations: ctc --tradeoff=2 test.c
The compiler uses the default Optimize more optimization level and optimizes for code size rather than for speed.
Related information
C compiler option --optimize
(Specify optimization level)
Section 4.6.3, Optimize for Size or Speed
356
Tool Options
C compiler option: --uchar (-u)
Menu entry
1.
Select C/C++ Compiler » Language.
2.
Enable the option Treat "char" variables as unsigned.
Command line syntax
--uchar
-u
Description
By default char
is the same as specifying signed char
. With this option char
is the same as unsigned char
.
Related information
Section 1.1, Data Types
357
TASKING VX-toolset for TriCore User Guide
C compiler option: --undefine (-U)
Menu entry
1.
Select C/C++ Compiler » Preprocessing
The Defined symbols box shows the symbols that are currently defined.
2.
To remove a defined symbol, select the symbol in the Defined symbols box and click on the Delete button.
Command line syntax
--undefine=macro_name
-Umacro_name
Description
With this option you can undefine an earlier defined macro as with
#undef
. This option is for example useful to undefine predefined macros.
The following predefined ISO C standard macros cannot be undefined:
__FILE__
__LINE__
__TIME__
__DATE__
__STDC__ current source filename current source line number (int type) hh:mm:ss
Mmm dd yyyy level of ANSI standard
Example
To undefine the predefined macro
__TASKING__
: ctc --undefine=__TASKING__ test.c
Related information
C compiler option --define
(Define preprocessor macro)
Section 1.6, Predefined Preprocessor Macros
358
Tool Options
C compiler option: --user-mode
Menu entry
1.
Select C/C++ Compiler » Miscellaneous.
2.
Add the option --user-mode to the Additional options field.
Command line syntax
--user-mode=mode
You can specify the following mode arguments:
user-0 user-1 kernel
User-0 unprivileged mode
User-1 privileged mode
Kernel/Supervisor mode
Default:
--user-mode=kernel
Description
With this option you specify the mode (I/O privilege mode) the TriCore runs in: User-0, User-1 or
Kernel/Supervisor. The availability of some instructions depends on this mode. Most instructions run in all modes. The instructions enable
and disable
run in User-1 or kernel mode only. The instructions bisr
, mtcr
, cachea.i
and tlb
instructions run in kernel mode only.
Instead of this option you can use the following pragma:
#pragma user_mode mode
Example
To restrict the instructions in the assembly code to User-1 mode, enter: ctc --user-mode=user-1 test.c
Related information
Pragma user_mode
Assembler option --user-mode (Select user mode)
359
TASKING VX-toolset for TriCore User Guide
C compiler option: --verbose (-v)
Menu entry
-
Command line syntax
--verbose
-v
Description
With this option the C compiler can generate additional informational diagnostics when available. For example, when code is generated to circumvent functional problems in the processor.
-
Related information
360
C compiler option: --version (-V)
Menu entry
-
Command line syntax
--version
-V
Description
Display version information. The compiler ignores all other options or input files.
Example
ctc --version
The compiler does not compile any files but displays the following version information:
TASKING VX-toolset for TriCore: C compiler vx.yrz Build nnn
Copyright 2002-year Altium BV Serial# 00000000
-
Related information
Tool Options
361
TASKING VX-toolset for TriCore User Guide
C compiler option: --warnings-as-errors
Menu entry
1.
Select Global Options.
2.
Enable the option Treat warnings as errors.
Command line syntax
--warnings-as-errors[=number,...]
Description
If the compiler encounters an error, it stops compiling. When you use this option without arguments, you tell the compiler to treat all warnings as errors. This means that the exit status of the compiler will be non-zero after one or more compiler warnings. As a consequence, the compiler now also stops after encountering a warning.
You can also limit this option to specific warnings by specifying a comma-separated list of warning numbers.
Related information
C compiler option --no-warnings (Suppress some or all warnings)
362