RealView ® Developer Kit Compiler andLibraries Guide

Version 1.0


Table of Contents

Preface
About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback
Feedback on RealView Developer Kit
Feedback on this book
1. Introduction
1.1. About RVCT
1.2. The ARM compiler and libraries
1.2.1. The ARM compiler
1.2.2. The C and C++ libraries
1.2.3. Differences between the RVCT v2.0 compilerand previous ARM compilers
1.3. Semihosting
2. Using the ARM Compiler
2.1. About the ARM compiler
2.1.1. Standards and compatibility
2.1.2. Invoking the ARM compiler
2.1.3. Source language modes
2.1.4. Inline and embedded assembly language
2.1.5. Library support
2.2. File usage
2.2.1. Naming conventions
2.2.2. Included files
2.2.3. Precompiled header files
2.3. Command syntax
2.3.1. Invoking the ARM compiler
2.3.2. Procedure Call Standard options
2.3.3. Setting the source language
2.3.4. Specifying search paths
2.3.5. PCH processing options
2.3.6. Setting preprocessor options
2.3.7. C++ Language configurationand object generation
2.3.8. Specifying output format
2.3.9. Specifying the target processor orarchitecture
2.3.10. Generating debug information
2.3.11. Controlling code generation
2.3.12. Diagnostic messages
3. ARM Compiler Reference
3.1. Compiler-specific features
3.1.1. Pragmas
3.1.2. Function keywords
3.1.3. Variable declaration keywords
3.2. Language extensions
3.2.1. C language extensions
3.2.2. C and C++ language extensions
3.3. C and C++ implementation details
3.3.1. Character sets and identifiers
3.3.2. Basic data types
3.3.3. Operations on basic data types
3.3.4. Structures, unions, enumerations,and bitfields
3.3.5. Change to ::operator new function
3.3.6. Tentative arrays not supported
3.3.7. Old-style C parameters in C++ functions
3.3.8. Anachronisms
3.3.9. Template instantiation
3.3.10. Namespaces
3.3.11. Extern inline function
3.4. Predefined macros
4. Inline and Embedded Assemblers
4.1. Inline assembler
4.1.1. Inline assembler syntax
4.1.2. Virtual registers
4.1.3. Instructions
4.1.4. Operands
4.1.5. Function calls and branches
4.1.6. Labels
4.1.7. Differences from previous versionsof the ARM C/C++ compilers
4.1.8. Restrictions on inline assembly operations
4.2. Embedded assembler
4.2.1. Embedded assembler syntax
4.2.2. Restrictions on embedded assembly
4.2.3. Differences between expressions in embeddedassembler and C or C++
4.2.4. Generation of embedded assembly functions
4.2.5. The __cpp keyword
4.2.6. Manual overload resolution
4.2.7. Keywords for relatedbase classes
4.2.8. Keywords for member function classes
4.2.9. Calling non-static member functions
4.3. Differences between inline and embeddedassembly code
5. The C and C++ Libraries
5.1. About the runtime libraries
5.1.1. Build options and library variants
5.1.2. Library directory structure
5.1.3. Reentrancy and static data
5.2. Building an application with the Clibrary
5.2.1. Building an application for a semihostedenvironment
5.2.2. Building an application for a nonsemihostedenvironment
5.3. Building an application without theC library
5.3.1. Integer and FP helper functions
5.3.2. Bare machine integer C
5.3.3. Bare machine C with floating-point
5.3.4. Exploiting the C library
5.3.5. The standalone C library functions
5.4. Tailoring the C library to a new executionenvironment
5.4.1. How C and C++ programs use the libraryfunctions
5.4.2. Exiting from the program
5.4.3. __rt_entry
5.4.4. __rt_exit()
5.4.5. __rt_lib_init()
5.4.6. __rt_lib_shutdown()
5.5. Tailoring static data access
5.6. Tailoring locale and CTYPE
5.6.1. Selecting locale at link time
5.6.2. Selecting locale at run time
5.6.3. Macros and utility functions
5.6.4. _get_lc_ctype()
5.6.5. _get_lc_collate()
5.6.6. _get_lc_monetary()
5.6.7. _get_lc_numeric()
5.6.8. _get_lc_time()
5.6.9. _get_lconv()
5.6.10. localeconv()
5.6.11. setlocale()
5.6.12. _findlocale()
5.6.13. __LC_CTYPE_DEF
5.6.14. __LC_COLLATE_DEF
5.6.15. __LC_TIME_DEF
5.6.16. __LC_NUMERIC_DEF
5.6.17. __LC_MONETARY_DEF
5.6.18. __LC_INDEX_END
5.6.19. The lconv structure
5.7. Tailoring error signaling, error handling,and program exit
5.7.1. _sys_exit()
5.7.2. errno
5.7.3. __rt_errno_addr()
5.7.4. __raise()
5.7.5. __rt_raise()
5.7.6. __default_signal_handler()
5.7.7. _ttywrch()
5.7.8. __rt_fp_status_addr()
5.8. Tailoring storage management
5.8.1. Support for malloc
5.8.2. Creating your own storage-managementsystem
5.8.3. __Heap_Descriptor
5.8.4. __Heap_Initialize()
5.8.5. __Heap_DescSize()
5.8.6. __Heap_ProvideMemory()
5.8.7. __Heap_Alloc()
5.8.8. __Heap_Free()
5.8.9. __Heap_Realloc()
5.8.10. __Heap_Stats()
5.8.11. __Heap_Valid()
5.8.12. __Heap_Full()
5.8.13. __Heap_Broken()
5.9. Tailoring the runtime memory model
5.9.1. The memory models
5.9.2. Controlling the runtime memory model
5.9.3. Writing your own memory model
5.9.4. __user_initial_stackheap()
5.9.5. __user_heap_extend()
5.9.6. __user_heap_extent()
5.9.7. __user_stack_slop()
5.9.8. __rt_stackheap_init()
5.9.9. __rt_stack_overflow()
5.9.10. __rt_heap_extend()
5.9.11. __rt_stack_postlongjmp()
5.10. Tailoring the input/output functions
5.10.1. Dependencies on low-level functions
5.10.2. Target-dependent input/output supportfunctions
5.10.3. _sys_open()
5.10.4. _sys_close()
5.10.5. _sys_read()
5.10.6. _sys_write()
5.10.7. _sys_ensure()
5.10.8. _sys_flen()
5.10.9. _sys_seek()
5.10.10. _sys_istty()
5.10.11. _sys_tmpnam()
5.10.12. _sys_command_string()
5.11. Tailoring other C library functions
5.11.1. clock()
5.11.2. _clock_init()
5.11.3. time()
5.11.4. remove()
5.11.5. rename()
5.11.6. system()
5.11.7. getenv()
5.11.8. _getenv_init()
5.12. Selecting real-time division
5.13. ISO implementation definition
5.13.1. ISO C library implementation definition
5.13.2. Standard C++ library implementationdefinition
5.14. C library extensions
5.14.1. atoll()
5.14.2. strtoll()
5.14.3. strtoull()
5.14.4. snprintf()
5.14.5. vsnprintf()
5.14.6. lldiv()
5.14.7. llabs()
5.14.8. alloca()
5.14.9. _fisatty()
5.14.10. __heapstats()
5.14.11. __heapvalid()
5.15. Library naming conventions
5.15.1. Thumb C libraries
6. Floating-point Support
6.1. About floating-point support
6.2. The software floating-point library,fplib
6.2.1. Arithmetic on numbersin a particular format
6.2.2. Conversions between floats, doubles,and ints
6.2.3. Conversions between long longs andother number formats
6.2.4. Floating-point comparisons
6.3. Controlling the floating-point environment
6.3.1. The __ieee_status function
6.3.2. The __fp_status function
6.3.3. Microsoft compatibility functions
6.3.4. C9X-compatible functions
6.3.5. ARM extensions to the C9X interface
6.4. The math library, mathlib
6.4.1. Inverse hyperbolicfunctions (acosh, asinh, atanh)
6.4.2. Cube root (cbrt)
6.4.3. Copy sign (copysign)
6.4.4. Error functions (erf, erfc)
6.4.5. One less than exp(x )(expm1)
6.4.6. Determine if a number is finite (finite)
6.4.7. Gamma function (gamma, gamma_r)
6.4.8. Hypotenuse function (hypot)
6.4.9. Return the exponentof a number (ilogb)
6.4.10. Determine if a number is a NaN (isnan)
6.4.11. Bessel functions of the first kind(j0, j1, jn)
6.4.12. The logarithm of the gamma function(lgamma, lgamma_r)
6.4.13. Logarithm of one morethan x (log1p)
6.4.14. Return the exponent of a number (logb)
6.4.15. Return the next representable number(nextafter)
6.4.16. IEEE 754 remainder function (remainder)
6.4.17. IEEE round-to-integer operation (rint)
6.4.18. Scale a number by apower of two (scalb, scalbn)
6.4.19. Return the fraction part of a number(significand)
6.4.20. Bessel functions of the second kind(y0, y1, yn)
6.5. IEEE 754 arithmetic
6.5.1. Basic data types
6.5.2. Arithmetic and rounding
6.5.3. Exceptions
7. Semihosting
7.1. Semihosting
7.1.1. The SWI interface
7.2. Semihosting implementation
7.2.1. RVI-ME
7.3. Semihosting SWIs
7.3.1. SYS_OPEN (0x01)
7.3.2. SYS_CLOSE (0x02)
7.3.3. SYS_WRITEC (0x03)
7.3.4. SYS_WRITE0 (0x04)
7.3.5. SYS_WRITE (0x05)
7.3.6. SYS_READ (0x06)
7.3.7. SYS_READC (0x07)
7.3.8. SYS_ISERROR (0x08)
7.3.9. SYS_ISTTY (0x09)
7.3.10. SYS_SEEK (0x0A)
7.3.11. SYS_FLEN (0x0C)
7.3.12. SYS_TMPNAM (0x0D)
7.3.13. SYS_REMOVE (0x0E)
7.3.14. SYS_RENAME (0x0F)
7.3.15. SYS_CLOCK (0x10)
7.3.16. SYS_TIME (0x11)
7.3.17. SYS_SYSTEM (0x12)
7.3.18. SYS_ERRNO (0x13)
7.3.19. SYS_GET_CMDLINE (0x15)
7.3.20. SYS_HEAPINFO (0x16)
7.3.21. SYS_ELAPSED (0x30)
7.3.22. SYS_TICKFREQ (0x31)
7.4. Debug agent interaction SWIs
7.4.1. angel_SWIreason_EnterSVC (0x17)
7.4.2. angel_SWIreason_ReportException (0x18)
A. Via File Syntax
A.1. Overview of via files
A.1.1. Via file evaluation
A.2. Syntax
B. Standard C Implementation Definition
B.1. Implementation definition
B.1.1. Translation
B.1.2. Environment
B.1.3. Identifiers
B.1.4. Characters
B.1.5. Integers
B.1.6. Floating-point
B.1.7. Arrays and pointers
B.1.8. Registers
B.1.9. Structures, unions, enumerations,and bitfields
B.1.10. Qualifiers
B.1.11. Declarators
B.1.12. Statements
B.1.13. Preprocessing directives
B.1.14. Library functions
C. Standard C++ Implementation Definition
C.1. Integral conversion
C.2. Calling a pure virtual function
C.3. Major features of language support
C.4. Standard C++ library implementationdefinition
D. C and C++ Compiler Implementation Limits
D.1. C++ ISO/IEC standard limits
D.2. Internal limits
D.3. Limits for integral numbers
D.4. Limits for floating-point numbers
E. Older Compiler Options
E.1. Using the older compiler options
E.2. Command Syntax Supported with --old_cfe
E.2.1. Setting the source language
E.2.2. Specifying output format
E.2.3. Warning message options
E.2.4. Specifying additional checks
E.2.5. Error message options
E.3. Mapping old compiler options to thenew options
E.3.1. Mapping of compiler options
E.3.2. Mapping of compiler messages
Glossary

