Difference between revisions of "Semihosting"

From SEGGER Wiki
Jump to: navigation, search
Line 1: Line 1:
 
__TOC__
 
__TOC__
   
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. The biggest drawback is that the target device needs to be halted for each interaction between host and target device which will impact the real-time behaviour of a system.
+
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. The biggest drawback is that the target device needs to be halted for each interaction between host and target device which will impact the real-time behaviour of a system. Additional information about semihosting can be found in the J-Link user manual (UM08001).
   
 
==Semihosting with Ozone==
 
==Semihosting with Ozone==

Revision as of 11:15, 9 April 2019

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. The biggest drawback is that the target device needs to be halted for each interaction between host and target device which will impact the real-time behaviour of a system. Additional information about semihosting can be found in the J-Link user manual (UM08001).

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 project options can be found at the following project settings:

EWARM Library setting.png

Set the library level to "Full" and the library low level implementation to semihosting each.

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