µVision User's Guide: Arm C/C++ Compiler (2024)

Technical Support

  • Overview
  • Search
  • Contact
  • Assistance Request
  • Feedback

On-Line Manuals

  • Product Manuals
  • Document Conventions

µVision User's Guide

µVision User's Guide: Arm C/C++ Compiler (1) About µVisionµVision User's Guide: Arm C/C++ Compiler (2) User InterfaceµVision User's Guide: Arm C/C++ Compiler (3) Creating ApplicationsµVision User's Guide: Arm C/C++ Compiler (4) DebuggingµVision User's Guide: Arm C/C++ Compiler (5) Debug CommandsµVision User's Guide: Arm C/C++ Compiler (6) Debug FunctionsµVision User's Guide: Arm C/C++ Compiler (7) SimulationµVision User's Guide: Arm C/C++ Compiler (8) Flash ProgrammingµVision User's Guide: Arm C/C++ Compiler (9) DialogsµVision User's Guide: Arm C/C++ Compiler (10) FileµVision User's Guide: Arm C/C++ Compiler (11) Device DatabaseµVision User's Guide: Arm C/C++ Compiler (12) License ManagementµVision User's Guide: Arm C/C++ Compiler (13) EditµVision User's Guide: Arm C/C++ Compiler (14) ConfigurationµVision User's Guide: Arm C/C++ Compiler (15) EditorµVision User's Guide: Arm C/C++ Compiler (16) µVision User's Guide: Arm C/C++ Compiler (17) User KeywordsµVision User's Guide: Arm C/C++ Compiler (18) Shortcut KeysµVision User's Guide: Arm C/C++ Compiler (19) Text CompletionµVision User's Guide: Arm C/C++ Compiler (20) OtherµVision User's Guide: Arm C/C++ Compiler (21) ViewµVision User's Guide: Arm C/C++ Compiler (22) ProjectµVision User's Guide: Arm C/C++ Compiler (23) Project ItemsµVision User's Guide: Arm C/C++ Compiler (24) Project ItemsµVision User's Guide: Arm C/C++ Compiler (25) Folders/ExtensionsµVision User's Guide: Arm C/C++ Compiler (26) BooksµVision User's Guide: Arm C/C++ Compiler (27) Project Info/LayerµVision User's Guide: Arm C/C++ Compiler (28) Select DeviceµVision User's Guide: Arm C/C++ Compiler (29) Batch BuildµVision User's Guide: Arm C/C++ Compiler (30) Manage Run-Time EnvironmentµVision User's Guide: Arm C/C++ Compiler (31) OptionsµVision User's Guide: Arm C/C++ Compiler (32) DeviceµVision User's Guide: Arm C/C++ Compiler (33) PropertiesµVision User's Guide: Arm C/C++ Compiler (34) TargetµVision User's Guide: Arm C/C++ Compiler (35) Target (Arm Compiler)µVision User's Guide: Arm C/C++ Compiler (36) Target (GNU ARM)µVision User's Guide: Arm C/C++ Compiler (37) OutputµVision User's Guide: Arm C/C++ Compiler (38) Output (Arm Compiler)µVision User's Guide: Arm C/C++ Compiler (39) Output (GNU ARM)µVision User's Guide: Arm C/C++ Compiler (40) ListingµVision User's Guide: Arm C/C++ Compiler (41) Listing (Arm Compiler)µVision User's Guide: Arm C/C++ Compiler (42) Listing (GNU ARM)µVision User's Guide: Arm C/C++ Compiler (43) UserµVision User's Guide: Arm C/C++ Compiler (44) CompilerµVision User's Guide: Arm C/C++ Compiler (45) Arm C/C++ CompilerµVision User's Guide: Arm C/C++ Compiler (46) Arm C/C++ (AC6) CompilerµVision User's Guide: Arm C/C++ Compiler (47) GNU ARM C CompilerµVision User's Guide: Arm C/C++ Compiler (48) AssemblerµVision User's Guide: Arm C/C++ Compiler (49) Arm AssemblerµVision User's Guide: Arm C/C++ Compiler (50) GNU ARM AssemblerµVision User's Guide: Arm C/C++ Compiler (51) LinkerµVision User's Guide: Arm C/C++ Compiler (52) Arm LinkerµVision User's Guide: Arm C/C++ Compiler (53) GNU ARM LinkerµVision User's Guide: Arm C/C++ Compiler (54) DebugµVision User's Guide: Arm C/C++ Compiler (55) UtilitiesµVision User's Guide: Arm C/C++ Compiler (56) DebugµVision User's Guide: Arm C/C++ Compiler (57) BreakpointsµVision User's Guide: Arm C/C++ Compiler (58) Debug SettingsµVision User's Guide: Arm C/C++ Compiler (59) Memory MapµVision User's Guide: Arm C/C++ Compiler (60) Function EditorµVision User's Guide: Arm C/C++ Compiler (61) ToolsµVision User's Guide: Arm C/C++ Compiler (62) Setup PC-LintµVision User's Guide: Arm C/C++ Compiler (63) Customize Tools MenuµVision User's Guide: Arm C/C++ Compiler (64) Configure Merge ToolµVision User's Guide: Arm C/C++ Compiler (65) SVCSµVision User's Guide: Arm C/C++ Compiler (66) UtilitiesµVision User's Guide: Arm C/C++ Compiler (67) Command LineµVision User's Guide: Arm C/C++ Compiler (68) Example ProgramsµVision User's Guide: Arm C/C++ Compiler (69) Appendix

