Keil™, An ARM® Company

RealView Libraries and Floating Point Support Guide

Technical Support

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 standalone C library functions

2.4.5. The standalone C library functions

The rest of this section lists the include files, and the functions they contain, that are available with an uninitialized library. Some otherwise‑unavailable functions can be used if the library functions they depend on are re‑implemented.

alloca.h

Functions listed in this file are not available without library initialization. See Building an application with the C library for instructions.

assert.h

Functions listed in this file require high‑level stdio, __rt_raise(), and _sys_exit(). See Tailoring error signaling, error handling, and program exit for instructions.

ctype.h

Functions listed in this file require the locale functions.

errno.h

Functions in this file work without the requirement for any library initialization or function re‑implementation.

fenv.h

Functions in this file work without the requirement for any library initialization and only require the re‑implementation of __rt_raise().

float.h

This file does not contain any code. The definitions in the file do not require library initialization or function re‑implementation.

inttypes.h

Functions listed in this file require the locale functions.

limits.h

Functions in this file work without the requirement for any library initialization or function re‑implementation.

locale.h

Call setlocale() before calling any function that uses locale functions. For example:

setlocale(LC_ALL, "C")

See the contents of locale.h for more information on the following functions and data structures:

  • setlocale() selects the appropriate locale as specified by the category and locale arguments

  • lconv is the structure used by locale functions for formatting numeric quantities according to the rules of the current locale.

  • localeconv() creates an lconv structure and returns a pointer to it

  • _get_lconv() fills the lconv structure pointed to by the parameter. This ISO extension removes the requirement for static data within the library.

locale.h also contains constant declarations used with locale functions. See Tailoring locale and CTYPE using assembler macros for more information.

math.h

For functions in this file to work, you must first call _fp_init() and re‑implement __rt_raise().

setjmp.h

Functions in this file work without any library initialization or function re‑implementation.

signal.h

Functions listed in this file are not available without library initialization. See Building an application with the C library for instructions on building an application that uses library initialization.

__rt_raise() can be re‑implemented for error and exit handling. See Tailoring error signaling, error handling, and program exit for instructions.

stdarg.h

Functions listed in this file work without any library initialization or function re‑implementation.

stddef.h

This file does not contain any code. The definitions in the file do not require library initialization or function re‑implementation.

stdint.h

This file does not contain any code. The definitions in the file do not require library initialization or function re‑implementation.

stdio.h

The following dependencies or limitations apply to these functions:

  • The high‑level functions such as printf(), scanf(), puts(), fgets(), fread(), fwrite(), and perror() depend on lower‑level stdio functions fgetc(), fputc(), and __backspace(). You must re‑implement these lower‑level functions when using the standalone C library.

    However, you cannot re‑implement the _sys_ prefixed functions (for example, _sys_read()) when using the standalone C library because they require library initialization.

    See Tailoring the input/output functions for more information.

  • The printf() and scanf() family of functions require locale.

  • The remove() and rename() functions are system‑specific and probably not usable in your application.

stdlib.h

Most functions in this file work without any library initialization or function re‑implementation. The following functions depend on other functions being instantiated correctly:

  • ato*() requires locale

  • strto*() requires locale

  • malloc(), calloc(), realloc(), and free() require heap functions

  • atexit() is not available when building an application without the C library.

string.h

Functions in this file work without any library initialization, with the exception of strcoll() and strxfrm(), that require locale.

time.h

  • mktime() and localtime() can be used immediately

  • time() and clock() are system‑specific and probably not usable unless re‑implemented

  • asctime(), ctime(), and strftime() require locale.

wchar.h

Wide character library functions added to ISO C by Normative Addendum 1 in 1994.

  • Support for wide‑character output and format strings, swprintf(), vswprintf(), swscanf(), and vswscanf()

  • All the conversion functions (for example, btowc, wctob, mbrtowc, and wcrtomb) require locale

  • wcscoll and wcsxfrm require locale.

wctype.h

Wide character library functions added to ISO C by Normative Addendum 1 in 1994. This requires locale.

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