RealView Compiler User Guide

Keil™, An ARM® Company

Version 4.0


Table of Contents

Preface
About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback
Feedback on RealView Compilation Tools
Feedback on this book
1. Introduction
1.1. About the ARM compiler
1.2. Source language modes
1.3. The C and C++ libraries
2. Getting started with the ARM Compiler
2.1. Using command-line options
2.1.1. Invoking the ARM compiler
2.1.2. Ordering command-line options
2.1.3. Specifying command-line options with an environment variable
2.1.4. Autocompleting command-line options
2.1.5. Reading compiler options from a file
2.1.6. Specifying stdin input
2.2. File naming conventions
2.2.1. Portability
2.2.2. Output files
2.3. Header files
2.3.1. The current place
2.3.2. The RVCT40INC environment variable
2.3.3. The search path
2.3.4. The TMP environment variable
2.4. Precompiled header files
2.4.1. Automatic PCH processing
2.4.2. Manual PCH processing
2.4.3. Controlling the output of messages during PCH processing
2.4.4. Performance issues
2.5. Specifying the procedure call standard (AAPCS)
2.5.1. Interworking qualifiers
2.5.2. Position independence qualifiers
2.6. Using linker feedback
2.6.1. Eliminating unused functions
2.6.2. Reduction of compilation required for interworking
2.7. Adding symbol versions
3. Compiler Features
3.1. Intrinsics
3.1.1. About intrinsics
3.1.2. Instruction intrinsics
3.1.3. ETSI basic operations
3.1.4. TI C55x intrinsics
3.1.5. Named register variables
3.2. Pragmas
3.3. Bit-banding
3.3.1. Using __attribute__((bitband))
3.3.2. Using --bitband on the command-line
3.3.3. Restrictions
3.4. Thread-local storage
3.5. Eight-byte alignment features
4. Coding Practices
4.1. Optimizing code
4.1.1. Optimizing for size versus speed
4.1.2. Optimization levels and the debug view
4.1.3. Selecting the target device
4.1.4. Optimizing loops
4.1.5. Using volatile
4.2. Code metrics
4.2.1. Measuring code and data sizes
4.2.2. Measuring stack use
4.2.3. Reducing debug information in objects and libraries
4.3. Functions
4.3.1. Minimizing parameter passing overhead
4.3.2. __value_in_regs
4.3.3. __pure
4.3.4. Placing ARM function qualifiers
4.4. Function inlining
4.4.1. How the compiler decides to inline
4.4.2. When is it practical for the compiler to inline?
4.4.3. Managing inlining
4.4.4. Automatic inlining
4.4.5. Differences in behavior between C++, C90, C99, and GNU C90 compiler modes
4.4.6. Linker inlining
4.4.7. Debugging data and the --no_inline and --inline command-line options
4.4.8. Marking functions as static
4.4.9. Setting breakpoints on inline functions in ROM images
4.5. Aligning data
4.5.1. Types of data alignment
4.5.2. Unaligned data access
4.5.3. The __packed qualifier and unaligned data access
4.5.4. __packed structures versus individually __packed fields
4.6. Using floating-point arithmetic
4.6.1. Support for floating-point operations
4.6.2. VFP architectures
4.6.3. VFP support
4.6.4. Floating-point computations and linkage
4.7. Trapping and identifying division-by-zero errors
4.7.1. Integer division
4.7.2. (Software) Floating-point division
4.8. New features of C99
4.8.1. Language features
4.8.2. Library features
5. Diagnostic Messages
5.1. Redirecting diagnostics
5.2. Severity of diagnostic messages
5.3. Controlling the output of diagnostic messages
5.4. Changing the severity of diagnostic messages
5.5. Suppressing diagnostic messages
5.6. Prefix letters in diagnostic messages
5.7. Suppressing warning messages with -W
5.8. Exit status codes and termination messages
5.8.1. Response to signals
5.8.2. Exit status
5.9. Data flow warnings
6. Using the Inline and Embedded Assemblers
6.1. Inline assembler
6.1.1. Inline assembler support
6.1.2. Inline assembler syntax
6.1.3. Restrictions on inline assembly operations
6.1.4. Virtual registers
6.1.5. Constants
6.1.6. Instruction expansion
6.1.7. Condition flags
6.1.8. Operands
6.1.9. Function calls and branches
6.1.10. Labels
6.1.11. Differences from previous versions of the ARM C/C++ compilers
6.2. Embedded assembler
6.2.1. Embedded assembler syntax
6.2.2. Restrictions on embedded assembly
6.2.3. Differences between expressions in embedded assembly and C or C++
6.2.4. Generation of embedded assembly functions
6.2.5. The __cpp keyword
6.2.6. Manual overload resolution
6.2.7. Keywords for related base classes
6.2.8. Keywords for member function classes
6.2.9. Calling non-static member functions
6.3. Legacy inline assembler that accesses sp, lr, or pc
6.3.1. Accessing sp (r13), lr (r14), and pc (r15) in legacy code
6.4. Differences between inline and embedded assembly code

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks owned by ARM® Limited. Other brands and names mentioned herein may be the trademarks of their respective owners.

Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This document is intended only to assist the reader in the use of the product. ARM Limited shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.

Where the term ARM is used it means “ARM or any of its subsidiaries as appropriate”.

Some material in this document is based on IEEE 754 - 1985 IEEE Standard for Binary Floating-Point Arithmetic. The IEEE disclaims any responsibility or liability resulting from the placement and use in the described manner.

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.

Unrestricted Access is an ARM internal classification.

Product Status

The information in this document is final, that is for a developed product.

Revision History
Revision A May 2007 Release for RVCT for µVision v3.1
Revision B December 2008 Release for RVCT for µVision v4.0
ARM KUI 0097A
Non-Confidential