Home/µVision User's Guide

Options dialog for ARM Compiler 5.

Preprocessor Symbols

Define
Sets 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,

µVision User's Guide: Arm C/C++ Compiler (70)

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

Enable ARM/Thumb Interworking
Available only for CPUs that can switch between ARM and Thumb mode.
Generates code that can be called in any CPU mode (ARM or Thumb). Sets the compiler command-line option --apcs=interwork.
Execute-only Code
Generates execute-only code and prevents the compiler from generating any data accesses to code sections. Creates code that does not have literal pools embedded in the code section, hence the HW can enforce that only the instruction fetch is allowed to read from the memory (protection of firmware).
Restricted to
  • C code.
  • Thumb code.
  • Cortex-M3 and Cortex-M4 processor-based devices.
  • armcc compiler version 5.04 and above.

The flag sets the compiler command-line option --execute_only.

Optimization
Control compiler code optimization for the generated code. Sets the compiler command-line option -Onum:
  • Default: Use the compiler default or the setting of a higher Target or Group level.
  • Level 0 (-O0): Turn off all optimization, except some simple source transformations.
  • Level 1 (-O1): Turn off optimizations that seriously degrade the debug view.
  • Level 2 (-O2): High optimization (default level). The debug view might be less satisfactory because the mapping of object code to source code is not always clear.
  • Level 3 (-O3): Maximum optimization. Note that Level 3 in combination with Optimize for Time may generate more code that Level 2 since it may unroll loops.
Optimize for Time
Reduce execution time at the possible expense of a larger code size. Sets the compiler command-line option -Otime. If not enabled, the compiler assumes -Ospace.
Split Load and Store Multiple
Instructs 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 command-line option --split_ldm.
One ELF Section per Function
Generate one ELF section for each function in source file. Output sections are named with the same name as the function that generates the section. Allows you to optimize code or to locate each function on individual memory addresses. Sets the compiler command-line option --split_sections.
Strict ANSI C
Check for strict ANSI C conformance of the source file. Sets the compiler command-line option --strict.
Enum Container always int
When disabled, the data type container for enum is optimized according to the value range. When enabled, the data type container for enum is always signed int. Sets the compiler command-line option --enum_is_int. See also remarks in --interface_enums_are_32_bit.
Plain Char is Signed
Instructs the compiler to treat all variables declared with plain char as signed char. Sets the compiler command-line option --signed_chars.
Read-Only Position Independent
Generate position independent code for const (ROM) accesses. Sets the compiler command-line option --apcs=/ropi.
Read-Write Position Independent
Generate position independent code for variable (RAM) accesses. Sets the compiler command-line option --apcs=/rwpi.
Warnings
Control generation of warning messages. Default is unspecified, which defaults to All Warnings. The selection No Warnings sets the command-line option -W.
Thumb Mode
Select explicitly Thumb or ARM code for a file or file group. Note: in the dialog Target, the selection of the field Code Generation sets the default.
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. Compiler auto-include paths can be viewed in the field Compiler control string.
C99 Mode
The compiler compiles C as defined by the 1999 C standard and addenda:
  • ISO/IEC 9899:1999. The 1999 International Standard for C.
  • ISO/IEC 9899:1999/Cor 2:2004. Technical Corrigendum 2.
The selection sets the command-line option --c99.
Include Paths
Allows you to supply one or more (separated by semi-colon) paths to search for header files. For example, for #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, the paths specified in the include paths box are searched. When this search fails again, then the paths specified in the field INC under Project — Manage — Project Items are used.
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 in the field to view all directives.
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.
__MICROLIB 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.

Related Knowledgebase Articles

  • GENERAL: Using Targets Effectively
  • RL-ARM: Event Viewer Not Working when Using Keil RL-ARM RTX source
  • ARM: Using Board Support Drivers With Other Peripheral Ports
  • ARMCC: Error #268: Declaration may not appear after Executable State
  • ARMCC: Information About Optimization Level During Runtime
µVision User's Guide: Arm C/C++ Compiler (2024)
Top Articles
Latest Posts
Article information

Author: Gregorio Kreiger

Last Updated:

Views: 6284

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Gregorio Kreiger

Birthday: 1994-12-18

Address: 89212 Tracey Ramp, Sunside, MT 08453-0951

Phone: +9014805370218

Job: Customer Designer

Hobby: Mountain biking, Orienteering, Hiking, Sewing, Backpacking, Mushroom hunting, Backpacking

Introduction: My name is Gregorio Kreiger, I am a tender, brainy, enthusiastic, combative, agreeable, gentle, gentle person who loves writing and wants to share my knowledge and understanding with you.