Datasheet
Semihosting
ARM DUI0058D Copyright © 1999-2001 ARM Limited. All rights reserved. 5-11
5.4 Semihosting SWIs
The SWIs listed in Table 5-1 implement the semihosted operations. These operations
are used by C library functions such as
printf()
and
scanf()
. They can be treated as
ATPCS function calls. However, except for r0 that contains the return status, they
restore the registers they are called with before returning.
Some targets provide additional semihosting calls. See the ARM Firmware Suite (AFS)
documentation for details of SWIs provided by AFS.
Table 5-1 Semihosting SWIs
SWI Description
SYS_OPEN (0x01) on page 5-12 Open a file on the host
SYS_CLOSE (0x02) on page 5-14 Close a file on the host
SYS_WRITEC (0x03) on page 5-14 Write a character to the console
SYS_WRITE0 (0x04) on page 5-14 Write a null-terminated string to the console
SYS_WRITE (0x05) on page 5-15 Write to a file on the host
SYS_READ (0x06) on page 5-16 Read the contents of a file into a buffer
SYS_READC (0x07) on page 5-17 Read a byte from the console
SYS_ISERROR (0x08) on page 5-17 Determine if a return code is an error
SYS_ISTTY (0x09) on page 5-18 Check whether a file is connected to an interactive device
SYS_SEEK (0x0A) on page 5-18 Seek to a position in a file
SYS_FLEN (0x0C) on page 5-19 Return the length of a file
SYS_TMPNAM (0x0D) on page 5-19 Return a temporary name for a file
SYS_REMOVE (0x0E) on page 5-20 Remove a file from the host
SYS_RENAME (0x0F) on page 5-20 Rename a file on the host
SYS_CLOCK (0x10) on page 5-21 Number of centiseconds since execution started
SYS_TIME (0x11) on page 5-21 Number of seconds since January 1, 1970
SYS_SYSTEM (0x12) on page 5-22 Pass a command to the host command-line interpreter
SYS_ERRNO (0x13) on page 5-23 Get the value of the C library
errno
variable
SYS_GET_CMDLINE (0x15) on page 5-24 Get the command-line used to call the executable