Skip to main content
  • 产品
  • Software evaluation
  • 下载
  • Free utilities
  • 购买
  • 芯片厂商
  • 支持
  • 关于我们
  • Search
  • 工作机会
  • 新闻简报
  • 联系我们
  • Embedded Studio
  • SEGGER Semihosting

    SEGGER Semihosting

    • Standard for most common debug operations
    • Target-indepentend handling
    • Publicly available source package
    • Improved terminal output with host-based formatting
    Buy now Downloads Documentation
    SEGGER Embedded Studio
    1. 1.Overview
    2. 2.Operations
      1. 2.1.Terminal I/O
      2. 2.2.File handling
      3. 2.3.System information
    3. 3.Host-based formatting
    4. 4.Tools support

    Overview

    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.


    Operations

    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 Knowledge Base.

    Terminal I/O

    Terminal I/O provides operations for sending debug output to a terminal on the host system and receiving input from that terminal.

    These operations can be called directly or integrated as low-level functions for use with standard library functions such as printf(), puts(), gets(), and getc().

    The terminal I/O functionality of the SEGGER Semihosting standard also supports host-based formatting.

    File handling

    Semihosting file functions can be used to create and open files on the host system, read from and write to files, modify file contents, and retrieve file information.

    These functions can be called directly or integrated as low-level functions for use with standard library file I/O routines.

    System information

    System information functions provide information about the host or target system. For example, timing functions can be used on target systems that do not run an operating system or provide their own system timer.

    These functions can also be used to simulate command-line parameters that are passed to the target application by the debugger.


    Host-based formatting

    Host-based formatting can save several kilobytes of flash memory in debug builds that use 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 can significantly increase code size and RAM usage. To reduce this overhead, tool chains often provide different formatter variants with varying feature sets that can be selected on a per-project basis. Developers therefore need to know which printf() features are required and 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 SEGGER_SEMIHOST_Writef() without performing any formatting on the target. The debugger intercepts the semihosting operation, reads and parses the format string, converts the supplied parameters accordingly, and prints the resulting output 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.

    SEGGER - Embedded Studio Product Icon

    Embedded Studio

    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 product icon SEGGER (Blue)

    Ozone

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

    Applications can be built with any tool chain, including Arm/Keil, IAR, GCC, or Eclipse-based environments. They simply need to invoke the semihosting functions, either through the tool chain's runtime library or, more conveniently, by calling the SEGGER_SEMIHOST_*() functions provided in the reference pack.

    Ozone automatically detects and handles semihosting requests implemented via software breakpoints, supervisor calls, or the generic SEGGER_SEMIHOST_DebugHalt() function. No configuration is required.

    J-Run SEGGER (Blue) 4

    J-Run

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

    • User manual
    • Online documentation
    • Release notes

    全球总部

    德国: SEGGER Microcontroller GmbH

    地址: Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    电邮: info@segger.com
    电话: +49-2173-99312-0
    传真: +49-2173-99312-28

    网点分布

    中国:哲戈微系统科技(上海)有限公司

    地址: 中国上海市闵行区秀涟路133号
    大虹桥国际A 栋218室
    邮编201199
    电邮: china@segger.com
    电话: +86-133-619-907-60


    简易信息聚合
    ISO 9001
    ISO 27001
    First-class embedded software tools since 1992
    Designed and made in Germany
    • 版本说明
    • 免责声明
    • 行为准则
    • 隐私策略
    • 沪ICP备2022005181号
    • 沪公网安备 31011202014525号
    © 2026 SEGGER - 版权所有.

    您即将离开 segger.cn 而访问境外网站,是否继续?