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:

A list of functions that require semihosting is given in Overview of semihosting dependencies.

You are not required to write any new functions or include files if you are using the default semihosting functionality of the library.

Using ARMulator

The ARM instruction set simulator (ARMulator) supports the semihosting SWI and has a memory map that enables using the library. The ARMulator uses memory in the host machine and this is normally adequate for your application.

Using Angel

ARM boards running the Angel debug monitor support the semihosting SWI and have memory maps that enable using the library. Your application might, however, require more memory than is available on the development board and the memory map assumed by the library might require tailoring to match the hardware being debugged.

You can change the definition of the Angel environment. See the ARM Firmware Suite documentation for more information on the Angel environment.

Using Multi-ICE

The ARM debug agents support the semihosting SWI, but the memory map assumed by the library might require tailoring to match the hardware being debugged. However, it is easy to tailor the memory map assumed by the C library. See Tailoring the runtime memory model.

Using re-implemented functions in a semihosted environment

You can also mix the semihosting functionality with new input/output functions. For example, you can implement fputc() to output directly to hardware such as a UART, in addition to the semihosted implementation. See Building an application for a nonsemihosted environment for information on how to re-implement individual functions.

Converting a semihosted application to a standalone application

After an application has been developed in a semihosted debugging environment, you can move the application to a nonhosted environment by one of the following methods:

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

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D