List of Tables

2.1. Start-up configuration based on old tool names
2.2. Start-up configuration as adjusted by filename extension
2.3. Start-up configuration as adjusted by overriding options
2.4. Example configuration
2.5. Include file search paths
2.6. Severity of diagnostic messages
3.1. Pragmas recognized by the ARM compiler
3.2. Character escape codes
3.3. Size and alignment of data types
3.4. Predefined macros 
4.1. Differences between inline and embedded assembler
5.1. Library functions that use static data
5.2. Direct dependencies
5.3. Indirect dependencies
5.4. Published API definitions
5.5. Callouts
5.6. Default ISO8859-1 locales
5.7. Default Shift-JIS and UTF-8 locales
5.8. Locale categories
5.9. locale macros
5.10. Trap and error handling
5.11. Heap functions
5.12. Memory model initialization
5.13. Memory model functions
5.14. Input/output dependencies
5.15. I/O support functions
5.16. ISO C library functions
5.17. Mathematical functions
5.18. Signal function signals
5.19. perror() messages
5.20. C++ requirements on the C library
5.21. Standard C++ library differences
5.22. Extensions
6.1. Arithmetic routines
6.2. Number format conversion routines
6.3. Conversion routines involving long long format
6.4. Floating-point comparison routines
6.5. Rounding mode control
6.6. Status word bit modification
6.7. _controlfp argument macros
6.8. FE_EX_INTYPE_MASK operand type flags
6.9. FE_EX_OUTTYPE_MASK operand type flags
6.10. FE_EX_FN_MASK operation type flags
6.11. FE_EX_CMPRET_MASK comparison type flags
6.12. Sample single-precision floating-point values
6.13. Sample double-precision floating-point values
7.1. Semihosting SWIs
7.2. Value of mode
7.3. Hardware vector reason codes
7.4. Software reason codes
C.1. Major feature support for language
D.1. Implementation limits
D.2. Internal limits
D.3. Integer ranges
D.4. Floating-point limits
D.5. Other floating-point characteristics
E.1. Mapping of compiler options
E.2. Mapping of compiler messages

Proprietary Notice

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

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

The product described in this document is subject to continuousdevelopments and improvements. All particulars of the product andits use contained in this document are given by ARM in good faith.However, all warranties implied or expressed, including but notlimited to implied warranties of merchantability, or fitness forpurpose, are excluded.

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

ConfidentialityStatus

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

Product Status

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

Revision History
Revision A May 2003 Release for RVDK v1.0
Revision B March2004 Release for RVDK v1.0.1
Copyright © 2003, 2004 ARM Limited. All rights reserved. ARM DUI 0232B
Non-Confidential