5.1. Semihosting

Semihosting is a mechanism for ARM targets to communicate input/output requests from application code to a host computer running a debugger. This mechanism could be used, for example, to allow functions in the C library, such as printf() and scanf(), to use the screen and keyboard of the host rather than having a screen and keyboard on the target system.

This is useful because development hardware often does not have all the input and output facilities of the final system. Semihosting allows the host computer to provide these facilities.

Semihosting is implemented by a set of defined software interrupt (SWI) operations. The application invokes the appropriate SWI and the debug agent then handles the SWI exception. The debug agent provides the required communication with the host.

In many cases, the semihosting SWI will be invoked by code within library functions. The application can also invoke the semihosting SWI directly. Refer to the C library descriptions in the ADS Compilers and Libraries Guide for more information on support for semihosting in the ARM C library.

Figure 5.1 shows an overview of semihosting.

Figure 5.1. Semihosting overview

The semihosting SWI interface is common across all debug agents provided by ARM. Semihosted operations will work under ARMulator, RealMonitor, Angel, or Multi-ICE without any requirement for porting.

For further information on semihosting and the C libraries, see the C and C++ Libraries chapter in ADS Compilers and Libraries Guide. See also the Writing Code for ROM chapter in ADS Developer Guide.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI0058D
Non-Confidential