Semihosting

From SEGGER Wiki
Revision as of 09:51, 9 April 2019 by Nino (talk | contribs)
Jump to: navigation, search

Semihosting is a mechanism for ARM based target devices to provide a way to communicate with a host system to allow different operations to be performed. Such operations can be sending and receiving data from and to the host system and file I/O operations. These can also be automated and used for e.g. unit testing.

Semihosting with Ozone

Ozone supports the standard Arm implementation for semihosting. So the semihosting handling needs to be done completely in the target application.

An example implementation can be found in the following example project: Semihosting Ozone

The example project will open a file on the host system and write a string to it. Make sure the file path is existing otherwise the project will not run. You can of course change the path by simply editing variable pFilename and rebuild it with Embedded Studio.

Prerequisites for the example project are:

  • Ozone V2.62 or later
  • Embedded Studio V4.16 or later
  • Cortex-M Trace Reference Board (ST STM32F407VE)
  • J-Link V10 or later

Semihosting with Embedded Studio

The implementation of Semihosting in Embedded Studio is straight forward. Standard library functions for fopen, fwrite, fread etc. are implemented and just need to be called. It is recommended to use the project wizard when creating a new project so all default settings are set correctly.

The following example project opens a file on your host system and writes a string into it triggered by your target device: Semihosting Embedded Studio

Make sure the file path is existing otherwise the project will not run. You can of course change the path by simply editing variable pFilename and rebuild it with Embedded Studio.

Prerequisites for the example project are:

  • Embedded Studio V4.16 or later
  • Cortex-M Trace Reference Board (ST STM32F407VE)
  • J-Link V10 or later


Semihosting with GDB

Semihosting with EWARM

The implementation of Semihosting in EWARM is generally available but requires some extra steps. Standard library functions for fopen, fwrite, fread etc. are implemented and just need to be called. Under project options semihosting must be enabled as well as the library support must be set to "full" which will drastically increase memory usage of your project. The following example project opens a file on your host system and writes a string into it triggered by your target device: Semihosting EWARM

Make sure the file path is existing otherwise the project will not run. You can of course change the path by simply editing variable pFilename and rebuild it with Embedded Studio.

Prerequisites for the example project are:

  • EWARM V8.322 or later
  • Cortex-M Trace Reference Board (ST STM32F407VE)
  • J-Link V10 or later