Datasheet
The C and C++ Libraries
4-20 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
4.4 Tailoring the C library to a new execution environment
This section describes how to re-implement functions to produce an application for a
different execution environment, for example embedded in ROM or used with an RTOS.
Symbols that have a single or double underscore, _ or __, name functions that are used
as part of the low-level implementation. You can re-implement some of these functions.
Additional information on these library functions is available in the
rt_heap.h
,
rt_locale.h
,
rt_misc.h
, and
rt_sys.h
include files and the
rt_memory.s
assembler file.
4.4.1 How C and C++ programs use the library functions
This section describes specific library functions that are used to initialize the execution
environment and application, library exit functions, and target-dependent library
functions that the application itself might call during its execution.
Initializing the execution environment and executing the application
The entry point of a program is at
__main
in the C library where library code does the
following:
1. Copies nonroot (RO and RW) execution regions from their load addresses to their
execution addresses.
2. Zeroes ZI regions.
3. Branches to
__rt_entry
.
If you do not want the library to do this, you can define your own
__main
that branches
to
__rt_entry
as in Example 4-1.
Example 4-1 __main and __rt_entry
IMPORT __rt_entry
EXPORT __main
ENTRY
__main
B __rt_entry
END
The library function
__rt_entry()
runs the program as follows:
1. Calls
__rt_stackheap_init()
to set up the stack and heap.