Skip navigation

SEGGER Semihosting

  • Standard for most common debug operations
  • Target-indepentend handling
  • Publicly available source package
  • Improved terminal output with host-based formatting



Semihosting is a mechanism that enables code running on an Embedded System to communicate with and to use the I/O of the host computer through the debugger. For semihosting the target program halts and the debugger does the desired semihosting operation.

To unify the handling across tools and target architectures, SEGGER has made a generic, portable implementation publicly available: SEGGER Semihosting.


SEGGER Semihosting supports debug operations mainly for terminal I/O, but additionally includes file and system operations. For a list of supported operations refer to SEGGER Semihosting on the SEGGER Wiki.

Terminal I/O

Terminal I/O includes operations to output debug messages to a terminal on the host and to receive input from the terminal.

These operations can be called directly or added as low-level calls to be used by printf, puts, gets, getc, ...

The terminal I/O operations of the SEGGER Semihosting standard include host-based formatting.

File Handling

Semihosting file functions can be used to open and create files on the host system, to read, modify, or write files, and to get information about files.

File functions can be called directly or integrated as low-level functions to be called by standard library functions.

System Information

System information functions can provide information about the host or target system. Timing functions can for example be used on target systems that do not use an OS or their own system timer.

System functions can also be used to simulate command line parameters to be passed to the target application by the debugger.

Host-Based Formatting

Host-based formatting can save kilobytes of flash in a debug build with printf output.

Most tool chains and standard libraries let the embedded target do the work of formatting strings in their printf() implementation. They include extra formatter code to parse the format string and to accordingly convert the parameters to strings.

Formatting strings on the target may heavily increase the program size and RAM requirements. To counter this, there may be different versions of the formatters which include more or less capabilities, that can be selected in a project. The developer has to know which printf formatters are going to be used and needs to configure the project accordingly.

SEGGER Semihosting completely eliminates the overhead of formatters while providing full capabilities by using host-based formatting.

Host-based formatting shifts the burden of formatting from the target system, where resources are limited, to the host system, where resources are plentiful. The host system supports all formatting specifications (such as width, precision, text alignment, floating point, and so on) simply because it has ample resources to do so.

To use host-based formatting, the target application retargets printf() to directly call SEGER_SEMIHOST_Writef() without doing anything with the format string. The debugger catches the semihosting operating, reads and parses the format string, convers and inserts the read parameters accordingly, and prints the string to the debug terminal.

Tools Support

SEGGER has adopted the semihosting standard in all SEGGER debug tools to ease the access to target's debug output.

Embedded Studio

SEGGER - Embedded Studio PRO Product Icon

Embedded Studio fully supports the SEGGER Semihosting standard, including terminal I/O, file I/O, system operations, and host-based formatting. It also easily creates programs that use semihosting.

Using Embedded Studio is one of the easiest ways to create and run programs using semihosting.



Ozone fully supports operations that comply with the ARM or SEGGER semihosting standard.

An application can be built with any tool chain, such as ARM/Keil, IAR, GCC / Eclipse. It simply needs to call the semihosting functions, either as included in the tool chain's runtime library, or more easily by calling the SEGGER_SEMIHOST_*() functions from the reference pack.

Ozone automatically detects and handles semihosting via software breakpoint, supervisor call, or the generic SEGGER_SEMIHOST_DebugHalt(). No configuration is required.



The automated test tool, J-Run detects the use of semihosting in a target application and supports the terminal I/O semihosting operations.