Keil Logo

Arm C/C++ (AC6) Compiler

Options dialog for ARM Compiler 6.

Preprocessor Symbols

Define
Set preprocessor symbols which can be checked with #if, #ifdef and #ifndef. The defined names are copied exactly as they are entered (case-sensitive). Optionally, each name can get a value. For example,

Define: Check, NoExtRam, X1=1+5

is identical to the following C preprocessor #define statements:
#define Check 1
#define NoExtRam 1
#define X1 1+5

Note

  • Settings of the Define field get translated into the command line option -Doption.
  • To define X2 without setting a value, enter -DX2= in the field Misc Controls.
Undefine
Clears previous Define assignments that are entered in the options dialog of a higher Target or Group level.

Language / Code Generation

Execute-only Code
Generates execute-only code, and prevents the compiler from generating any data accesses to code sections. Sets the compiler control string -mexecute-only.
Optimization
Control compiler code optimization. Sets the compiler control string -Onum|string.
  • <default> — is the uVision default setting. Uses the default compiler level, or the setting from the uVision target or parent group. No compiler control string is set.
  • -O0 — is the compiler default level. Turns off most optimizations, except some simple source transformations. Executes minimum optimizations for the performance of the compiled binary. This option gives the best possible debug view.
  • -O1 — restricted optimization. Gives a generally satisfactory debug view with good code density.
  • -O2 — high optimization. The debug view might be less satisfactory because the mapping of object code to source code is not always clear. The compiler might perform optimizations that cannot be described by debug information.
  • -O3 — maximum optimization. This option typically gives a poor debug view.
  • -Ofast — Enable all the optimizations from -O3 along with other aggressive optimizations that might violate strict compliance with language standards, including -ffast-math.
  • -Os balanced — Balances code size against code speed. By default, the compiler performs optimizations to increase performance, at the expense of a possible increase in image size. Sets the compiler control string -Os.
  • -Oz image size — optimize for code size. By default, the compiler performs optimizations to increase performance, at the expense of a possible increase in image size. Sets the compiler control string -Oz.
Link-Time Optimization
Intermodular Optimization performed during the link state. Sets the compiler control string -flto.
Split Load and Store Multiple
Instruct the compiler to split LDM and STM instructions into two or more LDM or STM instructions to reduce interrupt latency. When the LDM/STM have more than 5 (more than 4 when the PC is changed) CPU registers, several LDM/STM instructions are generated. Sets the compiler control string -fno-ldm-stm.
One ELF Section per Function
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 a .text. prefix. Allows you to optimize code or to locate each function on individual memory addresses. If you want to place specific data items or structures in separate sections, mark them individually with __attribute__((section("name"))). Sets the compiler control string -ffunction-sections. Is enabled by default.
Restrictions
This option reduces the potential for sharing addresses, data, and string literals between functions. As a consequence, it might increase code size slightly for some functions.
Warnings
Control generation of diagnostics with the following settings:
  • <unspecified> — adds no compiler control string. The behavior depends on compiler defaults or on options set on parent uVision group levels. Is the default setting.
  • No Warnings — no diagnostics are shown. Sets the compiler control string -W.
  • All Warnings — is the uVision default setting. Show all diagnostics (-Weverything) and excludes (-Wno-xxx) those listed in the compiler control string:
    -Weverything
    -Wno-reserved-id-macro
    -Wno-unused-macros
    -Wno-documentation-unknown-command
    -Wno-documentation
  • AC5-like Warnings — show all warnings that ARM Compiler 5 would show. Suppresses the following warnings:
    -Wno-missing-variable-declarations
    -Wno-missing-prototypes
    -Wno-missing-noreturn
    -Wno-sign-conversion
    -Wnonportable-include-path
    -Wno-packed
    -Wno-reserved-id-macro
    -Wno-unused-macros
    -Wno-documentation-unknown-command
    -Wno-documentation
    -Wno-license-management
    -Wno-parentheses-equality
  • MISRA compatible — show all warnings except those that conflict with MISRA rules. Adds the control strings:
    -Wno-covered-switch-default
    -Wno-unreachable-code-break
Turn Warnings into Errors
Warning messages are treated as errors. Sets the compiler control string -Werror.
Plain Char is Signed
Instruct the compiler to treat all variables declared with plain char as signed char. Sets the compiler control string -fsigned-char. Disabled by default, adding the compiler control string -funsigned-char
Read-Only Position Independent
Generate position independent code for const (ROM) accesses. Sets the compiler control string -fropi.
Automatically enables -fropi-lowering. This implies that the static initialization is done at runtime by the same mechanism that is used to call the constructors of static C++ objects that must run before main().
Restrictions
  • Cannot be used with C++ code.
