Datasheet
The C and C++ Libraries
4-6 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
4.2 Building an application with the C library
This section covers creating an application that links with functions from the C or C++
libraries. Functions in the C library are responsible for:
• Creating an environment in which a C or C++ program can execute. This includes
— creating a stack
— creating a heap, if required
— initializing the parts of the library the program uses.
• Starting execution by calling
main()
.
• Supporting use of ISO-defined functions by the program.
• Catching runtime errors and signals and, if required, terminating execution on
error or program exit.
There are three major ways to use the libraries with an application:
• Build a semihosted application that can be debugged in a semihosted environment
such as with ARMulator, Angel, or Multi-ICE. See Building an application for a
semihosted environment.
• Build a nonhosted application that can, for example, be embedded into ROM. See
Building an application for a nonsemihosted environment on page 4-8.
• Build an application that does not use
main()
and does not initialize the library.
This application will have, unless you re-implement some functions, restricted
library functionality. See Building an application without the C library on
page 4-13.
4.2.1 Building an application for a semihosted environment
If you are developing an application to run in a semihosted environment for debugging,
you must have an execution environment that supports the ARM (and typically also
Thumb) semihosting SWIs, and has sufficient memory.
The execution environment can be provided by either:
• using the standard semihosting functionality that is present by default in, for
example, ARMulator, Angel, and Multi-ICE
• implementing your own SWI handler for the semihosting SWI (see ADS Debug
Targe t Gu id e).
A list of functions that require semihosting is given in Overview of semihosting
dependencies on page 4-9.
You are not required to write any new functions or include files if you are using the
default semihosting functionality of the library.