351
18.1
Introduction
Semihosting is a mechanism for ARM based target devices to provide a way to communi-
cate/interact with a host system (the PC where the debugger is running on) to allow dif-
ferent operations to be performed /automatized. Typical use-cases for semihosting are:
•
Calls to printf() in the target to be forwarded to the host system and then output in a
console/terminal on the host
•
Calls to scanf() to retrieve user input entered in a console/terminal on the host and
then being received and evaluated by the target
•
Performing file I/O operations on the host system (reading / writing files)
•
Writing a flashloader that reads the bin file to be flashed from the host system and
performs the flashing operation chunk-wise
Most standard I/O libraries for embedded applications come with semihosting implemen-
tations for printf() and scanf().
18.1.1
Advantages
•
Provides standardized commands for file I/O operations on the host, allowing relatively
complex operations with minimal logic in the target application
•
Does not need chip-specific hardware capabilities
•
Semihosting handling is natively supported by many debuggers/IDEs, for example GDB.
18.1.2
Disadvantages
•
Target CPU is halted on each semihosting command, debugger evaluates the
semihosting command and restarts the CPU. This affects real-time behavior of the
system.
J-Link / J-Trace (UM08001)
CHAPTER 18
© 2004-2017 SEGGER Microcontroller GmbH & Co. KG
Introduction
Need help?
Do you have a question about the J-Link and is the answer not in the manual?