Read-Write Position Independent
Generate position independent code for variable (RAM) accesses. Sets the compiler control string -frwpi.
Automatically enables both options:
-fropi-lowering — this implies that the static initialization is done at runtime by the same mechanism that is used to call the constructors of static C++ objects that must run before main().
-frwpi-lowering — this implies that the static initialization is done at runtime by the C++ constructor mechanism for both C and C++ code.
Language C
Specifies the language standard for C-code. These settings are propagated to the dependent groups and files, and are applied on file level during compilation. The file type decides whether the compiler is using the Language C or Language C++ settings. Verify the settings in the dialog Properties of a *.c file.
For additional information on language support and restrictions refer to chapter 1.3 LLVM component versions and language compatibility .
Adds the compiler control string -xc in addition to those listed below.
  • <default> — defaults to the setting of the parent uVision group or target or to the compiler default. Sets no compiler control string.
  • c90 — compile C as defined by the 1990 C standard. Is the default uVision setting and sets the compiler control string -std=c90.
  • gnu90 — compile C as defined by the 1990 C standard, with additional GNU extensions. Sets the compiler control string -std=gnu90.
  • c99 — compile C as defined by the 1999 C standard. Sets the compiler control string -std=c99.
  • gnu99 — compile C as defined by the 1999 C standard, with additional GNU extensions. Sets the compiler control string -std=gnu99.
  • c11 — compile C as defined by the 2011 C standard. Sets the compiler control string -std=c11.
  • gnu11 — compile C as defined by the 2011 C standard, with additional GNU extensions. Sets the compiler control string -std=gnu11. Is the compiler default for C files.
Language C++
Specifies the language standard for C++ code. These settings are propagated to the dependent groups and files, and are applied on file level during compilation. None of the options below can be viewed in the field Compiler control string on target or group level. Verify the settings in the dialog Properties of a *.cpp file. The file type decides whether the compiler is using the Language C++ or Language C settings.
Adds the compiler control string -xc++ in addition to those listed below.
  • <default> — defaults to the setting of the parent uVision group or target or to the compiler default. Sets no compiler control string.
  • c++98 — compile C++ as defined by the 1998 standard. Is the default uVision setting and sets the compiler control string -std=c++98. Is the compiler default for C++ files.
  • gnu++98 — compile C++ as defined by the 1998 standard, with additional GNU extensions. Sets the compiler control string -std=gnu++98.
  • c++11 — compile C++ as defined by the 2011 standard. Sets the compiler control string -std=c++11.
  • gnu++11 — compile C++ as defined by the 2011 standard, with additional GNU extensions. Sets the compiler control string -std=gnu++11.
  • c++03 — compile C++ as defined by the 2003 standard. Sets the compiler control string -std=c++03.
  • c++14(community) — compile C++ as defined by the 2014 standard. Sets the compiler control string -std=c++14. Refer to 1.1 Support level definitions for information about community features.
Short enums/wchar
Optimize code size to improve memory usage. The option might reduce performance. Is enabled by default. Sets the compiler control strings:
-fshort-enums — set the size of an enumeration type to the smallest data type that can hold the largest enumerator value (the default size of an enumeration type is at least 32 bits for -fno-short-enums).
-fshort-wchar — set the size of wchar_t to 2 bytes (the default size of wchar_t is 4 bytes for -fno-short-wchar).
Restrictions
  • ISO C restricts enumerator values to the range of int. By default, the compiler does not issue warnings about enumerator values that are too large, but when Warnings is set to Pedantic, a warning is displayed.
  • All linked objects, including libraries, must make the same choice. Neither is it possible to link an object file compiled with -fshort-enums with another object file that is compiled without -fshort-enums, nor to link an object file compiled with -fshort-wchar with another object file that is compiled without -fshort-wchar.
use RTTI
Controls support for the RTTI features dynamic_cast and typeid in C++. Removes the compiler control string -fno-rtti, which is set by default (box unchecked).
No Auto Includes
Suppress all C/C++ paths that are included automatically during compilation. System includes, such as stdio.h, are not affected by the settings of this box. Removes all auto include paths from the field Compiler control string.

Include Paths
Supply one or more (separated by semicolon) paths to search for header files. For example, with #include "filename.h", the compiler searches the current folder first and then the folder of the source file. When this fails or when #include <filename.h> is used, then the paths specified in this box are searched. When this search fails again, the search continues in the paths specified in the field INC of the dialog Project — Manage — Project Items.
Misc Controls
Specify any directive for which there is no individual dialog control. For example, to change the error message language to Japanese refer to Show Japanese Messages.
Compiler control string
Displays the current directives at the compiler command line. Scroll down the field to view all settings. Language C++ settings are not listed on target or group level. Refer to the comments in section Language C++.
The following control strings are added, depending on the use of MDK:
Control String Description
__UVISION_VERSION Major and minor version of µVision. For example: -D__UVISION_VERSION="520".
_RTE_ Set when RTE is in use. For example: -D_RTE_.
__RTX Set when RTX Kernel has been selected in Options for Target - Target - Operation System. Not set when using RTE. For example: -D__RTX.
__MICORLIB Set when Use MicroLIB has been enabled in Options for Target - Target. For example: -D__MICROLIB.
__EVAL µVision runs in evaluation mode. License MDK-Lite. For example: -D__EVAL.
device header name Device header name.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.