5.18.1 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 through stdout and stderr

Semihosting output is implemented as an event source, IRIS_SEMIHOSTING_OUTPUT. 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 through stdin

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:

  1. The simulated application tells the semihosting interface that it wants to receive user input.
  2. The simulated application waits for semihosting input, either because the read call is blocked or because it actively waits.
  3. The user enters data.
  4. The user tells the user interface that data entry is complete.
  5. The client provides the data to the simulated application.
  6. The simulated application tells the semihosting interface that it is no longer waiting for semihosting input.

Target instances that do not support any semihosting input must not expose the IRIS_SEMIHOSTING_INPUT_* event sources. The implementation of semihosting_provideInputData() must return E_function_not_supported_by_instance.

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.

Non-ConfidentialPDF file icon PDF version101196_0100_03_en
Copyright © 2018, 2019 Arm Limited or its affiliates. All rights reserved.