Datasheet
The C and C++ Libraries
4-8 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
Implementing your own semihosting SWI support
It is possible to implement your own semihosting SWI support. The interface is simple
and requires a handler for only two SWI numbers.
0x123456
is used in ARM state and
0xab
is used in Thumb state. See the semihosting SWI definitions in ADS Debug Target
Guide and the include file
rt_sys.h
4.2.2 Building an application for a nonsemihosted environment
If you do not want to use any semihosting functionality, you must ensure that either no
calls are made to any function that uses semihosting or that such functions are replaced
by your own non-semihosted functions.
To build an application that does not use semihosting functionality:
1. Create the source files to implement the target-dependent features.
2. Add the
__use_no_semihosting_swi
guard to the source. See Avoiding the
semihosting SWI on page 4-10.
3. Link the new objects with your application.
4. Use the new configuration when creating the target-dependent application.
You must re-implement functions that the C library uses to insulate itself from target
dependencies. For example, if you use
printf()
you must re-implement
fputc()
. If you
do not use the higher-level input/output functions like
printf()
, you do not have to
re-implement the lower-level functions like
fputc()
.
If you are building an application for a different execution environment, you can
re-implement the target dependent functions (functions that use the semihosting SWI or
that depend on the target memory map). There are no target-dependent functions in the
C++ library.
The functions that you might have to re-implement are described in:
• Tailoring static data access on page 4-25
• Tailoring locale and CTYPE on page 4-26
• Tailoring error signaling, error handling, and program exit on page 4-51
• Tailoring the runtime memory model on page 4-67
• Tailoring the input/output functions on page 4-75
• Tailoring other C library functions on page 4-85.
Examples of embedded applications that do not use a hosted environment are included
in
install_directory\Examples\embedded\embed
.
See the ADS Developer Guide for examples of creating applications for embedding into
ROM.