Keil™, An ARM® Company

RealView Compiler User's Guide

What is semihosting?

A.1.1. What is semihosting?

Semihosting is a mechanism for ARM targets to communicate input/output requests from application code to a host computer running a debugger. For example, you can use this mechanism to enable functions in the C library, such as printf() and scanf(), to use the screen and keyboard of the host instead of 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 enables the host computer to provide these facilities.

Semihosting is implemented by a set of defined software instructions, for example, SVCs, that generate exceptions from program control. The application invokes the appropriate semihosting call and the debug agent then handles the exception. The debug agent provides the required communication with the host.

The semihosting interface is common across all debug agents provided by ARM Limited. Semihosted operations work when you are using RealView ARMulator® ISS (RVISS), Instruction Set System Model (ISSM), RealView ICE or RealMonitor without any requirement for porting, see Figure A.1.

In many cases, semihosting is invoked by code within library functions. The application can also invoke the semihosting operation directly. See Chapter 2 The C and C++ Libraries in the Libraries Guide for more information on support for semihosting in the ARM C library.

Figure A.1. Semihosting overview

Note

ARM processors prior to ARMv7 use the SVC instructions, formerly known as SWI instructions, to make semihosting calls. However, if you are compiling for a v6-M or v7-M processor such as Cortex-M1 or Cortex-M3, semihosting is implemented using the BKPT instruction.

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0375A