RealView® Compilation Tools Libraries and Floating Point Support Guide

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 runtime libraries
1.1.1. ABI for the ARM Architecture compliance
1.1.2. Library directory structure
1.1.3. Build options and library variants
1.1.4. Using the VFP support libraries
1.1.5. Thumb C libraries
1.2. About floating‑point support
2. The C and C++ Libraries
2.1. About the C and C++ libraries
2.1.1. Features of the C and C++ libraries
2.1.2. Namespaces
2.2. Writing reentrant and thread‑safe code
2.2.1. Introduction to reentrancy and thread‑safety
2.2.2. Use of static data in the C libraries
2.2.3. The __user_libspace static data area
2.2.4. Managing locks in multithreaded applications
2.2.5. Using the ARM C libraries with a multithreaded application
2.2.6. Thread‑safety in the ARM C libraries
2.2.7. Thread‑safety in the ARM C++ libraries
2.3. Building an application with the C library
2.3.1. Using the libraries with an application
2.3.2. Building an application for a semihosted environment
2.3.3. Building an application for a non semihosting environment
2.4. Building an application without the C library
2.4.1. Integer and floating point functions
2.4.2. Bare machine integer C
2.4.3. Bare machine C with floating‑point
2.4.4. Exploiting the C library
2.4.5. The standalone C library functions
2.5. Tailoring the C library to a new execution environment
2.5.1. How C and C++ programs use the library functions
2.5.2. __rt_entry
2.5.3. Exiting from the program
2.5.4. __rt_exit()
2.5.5. __rt_lib_init()
2.5.6. __rt_lib_shutdown()
2.6. Tailoring static data access
2.7. Tailoring locale and CTYPE using assembler macros
2.7.1. Selecting locale at link time
2.7.2. Selecting locale at runtime
2.7.3. Defining a locale block
2.7.4. LC_CTYPE data block
2.7.5. LC_COLLATE data block
2.7.6. LC_MONETARY data block
2.7.7. LC_NUMERIC data block
2.7.8. LC_TIME data block
2.7.9. _get_lconv()
2.7.10. localeconv()
2.7.11. setlocale()
2.7.12. _findlocale()
2.7.13. The lconv structure
2.8. Tailoring error signaling, error handling, and program exit
2.8.1. _sys_exit()
2.8.2. errno
2.8.3. __rt_errno_addr()
2.8.4. __raise()
2.8.5. __rt_raise()
2.8.6. __default_signal_handler()
2.8.7. _ttywrch()
2.8.8. __rt_fp_status_addr()
2.9. Tailoring storage management
2.9.1. Avoiding the ARM‑supplied heap and heap‑using functions
2.9.2. Support for malloc
2.10. Tailoring the runtime memory model
2.10.1. The memory models
2.10.2. Controlling the runtime memory model
2.10.3. Writing your own memory model
2.10.4. __user_setup_stackheap()
2.10.5. __user_initial_stackheap()
2.10.6. __user_heap_extend()
2.10.7. __user_heap_extent()
2.10.8. __rt_stackheap_init()
2.10.9. __rt_heap_extend()
2.10.10. __vectab_stack_and_reset
2.11. Tailoring the input/output functions
2.11.1. Dependencies on low‑level functions
2.11.2. Target‑dependent input and output support functions
2.11.3. _sys_open()
2.11.4. _sys_close()
2.11.5. _sys_read()
2.11.6. _sys_write()
2.11.7. _sys_ensure()
2.11.8. _sys_flen()
2.11.9. _sys_seek()
2.11.10. _sys_istty()
2.11.11. _sys_tmpnam()
2.11.12. _sys_command_string()
2.11.13. #pragma import(_main_redirection)
2.12. Tailoring other C library functions
2.12.1. clock()
2.12.2. _clock_init()
2.12.3. time()
2.12.4. remove()
2.12.5. rename()
2.12.6. system()
2.12.7. getenv()
2.12.8. _getenv_init()
2.13. Selecting real‑time division
2.14. ISO implementation definition
2.14.1. ISO C library implementation definition
2.14.2. Standard C++ library implementation definition
2.15. C library extensions
2.15.1. atoll()
2.15.2. strtoll()
2.15.3. strtoull()
2.15.4. printf()
2.15.5. snprintf()
2.15.6. vsnprintf()
2.15.7. lldiv()
2.15.8. llabs()
2.15.9. wcscasecmp()
2.15.10. wcsncasecmp()
2.15.11. wcstombs()
2.15.12. alloca()
2.15.13. strlcpy()
2.15.14. strlcat()
2.15.15. strcasecmp()
2.15.16. strncasecmp()
2.15.17. _fisatty()
2.15.18. __heapstats()
2.15.19. __heapvalid()
2.15.20. _membitcpybl(), _membitcpybb(), _membitcpyhl(), _membitcpyhb(), _membitcpywl(), _membitcpywb(), _membitmovebl(), _membitmovebb(), _membitmovehl(), _membitmovehb(), _membitmovewl(), _membitmovewb()
2.16. Library naming conventions
2.16.1. Placing ARM libraries
2.16.2. Helper functions
2.16.3. Identifying library variants
3. The C Micro-library
3.1. About microlib
3.1.1. Differences from the default C library
3.2. Building an application with microlib
3.3. Using microlib
3.3.1. Creating the stack
3.3.2. Creating the heap
3.3.3. Entering and exiting your program
3.4. Tailoring the microlib input/output functions
3.5. ISO C features missing from microlib
4. Floating‑point Support
4.1. The software floating‑point library, fplib
4.1.1. Features of the floating‑point library, fplib
4.1.2. Arithmetic on numbers in a particular format
4.1.3. Conversions between floats, doubles, and ints
4.1.4. Conversions between long longs and other number formats
4.1.5. Floating‑point comparisons
4.1.6. C99 functions
4.2. Controlling the floating‑point environment
4.2.1. __ieee_status()
4.2.2. __fp_status()
4.2.3. Microsoft compatibility functions
4.2.4. C99-compatible functions
4.2.5. ARM compiler extensions to the C99 interface
4.3. The math library, mathlib
4.3.1. Range reduction in mathlib
4.3.2. Determine the type of a floating‑point number (fpclassify)
4.3.3. Determine if a number is finite (isfinite)
4.3.4. Determine if a number is infinite (isinf)
4.3.5. Determine if a number is a NaN (isnan)
4.3.6. Determine if a number is normal (isnormal)
4.3.7. Return the sign bit of a number (signbit)
4.3.8. Copy sign functions (copysign, copysignf)
4.3.9. Comparison macros (isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered)
4.3.10. Inverse hyperbolic functions (acosh, asinh, atanh)
4.3.11. Cube root (cbrt)
4.3.12. Error functions (erf, erfc)
4.3.13. One less than exp(x) (expm1)
4.3.14. Hypotenuse function (hypot)
4.3.15. The logarithm of the gamma function (lgamma)
4.3.16. Logarithm of one more than x (log1p)
4.3.17. IEEE 754 remainder function (remainder)
4.3.18. IEEE round‑to‑integer operation (rint)
4.3.19. Signalling NaNs (_WANT_SNAN)
4.3.20. Complex math functions (cacos, casin, catan, ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp, clog, cabs, cpow, csqrt, carg, cproj)
4.3.21. Gamma function (gamma, gamma_r)
4.3.22. Bessel functions of the first kind (j0, j1, jn)
4.3.23. Bessel functions of the second kind(y0, y1, yn)
4.3.24. Return the fraction part of a number(significand)
4.4. IEEE 754 arithmetic
4.4.1. Basic data types
4.4.2. Arithmetic and rounding
4.4.3. Exceptions

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM® in the EU and other countries, except as otherwise stated below in this proprietary notice. 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 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 AMarch 2007Release 3.1 for RealView Development Suite v3.1
Revision BSeptember 2008Release 4.0 for RealView Development Suite v4.0
Revision B23 January 2009Update 1 for RealView Development Suite v4.0
Revision C10 December 2010Update 2 for RealView Development Suite v4.0
Copyright © 2007-2010 ARM. All rights reserved.ARM DUI 0349C
Non-ConfidentialID101213