Keil™, An ARM® Company

RealView Libraries and Floating Point Support Guide

On-Line Manuals

RealView Libraries and Floating Point Support Guide

Preface
Introduction
The C and C++ Libraries
About the C and C++ libraries
Features of the C and C++ libraries
Namespaces
Writing reentrant and thread‑safe code
Introduction to reentrancy and thread‑safety
Use of static data in the C libraries
The __user_libspace static data area
Managing locks in multithreaded applications
Using the ARM C libraries with a multithreaded app
Thread‑safety in the ARM C libraries
Thread‑safety in the ARM C++ libraries
Building an application with the C library
Using the libraries with an application
Building an application for a semihosted environme
Building an application for a non semihosting envi
Building an application without the C library
Integer and FP helper functions
Bare machine integer C
Bare machine C with floating‑point
Exploiting the C library
The standalone C library functions
Tailoring the C library to a new execution environ
How C and C++ programs use the library functions
__rt_entry
Exiting from the program
__rt_exit()
__rt_lib_init()
__rt_lib_shutdown()
Tailoring static data access
Tailoring locale and CTYPE using assembler macros
Selecting locale at link time
Selecting locale at runtime
Defining a locale block
LC_CTYPE data block
LC_COLLATE data block
LC_MONETARY data block
LC_NUMERIC data block
LC_TIME data block
_get_lconv()
localeconv()
setlocale()
_findlocale()
The lconv structure
Tailoring locale and CTYPE using C macros
Selecting locale at link time
Selecting locale at runtime
Macros and utility functions
_get_lc_ctype()
_get_lc_collate()
_get_lc_monetary()
_get_lc_numeric()
_get_lc_time()
_get_lconv()
localeconv()
setlocale()
_findlocale()
__LC_CTYPE_DEF
__LC_COLLATE_DEF
__LC_TIME_DEF
__LC_NUMERIC_DEF
__LC_MONETARY_DEF
__LC_INDEX_END
The lconv structure
Tailoring error signaling, error handling, and pro
_sys_exit()
errno
__rt_errno_addr()
__raise()
__rt_raise()
__default_signal_handler()
_ttywrch()
__rt_fp_status_addr()
Tailoring storage management
Avoiding the ARM‑supplied heap and heap‑using
Support for malloc
Tailoring the runtime memory model
The memory models
Controlling the runtime memory model
Writing your own memory model
__user_initial_stackheap()
__user_setup_stackheap()
__user_heap_extend()
__user_heap_extent()
__user_stack_cleanup_space()
__rt_heap_extend()
__rt_stack_postlongjmp()
Tailoring the input/output functions
Dependencies on low‑level functions
Target‑dependent input/output support functions
_sys_open()
_sys_close()
_sys_read()
_sys_write()
_sys_ensure()
_sys_flen()
_sys_seek()
_sys_istty()
_sys_tmpnam()
_sys_command_string()
#pragma import(_main_redirection)
Tailoring other C library functions
clock()
_clock_init()
time()
remove()
rename()
system()
getenv()
_getenv_init()
Selecting real‑time division
ISO implementation definition
ISO C library implementation definition
Standard C++ library implementation definition
C library extensions
atoll()
strtoll()
strtoull()
printf()
snprintf()
vsnprintf()
lldiv()
llabs()
wcstombs()
alloca()
strlcpy()
strlcat()
_fisatty()
__heapstats()
__heapvalid()
Library naming conventions
Placing ARM libraries
Helper libraries
Identifying library variants
The C Micro-library
Floating‑point Support

The C and C++ Libraries

Chapter 2. The C and C++ Libraries

Table of Contents

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 FP helper 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 locale and CTYPE using C macros
2.8.1. Selecting locale at link time
2.8.2. Selecting locale at runtime
2.8.3. Macros and utility functions
2.8.4. _get_lc_ctype()
2.8.5. _get_lc_collate()
2.8.6. _get_lc_monetary()
2.8.7. _get_lc_numeric()
2.8.8. _get_lc_time()
2.8.9. _get_lconv()
2.8.10. localeconv()
2.8.11. setlocale()
2.8.12. _findlocale()
2.8.13. __LC_CTYPE_DEF
2.8.14. __LC_COLLATE_DEF
2.8.15. __LC_TIME_DEF
2.8.16. __LC_NUMERIC_DEF
2.8.17. __LC_MONETARY_DEF
2.8.18. __LC_INDEX_END
2.8.19. The lconv structure
2.9. Tailoring error signaling, error handling, and program exit
2.9.1. _sys_exit()
2.9.2. errno
2.9.3. __rt_errno_addr()
2.9.4. __raise()
2.9.5. __rt_raise()
2.9.6. __default_signal_handler()
2.9.7. _ttywrch()
2.9.8. __rt_fp_status_addr()
2.10. Tailoring storage management
2.10.1. Avoiding the ARM‑supplied heap and heap‑using functions
2.10.2. Support for malloc
2.11. Tailoring the runtime memory model
2.11.1. The memory models
2.11.2. Controlling the runtime memory model
2.11.3. Writing your own memory model
2.11.4. __user_initial_stackheap()
2.11.5. __user_setup_stackheap()
2.11.6. __user_heap_extend()
2.11.7. __user_heap_extent()
2.11.8. __user_stack_cleanup_space()
2.11.9. __rt_heap_extend()
2.11.10. __rt_stack_postlongjmp()
2.12. Tailoring the input/output functions
2.12.1. Dependencies on low‑level functions
2.12.2. Target‑dependent input/output support functions
2.12.3. _sys_open()
2.12.4. _sys_close()
2.12.5. _sys_read()
2.12.6. _sys_write()
2.12.7. _sys_ensure()
2.12.8. _sys_flen()
2.12.9. _sys_seek()
2.12.10. _sys_istty()
2.12.11. _sys_tmpnam()
2.12.12. _sys_command_string()
2.12.13. #pragma import(_main_redirection)
2.13. Tailoring other C library functions
2.13.1. clock()
2.13.2. _clock_init()
2.13.3. time()
2.13.4. remove()
2.13.5. rename()
2.13.6. system()
2.13.7. getenv()
2.13.8. _getenv_init()
2.14. Selecting real‑time division
2.15. ISO implementation definition
2.15.1. ISO C library implementation definition
2.15.2. Standard C++ library implementation definition
2.16. C library extensions
2.16.1. atoll()
2.16.2. strtoll()
2.16.3. strtoull()
2.16.4. printf()
2.16.5. snprintf()
2.16.6. vsnprintf()
2.16.7. lldiv()
2.16.8. llabs()
2.16.9. wcstombs()
2.16.10. alloca()
2.16.11. strlcpy()
2.16.12. strlcat()
2.16.13. _fisatty()
2.16.14. __heapstats()
2.16.15. __heapvalid()
2.17. Library naming conventions
2.17.1. Placing ARM libraries
2.17.2. Helper libraries
2.17.3. Identifying library variants

This chapter describes the C and C++ libraries. The libraries support programs written in C or C++. This chapter contains the following sections:

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0378A