|Home > Iris APIs > Semihosting > Basic stdin, stdout, and stderr support|
Clients can capture semihosting output through the stdout and stderr file descriptors, and semihosting applications can read input from stdin.
Semihosting output is provided as an event source,
IRIS_SEMIHOSTING_OUTPUT, which is defined for components that support semihosting output on this abstraction level. To receive semihosting output, clients must activate this event source using
eventStream_create(). Multiple clients can request semihosting output at the same time. All of them receive the same semihosting output.
If no client requests semihosting output, the global instance must either print all semihosting output to the simulation process's host stdout file descriptor, or make it visible through another mechanism. If a client has requested semihosting output, the global instance must not print semihosting output to stdout.
Target instances that do not support any semihosting output must not expose an
IRIS_SEMIHOSTING_OUTPUT event source.
Semihosting input is more complex than output because it requires more cooperation between the user, the client, and the simulated application. The process of receiving semihosting input generally involves the following steps:
Target instances that do not support any semihosting input must not
IRIS_SEMIHOSTING_INPUT_* event sources.
Their implementation of
semihosting_provideInputData() must return
The simulation and all interfaces involved must stay responsive during semihosting input. Semihosting input must not change the simulation state. A simulator that is blocked in a semihosting input operation is still considered to be running if it was running previously. It can be stopped and resumed when in this state.