Keil Logo

ARM Compiler v5.06 for µVision ARM C and C++ Libraries and Floating-Point Support User Guide

ARM® Compiler v5.06 for µVision® ARM C and C++ Libraries and Floating-Point Support User Guide

Version 5

Table of Contents

About this book
Using this book
Typographic conventions
Other information
1 The ARM C and C++ Libraries
1.1 Mandatory linkage with the C library
1.2 C and C++ runtime libraries
1.2.1 Summary of the C and C++ runtime libraries
1.2.2 Compliance with the Application Binary Interface (ABI) for the ARM architecture
1.2.3 Increasing portability of object files to other CLIBABI implementations
1.2.4 ARM C and C++ library directory structure
1.2.5 Selection of ARM® C and C++ library variants based on build options
1.2.6 Thumb C libraries
1.3 C and C++ library features
1.4 C++ and C libraries and the std namespace
1.5 Multithreaded support in ARM C libraries
1.5.1 ARM C libraries and multithreading
1.5.2 ARM C libraries and reentrant functions
1.5.3 ARM C libraries and thread-safe functions
1.5.4 Use of static data in the C libraries
1.5.5 Use of the __user_libspace static data area by the C libraries
1.5.6 C library functions to access subsections of the __user_libspace static data area
1.5.7 Re-implementation of legacy function __user_libspace() in the C library
1.5.8 Management of locks in multithreaded applications
1.5.9 How to ensure re-implemented mutex functions are called
1.5.10 Using the ARM C library in a multithreaded environment
1.5.11 Thread safety in the ARM C library
1.5.12 Thread safety in the ARM C++ library
1.5.13 The floating-point status word in a multithreaded environment
1.6 Support for building an application with the C library
1.6.1 Using the C library with an application
1.6.2 Using the C and C++ libraries with an application in a semihosting environment
1.6.3 Using $Sub$$ to mix semihosted and nonsemihosted I/O functionality
1.6.4 Using the libraries in a nonsemihosting environment
1.6.5 C++ exceptions in a non-semihosting environment
1.6.6 Direct semihosting C library function dependencies
1.6.7 Indirect semihosting C library function dependencies
1.6.8 C library API definitions for targeting a different environment
1.7 Support for building an application without the C library
1.7.1 Building an application without the C library
1.7.2 Creating an application as bare machine C without the C library
1.7.3 Integer and floating-point compiler functions and building an application without the C library
1.7.4 Bare machine integer C
1.7.5 Bare machine C with floating-point processing
1.7.6 Customized C library startup code and access to C library functions
1.7.7 Using low-level functions when exploiting the C library
1.7.8 Using high-level functions when exploiting the C library
1.7.9 Using malloc() when exploiting the C library
1.8 Tailoring the C library to a new execution environment
1.8.1 Initialization of the execution environment and execution of the application
1.8.2 C++ initialization, construction and destruction
1.8.3 Exceptions system initialization
1.8.4 Emergency buffer memory for exceptions
1.8.5 Library functions called from main()
1.8.6 Program exit and the assert macro
1.9 Assembler macros that tailor locale functions in the C library
1.9.1 Link time selection of the locale subsystem in the C library
1.9.2 Runtime selection of the locale subsystem in the C library
1.9.3 Definition of locale data blocks in the C library
1.9.4 LC_CTYPE data block
1.9.5 LC_COLLATE data block
1.9.6 LC_MONETARY data block
1.9.7 LC_NUMERIC data block
1.9.8 LC_TIME data block
1.10 Modification of C library functions for error signaling, error handling, and program exit
1.11 Stack and heap memory allocation and the ARM C and C++ libraries
1.11.1 Library heap usage requirements of the ARM C and C++ libraries
1.11.2 Choosing a heap implementation for memory allocation functions
1.11.3 Stack pointer initialization and heap bounds
1.11.4 Legacy support for __user_initial_stackheap()
1.11.5 Avoiding the heap and heap-using library functions supplied by ARM
1.12 Tailoring input/output functions in the C and C++ libraries
1.13 Target dependencies on low-level functions in the C and C++ libraries
1.14 The C library printf family of functions
1.15 The C library scanf family of functions
1.16 Redefining low-level library functions to enable direct use of high-level library functions in the C library
1.17 The C library functions fread(), fgets() and gets()
1.18 Re-implementing __backspace() in the C library
1.19 Re-implementing __backspacewc() in the C library
1.20 Redefining target-dependent system I/O functions in the C library
1.21 Tailoring non-input/output C library functions
1.22 Real-time integer division in the ARM libraries
1.23 ISO C library implementation definition
1.23.1 How the ARM C library fulfills ISO C specification requirements
1.23.2 mathlib error handling
1.23.3 ISO-compliant implementation of signals supported by the signal() function in the C library and additional type arguments
1.23.4 ISO-compliant C library input/output characteristics
1.23.5 Standard C++ library implementation definition
1.24 C library functions and extensions
1.25 Compiler generated and library-resident helper functions
1.26 C and C++ library naming conventions
1.27 Using macro__ARM_WCHAR_NO_IO to disable FILE declaration and wide I/O function prototypes
1.28 Using library functions with execute-only memory
2 The ARM C Micro-library
2.1 About microlib
2.2 Differences between microlib and the default C library
2.3 Library heap usage requirements of microlib
2.4 ISO C features missing from microlib
2.5 Building an application with microlib
2.6 Configuring the stack and heap for use with microlib
2.7 Entering and exiting programs linked with microlib
2.8 Tailoring the microlib input/output functions
3 Floating-point Support
3.1 About floating-point support
3.2 The software floating-point library, fplib
3.2.1 Calling fplib routines
3.2.2 fplib arithmetic on numbers in a particular format
3.2.3 fplib conversions between floats, long longs, doubles, and ints
3.2.4 fplib comparisons between floats and doubles
3.2.5 fplib C99 functions
3.3 Controlling the ARM floating-point environment
3.3.1 Floating-point functions for compatibility with Microsoft products
3.3.2 C99-compatible functions for controlling the ARM floating-point environment
3.3.3 C99 rounding mode and floating-point exception macros
3.3.4 Exception flag handling
3.3.5 Functions for handling rounding modes
3.3.6 Functions for saving and restoring the whole floating-point environment
3.3.7 Functions for temporarily disabling exceptions
3.3.8 ARM floating-point compiler extensions to the C99 interface
3.3.9 Writing a custom exception trap handler
3.3.10 Example of a custom exception handler
3.3.11 Exception trap handling by signals
3.4 mathlib double and single-precision floating-point functions
3.5 IEEE 754 arithmetic
3.5.1 Basic data types for IEEE 754 arithmetic
3.5.2 Single precision data type for IEEE 754 arithmetic
3.5.3 Double precision data type for IEEE 754 arithmetic
3.5.4 Sample single precision floating-point values for IEEE 754 arithmetic
3.5.5 Sample double precision floating-point values for IEEE 754 arithmetic
3.5.6 IEEE 754 arithmetic and rounding
3.5.7 Exceptions arising from IEEE 754 floating-point arithmetic
3.5.8 Exception types recognized by the ARM floating-point environment
3.6 Using the Vector Floating-Point (VFP) support libraries
4 The C and C++ Library Functions reference
4.1 __aeabi_errno_addr()
4.2 alloca()
4.3 clock()
4.4 _clock_init()
4.5 __default_signal_handler()
4.6 errno
4.7 _findlocale()
4.8 _fisatty()
4.9 _get_lconv()
4.10 getenv()
4.11 _getenv_init()
4.12 __heapstats()
4.13 __heapvalid()
4.14 lconv structure
4.15 localeconv()
4.16 _membitcpybl(), _membitcpybb(), _membitcpyhl(), _membitcpyhb(), _membitcpywl(), _membitcpywb(), _membitmovebl(), _membitmovebb(), _membitmovehl(), _membitmovehb(), _membitmovewl(), _membitmovewb()
4.17 posix_memalign()
4.18 #pragma import(_main_redirection)
4.19 __raise()
4.20 _rand_r()
4.21 remove()
4.22 rename()
4.23 __rt_entry
4.24 __rt_errno_addr()
4.25 __rt_exit()
4.26 __rt_fp_status_addr()
4.27 __rt_heap_extend()
4.28 __rt_lib_init()
4.29 __rt_lib_shutdown()
4.30 __rt_raise()
4.31 __rt_stackheap_init()
4.32 setlocale()
4.33 _srand_r()
4.34 strcasecmp()
4.35 strncasecmp()
4.36 strlcat()
4.37 strlcpy()
4.38 _sys_close()
4.39 _sys_command_string()
4.40 _sys_ensure()
4.41 _sys_exit()
4.42 _sys_flen()
4.43 _sys_istty()
4.44 _sys_open()
4.45 _sys_read()
4.46 _sys_seek()
4.47 _sys_tmpnam()
4.48 _sys_write()
4.49 system()
4.50 time()
4.51 _ttywrch()
4.52 __user_heap_extend()
4.53 __user_heap_extent()
4.54 __user_setup_stackheap()
4.55 __vectab_stack_and_reset
4.56 wcscasecmp()
4.57 wcsncasecmp()
4.58 wcstombs()
4.59 Thread-safe C library functions
4.60 C library functions that are not thread-safe
4.61 Legacy function __user_initial_stackheap()
5 Floating-point Support Functions Reference
5.1 _clearfp()
5.2 _controlfp()
5.3 __fp_status()
5.4 gamma(), gamma_r()
5.5 __ieee_status()
5.6 j0(), j1(), jn(), Bessel functions of the first kind
5.7 significand(), fractional part of a number
5.8 _statusfp()
5.9 y0(), y1(), yn(), Bessel functions of the second kind

