10.5.2. 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.

Note

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.

Configuring the target and architecture

Use the Target configuration panel to configure the target processor and architecture for the RealView Compiler:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. Click RealView Compiler in the Target Settings Panels list and click the Target tab to display the configuration panel (Figure 10.20).

    Figure 10.20. RealView Compiler Target configuration panel

    RealView Compiler Target configuration panel
  3. Select target options, as required:

    Architecture or Processor

    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.

    Note

    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.

  4. Select floating-point options:

    Floating Point

    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:

    [auto]

    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.

    VFPv3

    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.

    VFPv2

    Select this option to target hardware vector floating-point units conforming to architecture VFPv2.

    SoftVFP

    Select this option to use software floating-point linkage.

    SoftVFP+VFPv2

    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.

    SoftVFP+VFPv3

    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.

    None

    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.

    Floating Point Models

    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:

    Full IEEE

    All facilities, operations, and representations guaranteed by the IEEE standard are available in single and double-precision.

    Fixed IEEE: round-to-nearest, no inexact exceptions

    IEEE standard with round-to-nearest and no inexact exceptions.

    Stateless IEEE: compatible with Java

    IEEE standard with round-to-nearest and no exceptions. This mode is compatible with the Java floating-point arithmetic model.

    C/C++ Language Standard

    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.

    Fast mode, as supported by the VFP

    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.

  5. Select the instruction set to use:

    Initial State

    Use this group to configure how the compiler handles C and C++ source files in a target. Choose from:

    [auto]

    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.

    ARM

    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.

    Thumb

    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.

  6. Select the byte order used by your target hardware. This can be either Little Endian or Big Endian. The default setting is Little Endian.

  7. Click Apply to apply your changes without closing the Target Settings window.

Configuring PCS and code generation options

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:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. 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).

    Figure 10.21. RealView Compiler PCS / Code Gen configuration panel

    RealView Compiler PCS / Code Gen configuration panel
  3. Select the PCS variant options that you require using the Procedure Call Standard Options group box:

    ARM/Thumb interworking

    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.

    Note

    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.

    Read-only position independent

    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.

    Read-write position independent

    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.

  4. Click Apply to apply your changes without closing the Target Settings window.

Configuring code generation

To configure code generation options for the RealView Compiler:

  1. 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.

  2. 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.

  3. Click Apply to apply your changes without closing the Target Settings window.

Configuring sources

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:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. Click RealView Compiler in the Target Settings Panels list and click the Source tab to display the configuration panel (Figure 10.22).

    Figure 10.22. RealView Compiler Source configuration panel

    RealView Compiler Source configuration panel
  3. Select the language used by the compiler from the Source Language drop-down menu:

    [default]

    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.

  4. Select additional source language options in the Other Language Settings group box:

    Strict

    ISO violations are issued as Warnings by default. Select this option to issue ISO violations as Errors.

    GNU Language Extensions

    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.

  5. Select from the following C++ Language Settings for compiling C++ sources:

    Inject friend in the normal class scope

    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.

    Do not parse templates in their generic form

    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.

    Do not look-up template names when parsing

    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.

    Interpret ‘operator new’ as ‘operator nothrow new’

    Select this option if you want all new operator new calls in a compilation to be treated as operator new nothrow.

    Implicit use of std namespace

    Select this option to enable the implicit use of the std namespace option when standard header files are included.

    No implicit includes

    Select this option to disable implicit inclusion of source files as a method of finding definitions of template entities to be instantiated.

    Enable C++ exceptions

    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.

    Note

    For projects with mixed C and C++ sources, any C++ Language Settings are ignored when compiling the C sources.

  6. Click Apply to apply your changes without closing the Target Settings window.

Configuring debug and optimization

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:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. Click RealView Compiler in the Target Settings Panels list and click the Debug / Opt tab to display the configuration panel (Figure 10.23).

    Figure 10.23. RealView Compiler Debug / Opt configuration panel

    RealView Compiler Debug / Opt configuration panel
  3. Select debug control options:

    Enable debug table generation

    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.

    Improve debug view by not inlining

    Select this option to instruct the compiler to compile inline functions out of line so that they can be debugged at source more easily.

  4. Select the level of optimization:

    0 (minimum optimization, best debug view)

    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.

    1 (restricted optimization, good debug view)

    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.

    2 (high optimization, restricted debug view)

    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.

    3 (maximum optimization, restricted debug view)

    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.

  5. Select the optimization criterion:

    Space

    Select this option to favor small code size over execution speed. This is the default.

    Time

    Select this option to favor execution speed over code size.

  6. Click Apply to apply your changes without closing the Target Settings window.

Configuring the preprocessor

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:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. Click RealView Compiler in the Target Settings Panels list and click the Preprocessor tab to display the configuration panel (Figure 10.24).

    Figure 10.24. RealView Compiler Preprocessor configuration panel

    RealView Compiler Preprocessor configuration panel
  3. 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.

  4. 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.

  5. Click either:

    • Add to add a new macro definition to the list

    • Replace to edit the value of an existing macro definition.

  6. 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.

  7. Click Apply to apply your changes without closing the Target Settings window.

Configuring diagnostic information

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:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. Click RealView Compiler in the Target Settings Panels list and click the Diagnostics tab to display the configuration panel (Figure 10.25).

    Figure 10.25. RealView Compiler Diagnostics configuration panel

    RealView Compiler Diagnostics configuration panel
  3. Select which diagnostic messages are to be suppressed or reclassified.

    Enter a tag, or a list of tags separated by commas, as required:

    Suppress

    Disables all diagnostic messages that have the specified tag(s).

    Set to warning

    Sets the diagnostic messages that have the specified tag(s) to Warning severity.

    Set to error

    Sets the diagnostic messages that have the specified tag(s) to Error severity.

  4. Select warning options that apply to both C and C++, as required:

    No warnings

    Select this option to turn off all warnings.

    Warn for strict ansi

    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().

    Remarks

    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.

  5. Click Apply to apply your changes without closing the Target Settings window.

Reading compiler options from a file

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:

  1. Display the Target Settings window for the build target you want to configure (see Displaying Target Settings panels).

  2. Click RealView Compiler in the Target Settings Panels list and click the Extras tab to display the configuration panel (Figure 10.26).

    Figure 10.26. RealView Compiler Extras configuration panel

    RealView Compiler Extras configuration panel
  3. Enter the path name of the via file, or click Choose… and select the via file from the standard file dialog box.

  4. Click Apply to apply your changes without closing the Target Settings window.

Copyright © 1999-2001, 2005-2007 ARM Limited. All rights reserved.ARM DUI 0065G
Non-Confidential