| |||
| Home > Configuring a Build Target > Configuring assembler and compiler language settings > Configuring the RealView Compiler | |||
This section describes how to configure the RealView Compiler (armcc) from within the CodeWarrior IDE. It provides general descriptions of the available options used for compiling C and C++ source files.
Many of the configuration settings described here use default settings that are appropriate for most development projects. However, you should review at least the Target options and PCS options to ensure that they are suitable for your project.
The RealView Compiler panel consists of a number of tabbed configuration panels. The available options are described in:
These sections provide general descriptions of the available compiler options. For more detailed descriptions, see the RealView Compilation Tools Compiler User Guide.
Use the Target configuration panel to configure the target processor and architecture for the RealView Compiler:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the Target tab to display the configuration panel (Figure 10.20).
Select target options, as required:
Select the processor or architecture for your target hardware from the drop-down menu. Some processor-specific instructions produce either errors or warnings if compiled for the wrong target architecture.
If you select a processor from the Architecture or Processor drop-down menu, the following behavior applies:
Specifying the processor selects the appropriate architecture and FPU.
Some processor specifications imply an FPU selection.
For example, when compiling in ARM state, choosing ARM1136JF-S implies
VFPv2.
Be aware that any explicit FPU (set with --fpu)
on the command line overrides an implicit FPU.
Select floating-point options:
Use this option to select the target Floating Point Unit (FPU) architecture. Floating-point instructions produce either errors or warnings if assembled for the wrong target FPU. Choose from:
Use the floating-point selection based on the chosen processor or architecture (using the Architecture or Processor drop-down menu).
This is the default setting.
Select this option to target hardware vector floating-point units conforming to architecture VFPv3.
VFPv3 is backwards compatible with VFPv2 except that VFPv3 cannot trap floating-point exceptions. If your project does not make use of floating-point exception trapping, it should work without any changes on VFPv3.
Select this option to target hardware vector floating-point units conforming to architecture VFPv2.
Select this option to use software floating-point linkage.
Selects software floating-point library with software floating-point linkage, and requires a VFP unit conforming to architecture VFPv2. Select this option if you are interworking Thumb code with ARM code on a system that implements a VFP unit.
Selects software floating-point library with software floating-point linkage, and requires a VFP unit conforming to architecture VFPv3. Select this option if you are interworking Thumb code with ARM code on a system that implements a VFP unit.
Select this option if you are not targeting a hardware floating-point unit, nor using the software floating-point library. This produces an error if your code contains floats.
Use this option to select the floating-point model to use. The model specifies floating-point conformance and sets library attributes and floating-point optimizations. Choose from:
All facilities, operations, and representations guaranteed by the IEEE standard are available in single and double-precision.
IEEE standard with round-to-nearest and no inexact exceptions.
IEEE standard with round-to-nearest and no exceptions. This mode is compatible with the Java floating-point arithmetic model.
IEEE finite values with denormals flushed to zero, round-to-nearest, and no exceptions. This model is C and C++ compatible. This is the default option.
Perform more aggressive floating-point optimizations that might cause a small loss of accuracy to provide a significant performance increase. This option results in behavior that is not fully ISO C and C++ standard-compliant, however, numerically robust floating-point programs behave correctly.
Select the instruction set to use:
Use this group to configure how the compiler handles C and C++ source files in a target. Choose from:
Invoke the RealView Compiler, using the default behavior, with armcc.
Compile all C and C++ files as ARM instructions but make adjustments
to the startup configuration based on the filename extensions, for
example, compile files with .tc and .tcpp filename
extensions as Thumb instructions.
Invoke the RealView Compiler with armcc --arm.
Select this option to override the file extension adjustments made by the RealView Compiler. This means that all C and C++ sources are compiled as ARM instructions regardless of the filename extension.
Invoke the RealView Compiler with armcc --thumb.
Select this option to override the file extension adjustments made by the RealView Compiler. This means that all C and C++ sources are compiled as Thumb instructions regardless of the filename extension.
Select the byte order used by your target hardware. This can be either Little Endian or Big Endian. The default setting is Little Endian.
Click Apply to apply your changes without closing the Target Settings window.
Selecting the PCS (Procedure Call Standard) options instructs the compiler to generate code that conforms to the appropriate PCS variant. In general, you must ensure that you use compatible calling standard options when you are compiling objects or libraries that you expect to link together.
In addition, if you are calling routines written in ARM assembly language you must ensure that your assembly language code follows the conventions required by the PCS options you select, and that the assembler is configured with the appropriate PCS options. See Configuring PCS options for details.
To configure the PCS options for the ARM RealView Compiler:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the PCS / Code Gen tab to display the configuration panel (see Figure 10.21).
Select the PCS variant options that you require using the Procedure Call Standard Options group box:
Select this option if you are writing ARM code that you want to interwork with Thumb code, or Thumb code that you want to interwork with ARM code. The linker generates suitable interworking veneers if necessary at link time. See the description of interworking in the RealView Compilation Tools Developer Guide for more information.
ARM recommends that all code in mixed ARM/Thumb projects is compiled for interworking. At the very least, functions that may possibly be called from the other state should be compiled for interworking.
Select this option to mark your code as read-only position-independent.
See the ROPI option in the RealView Compilation Tools
Compiler Reference Guide for more information.
Select this option to mark your code as read-write position-independent.
See the RWPI option in the RealView Compilation Tools
Compiler Reference Guide for more information.
Click Apply to apply your changes without closing the Target Settings window.
To configure code generation options for the RealView Compiler:
Select the One ELF section per function check
box to generate one ELF section for each function in the source
file. Output sections are named with the same name as the function
that generates the section, but with an i. prefix.
This option increases code size slightly (typically by a few percent)
for some functions because it reduces the potential for sharing
addresses, data, and string literals between functions.
Specify a linker feedback file or use the Choose... button to locate it. Linker feedback enables the efficient elimination of unused functions.
If you specify a feedback file that does not exist, it is created by the link command and used in subsequent compilations.
Click Apply to apply your changes without closing the Target Settings window.
Selecting source options tells the RealView Compiler about the source language you are using and how it is to be compiled. See the RealView Compilation Tools Compiler User Guide for detailed information on C and C++ standards conformance and implementation details.
To configure source options for the ARM RealView Compiler:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the Source tab to display the configuration panel (Figure 10.22).
Select the language used by the compiler from the Source Language drop-down menu:
Select this option to compile C and C++ sources using the compiler defaults, that is:
ISO Standard C (1990), for all C code
ISO Standard C (1999), for all C code
ISO Standard C++ (1998), for all C++ code.
See the RealView Compilation Tools Compiler User Guide for more information on language options.
Select additional source language options in the Other Language Settings group box:
ISO violations are issued as Warnings by default. Select this option to issue ISO violations as Errors.
Select this option to enable the GNU compiler extensions supported by the RealView Compiler.
See the RealView Compilation Tools Compiler Reference Guide for more information.
Select from the following C++ Language Settings for compiling C++ sources:
Select
this option to control whether or not the name of a class or function
that is declared only in friend declarations
is visible when using the normal lookup mechanisms.When friend names
are injected, they are visible to these lookups. When friend names
are not injected (as required by the standard), function names are
visible only when using argument-dependent lookup and class names
are never visible.
Select this option to disable the parsing of non-class templates in their generic form, that is, even if they are not instantiated. If dependent name processing is enabled, templates are parsed by default.
Select this option to disable dependent name processing, that is, the separate look-up of names in templates at the time the template is parsed, and at the time it is instantiated.
Select this option if you want
all new operator new calls in a compilation to
be treated as operator new nothrow.
Select this option to enable the implicit use of
the std namespace option when standard header
files are included.
Select this option to disable implicit inclusion of source files as a method of finding definitions of template entities to be instantiated.
Select this option to configure the compiler to perform unwinding of functions at runtime. Function unwinding is implemented by emitting an exception table describing the operations to be performed.
For projects with mixed C and C++ sources, any C++ Language Settings are ignored when compiling the C sources.
Click Apply to apply your changes without closing the Target Settings window.
Use the Debug / Opt configuration panel to set debug controls, and optimization levels and criteria for the compiler. The optimization selections you make affect the quality of the debug view of your code.
To configure optimization and debug options for the compiler:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the Debug / Opt tab to display the configuration panel (Figure 10.23).
Select debug control options:
Select this option to instruct the compiler to generate debug information. This option enables you to debug your output images at the source level. If this option is not selected, source level debugging is not available for the image.
Select this option to instruct the compiler to compile inline functions out of line so that they can be debugged at source more easily.
Select the level of optimization:
Select this option to disable most compiler optimizations. Use this option in combination with enabled debug table generation to generate the best possible debug view of your output image and the lowest level of optimization.
Select this option to disable compiler optimizations that impact seriously on the debug view. Use this option in combination with enabled debug table generation to generate code that provides a good compromise between optimization and debug.
Select this option to enable high optimization. If this option is used in combination with enabled debug table generation, the debug view might be less satisfactory because the mapping of object code to source code is not always clear.
Select this option to enable all compiler optimizations. This option might result in a restricted debug view of your output image due to code movement and register re-use.
If you select the option to generate debug information but
do not specify the level of optimization, the ARM compiler assumes
a default of 2, that is, it adds -O2 to the
command line. When you build your project, the CodeWarrior IDE displays
a warning message in the message window.
Select the optimization criterion:
Select this option to favor small code size over execution speed. This is the default.
Select this option to favor execution speed over code size.
Click Apply to apply your changes without closing the Target Settings window.
Use the Preprocessor configuration panel to configure preprocessor macros and to set search path options. To add, replace, or delete a preprocessor macro for the RealView Compiler:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the Preprocessor tab to display the configuration panel (Figure 10.24).
If you are modifying an existing definition, double-click
on the entry in the list of #DEFINE macro definitions
so that it appears in the edit box. (You can create a new macro,
by typing over the existing macro name.)
If you want to add a new definition, enter the new macro name
in the edit field, for example, EXAMPLE_DEFINE.
Edit the value of the macro definition as appropriate, for example:
EXAMPLE_DEFINE=2
If you do not enter a value, the value defaults to 1.
Click either:
Add to add a new macro definition to the list
Replace to edit the value of an existing macro definition.
If you want to delete an existing definition, double-click
on the entry in the list of #DEFINE macro definitions
so that it appears in the edit box. Then click Delete.
Click Apply to apply your changes without closing the Target Settings window.
The RealView Compiler issues messages warning about portability problems or other potential problems in your code. You can use the Diagnostics tab to configure the compiler to suppress or enable specific warnings.
To control the output of the diagnostic messages generated by the compiler:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the Diagnostics tab to display the configuration panel (Figure 10.25).
Select which diagnostic messages are to be suppressed or reclassified.
Enter a tag, or a list of tags separated by commas, as required:
Disables all diagnostic messages that have the specified tag(s).
Sets the diagnostic messages that have the specified tag(s) to Warning severity.
Sets the diagnostic messages that have the specified tag(s) to Error severity.
Select warning options that apply to both C and C++, as required:
Select this option to turn off all warnings.
Select this option to enable warning messages issued when extensions to the ANSI standard are used implicitly, for example:
using an unwidened type in an ANSI C assignment
specifying bitfields with a type of char, short, long, or long long
specifying char, short, float,
or enum, arguments to variadic functions such as va_start().
Select this option if you want the compiler to issue remark messages, such as warning of padding in structures. These messages are not issued by default.
Click Apply to apply your changes without closing the Target Settings window.
Use the Extras configuration panel to specify a via file for the compiler. A via file is a text file that contains additional command-line arguments to the compiler. Via files are read when the compiler is invoked. The via file options are processed after the options specified in the configuration panels, and override them if there is a conflict. You can use via files:
to ensure that the same compiler settings are used by different build targets and projects
to include exceptionally long command-line options to the compiler.
See the RealView Compilation Tools Compiler User Guide for a description of via file syntax.
To specify a via file:
Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).
Click RealView Compiler in the Target Settings Panels list and click the Extras tab to display the configuration panel (Figure 10.26).
Enter the path name of the via file, or click Choose… and select the via file from the standard file dialog box.
Click Apply to apply your changes without closing the Target Settings window.