Release Information

Document History
Issue Date Confidentiality Change
A May 2007 Non-Confidential Release for RVCT v3.1 Release for µVision
B December 2008 Non-Confidential Release for RVCT v4.0 for µVision
C June 2011 Non-Confidential Release for ARM Compiler v4.1 for µVision
D July 2012 Non-Confidential Release for ARM Compiler v5.02 for µVision
E 30 May 2014 Non-Confidential Release for ARM Compiler v5.04 for µVision
F 12 December 2014 Non-Confidential Release for ARM Compiler v5.05 for µVision
G 15 August 2015 Non-Confidential Release for ARM Compiler v5.06 for µVision
H 17 June 2016 Non-Confidential Release for ARM Compiler v5.06 update 3 for µVision

Non-Confidential Proprietary Notice

This document is protected by copyright and other related rights and the practice or implementation of the information contained in this document may be protected by one or more patents or pending patent applications. No part of this document may be reproduced in any form by any means without the express prior written permission of ARM. No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of, third party patents, copyrights, trade secrets, or other rights.
This document may include technical inaccuracies or typographical errors.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to ARM’s customers is not intended to create or refer to any partnership relationship with any other company. ARM may make changes to this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement covering this document with ARM, then the signed written agreement prevails over and supersedes the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that if there is any conflict between the English version of this document and any translation, the terms of the English version of the Agreement shall prevail.
Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM Limited or its affiliates in the EU and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of their respective owners. Please follow ARM’s trademark usage guidelines at
Copyright © 2007, 2008, 2011, 2012, 2014-2016, ARM Limited or its affiliates. All rights reserved.
ARM Limited. Company 02557590 registered in England.
110 Fulbourn Road, Cambridge, England CB1 9NJ.

Additional Notices

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.

Web Address

Non-ConfidentialPDF file icon PDF versionARM DUI0378H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  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.