Datasheet

Semihosting
ARM DUI0058D Copyright © 1999-2001 ARM Limited. All rights reserved. 5-3
The semihosting SWI interface is common across all debug agents provided by ARM.
Semihosted operations will work under ARMulator, RealMonitor, Angel, or Multi-ICE
without any requirement for porting.
For further information on semihosting and the C libraries, see the C and C++ Libraries
chapter in ADS Compilers and Libraries Guide. See also the Writing Code for ROM
chapter in ADS Developer Guide.
5.1.1 The SWI interface
The ARM and Thumb SWI instructions contain a field that encodes the SWI number
used by the application code. This number can be decoded by the SWI handler in the
system. See the chapter on exception handling in ADS Developer Guide for more
information on SWI handlers.
Semihosting operations are requested using a single SWI number. This leaves the other
SWI numbers available for use by the application or operating system. The SWI used
for semihosting is:
0x123456
in ARM state
0xAB
in Thumb state
The SWI number indicates to the debug agent that the SWI is a semihosting request. In
order to distinguish between operations, the operation type is passed in r0. All other
parameters are passed in a block that is pointed to by r1.
The result is returned in r0, either as an explicit return value or as a pointer to a data
block. Even if no result is returned, assume that r0 is corrupted.
The available semihosting operation numbers passed in r0 are allocated as follows:
0x00
to
0x31
These are used by ARM.
0x32
to
0xFF
These are reserved for future use by ARM.
0x100
to
0x1FF
These are reserved for user applications. They will not be used by
ARM.
If you are writing your own SWI operations, however, you are
advised to use a different SWI number rather than using the
semihosted SWI number and these operation type numbers.
0x200
to
0xFFFFFFFF
These are undefined. They are not currently used and not
recommended for use.
In the following sections, the number in parentheses after the operation name is the
value placed into r0. For example
SYS_OPEN
(
0x01
).