Semihosting
In this topic:
Semihosting allows an embedded application running on the target to use resources from the development host (PC).
In winIDEA, semihosting enables:
•Access to the host file system
•Redirection of standard I/O functions (e.g., printf) to the winIDEA Terminal window
The TASKING File System Simulation semihosting interface is supported.
|
For compiler-level support and library details, refer to your compiler documentation. This article describes winIDEA configuration and behavior. |
Configure semihosting in: Debug | Configure Session… | Applications | Add.
Select the interface that matches how the application was built (compiler/runtime dependent):
•Type – Select the semihosting interface (e.g., TASKING File System Simulation).
•Root dir – Directory used as the root for file I/O.
Default: workspace directory.
•Custom root dir – Optional override of the root directory.
Start debugging after configuration.
A semihosting operation is highly intrusive; when an operation is requested, the following sequence of events occurs:
1.A core stops at a breakpoint.
2.winIDEA detects that the core is stopped and verifies that this is a semihosting-type stop.
3.Parameters of the operation are read through the debug interface and interpreted by winIDEA.
4.The requested operation is executed.
5.Results of the operation are written back through the debug interface.
6.The core is in run.
The timing of these actions is unpredictable to a certain degree, and thus, semihosting should not be used in a system in which real-time accuracy is required.
The set of available operations depends on:
•The selected semihosting interface
•Compiler/runtime library support
After executing the code below, this text This is the text that will be printed to the Terminal window will be printed in the Terminal:
#include "stdio.h"
#include "io.h"
printf( "This is the text that will be printed to the Terminal window.\n" );
After executing this code, the data buffer will be stored in the file named __fibo.bin.
#include "stdio.h"
#include "fcntl.h"
#include "io.h"
#define DATACOUNT 8
static uint8_t s_abyBuffer[DATACOUNT] = {0, 1, 1, 2, 3, 5, 8, 13};
FILE *fp;
fp = fopen( "__fibo.bin", "wb" );
if(fp == NULL )
{
// ToDo: React on error
}
fwrite(s_abyBuffer, sizeof(s_abyBuffer), 1, fp);