Datasheet
The C and C++ Libraries
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 4-13
4.3 Building an application without the C library
Creating an application that has a
main()
function causes the C library initialization
functions to be included.
If your application does not have a
main()
function, the C library is not initialized and
the following features are not available in your application:
• software stack checking
• low-level stdio
• signal-handling functions,
signal()
and
raise()
in
signal.h
•
atexit()
•
alloca()
.
This section refers to creating applications without the library as bare machine C. These
applications do not automatically use the full C runtime environment provided by the C
library. Even though you are creating an application without the library, some helper
functions from the library must be included. There are also many library functions that
can be made available with only minor re-implementations.
4.3.1 Integer and FP helper functions
There are several compiler helper functions that are used by the compiler to handle
operations that do not have a short machine code equivalent. For example, integer divide
uses a helper function because there is not a divide instruction in the ARM and Thumb
instruction set.
Integer divide and all the floating-point functions require
__rt_raise()
to handle math
errors. Re-implementing
__rt_raise()
enables all the math helper functions.
4.3.2 Bare machine integer C
If you are writing a program in C that is to run without any environment initialization
you must:
• Implement
__rt_raise()
yourself, because this error-handling function can be
called from numerous places within the compiled code.
• Not define
main()
to avoid linking in the library initialization code.
• Not use software stack checking in the build options.
• Write an assembly language veneer that establishes the register state needed to
run C. This veneer must branch to the entry function in your application.