Semihosting For Aarch32 and Aarch64: Release 2.0
Semihosting For Aarch32 and Aarch64: Release 2.0
Release 2.0
ARM
CONTENTS
1 Preface 3
1.1 About this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Other information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Introduction 5
4 Semihosting extensions 9
4.1 Semihosting feature bit reporting sequence format . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Requirements for semihosting implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 Requirements for semihosting callers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.4 Example pseudocode function for querying feature bits . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.5 Semihosting extensions available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 Semihosting operations 12
5.1 SYS_CLOCK (0x10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.2 SYS_CLOSE (0x02) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.3 SYS_ELAPSED (0x30) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.4 SYS_ERRNO (0x13) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.5 SYS_EXIT (0x18) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.6 SYS_EXIT_EXTENDED (0x20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.7 SYS_FLEN (0x0C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.8 SYS_GET_CMDLINE (0x15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.9 SYS_HEAPINFO (0x16) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.10 SYS_ISERROR (0x08) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.11 SYS_ISTTY (0x09) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.12 SYS_OPEN (0x01) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.13 SYS_READ (0x06) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.14 SYS_READC (0x07) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.15 SYS_REMOVE (0x0E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.16 SYS_RENAME (0x0F) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.17 SYS_SEEK (0x0A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.18 SYS_SYSTEM (0x12) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.19 SYS_TICKFREQ (0x31) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.20 SYS_TIME (0x11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.21 SYS_TMPNAM (0x0D) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.22 SYS_WRITE (0x05) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.23 SYS_WRITEC (0x03) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
i
5.24 SYS_WRITE0 (0x04) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
ii
Semihosting for AArch32 and AArch64, Release 2.0
Document History
This document is protected by copyright and other related rights and the practice or implementation of the information
contained in this document may be protected by one or more patents or pending patent applications. No part of
this document may be reproduced in any form by any means without the express prior written permission of ARM.
No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this
document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit
others to use the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WAR-
RANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS
FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes
no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of,
third party patents, copyrights, trade secrets, or other rights.
This document may include technical inaccuracies or typographical errors.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAM-
AGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE,
OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIA-
BILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or
disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or
any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in
reference to ARM’s customers is not intended to create or refer to any partnership relationship with any other company.
ARM may make changes to this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement
covering this document with ARM, then the signed written agreement prevails over and supersedes the conflicting
provisions of these terms. This document may be translated into other languages for convenience, and you agree that
if there is any conflict between the English version of this document and any translation, the terms of the English
version of the Agreement shall prevail.
Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM Limited or its affiliates in
the EU and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the
CONTENTS 1
Semihosting for AArch32 and AArch64, Release 2.0
trademarks of their respective owners. Please follow ARM’s trademark usage guidelines at http://www.arm.com/
about/trademark-usage-guidelines.php
Copyright © 2016, ARM Limited or its affiliates. All rights reserved.
ARM Limited. Company 02557590 registered in England.
110 Fulbourn Road, Cambridge, England CB1 9NJ.
LES-PRE-20349
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license
restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this
document to. Unrestricted Access is an ARM internal classification.
Product Status
Web Address
http://www.arm.com
CONTENTS 2
CHAPTER
ONE
PREFACE
This document describes the ARM® semihosting mechanism, and its extensions.
Glossary
The ARM Glossary is a list of terms used in ARM documentation, together with definitions for those terms. The
ARM Glossary does not contain terms that are industry standard unless the ARM meaning differs from the generally
accepted meaning.
See the ARM Glossary for more information.
Feedback
If you have any comments or suggestions about this product, contact your supplier and give:
• The product name.
• The product revision or version.
• An explanation with as much information as you can provide. Include symptoms and diagnostic procedures if
appropriate.
Feedback on content
3
Semihosting for AArch32 and AArch64, Release 2.0
Note: ARM tests the PDF only in Adobe Acrobat and Acrobat Reader, and cannot guarantee the quality of the
represented document when used with any other PDF reader.
Other information
• ARM Developer
• ARM Technical Support Knowledge Articles.
• Support and Maintenance.
• ARM Glossary
TWO
INTRODUCTION
Semihosting is a mechanism that enables code running on an ARM target or emulator to communicate with and use
the Input/Output facilities on a host computer. The host must be running the emulator, or a debugger that is attached
to the ARM target.
Examples of these facilities include keyboard input, screen output, and disk I/O. For example, you can use this mech-
anism to enable functions in the C library, such as printf() and scanf(), to use the screen and keyboard of the
host instead of having a screen and keyboard on the target system.
This is useful because development hardware often does not have all the input and output facilities of the final system.
Semihosting enables the host computer to provide these facilities.
Semihosting is implemented by a set of defined software instructions that generate exceptions from program control.
The application invokes the appropriate semihosting call and the debug agent then handles the exception. The debug
agent provides the required communication with the host.
The semihosting interface is common across all debug agents that are provided by ARM. Semihosted operations work
when you are debugging applications on your development platform, as shown in the following figure:
Target printf()
SVC C Library Code
SVC handled by
debug agent
Communication
debugger with debugger
running on host
Host
Text displayed
hello on host screen
In many cases, semihosting is invoked by code within library functions. The application can also invoke the semihost-
ing operation directly.
Note: The instruction that is used to make semihosting calls can be SVC, HLT, or BKPT, depending on the processor.
5
Semihosting for AArch32 and AArch64, Release 2.0
Related information
6
CHAPTER
THREE
Semihosting is supported for ARM A and R profiles using the A64, A32, and T32 instruction sets, and for M profile
using the T32 instruction set.
Semihosting operations are requested using a trap instruction, which is a software instruction that generates exceptions
from program control. Semihosting callers issue trap instructions, and the semihosting implementation then handles
the resulting exception to perform the required semihosting operation. The trap instruction can be SVC, HLT, or BKPT,
as indicated in Table 3.1:
Note: This requirement includes supporting the HLT encodings on ARMv7 and earlier processors, even though HLT
is only defined as an instruction in ARMv8. This may require the semihosting implementation to trap the UNDEF
exception.
The HLT encodings are new in version 2.0 of the semihosting specification. Where possible, have semihosting callers
continue to use the previously existing trap instructions to ensure compatibility with legacy semihosting implemen-
tations. These trap instructions are HLT for A64, SVC on A+R profile A32 or T32, and BKPT on M profile. How-
ever, it is necessary to change from SVC to HLT instructions to support AArch32 semihosting properly in a mixed
AArch32/AArch64 system.
Note: ARM encourages semihosting callers to implement support for trapping using HLT on A32 and T32 as a
configurable option. ARM strongly discourages semihosting callers from mixing the HLT and SVC mechanisms
within the same executable.
The OPERATION NUMBER REGISTER must contain the number of the semihosting operation to be performed.
This number is given in parentheses after the operation name in the following sections. For example, SYS_OPEN
(0x01).
Parameters are passed to the operation using the PARAMETER REGISTER. For most operations, the PARAMETER
7
Semihosting for AArch32 and AArch64, Release 2.0
REGISTER must contain a pointer to a data block that holds the parameters. In some cases a single parameter is
passed directly in the PARAMETER REGISTER, or no parameters are passed at all.
Results are returned in the RETURN REGISTER, either as an explicit return value or as a pointer to a data block. If
no result is returned, assume that the RETURN REGISTER is corrupted. Some operations also return information in
the PARAMETER REGISTER.
Multi-byte values in memory must be formatted as pure little-endian or pure big-endian to match the endianness
mapping configuration of the processor.
Table 3.2 shows the specific registers that are used, and the size of the fields in the data block, which depend on
whether the caller is 32-bit or 64-bit.
Note: The operation number is passed in W0 for the 64-bit ABI, which is the bottom 32 bits of the 64-bit register X0.
Semihosting implementations must not assume that the top 32 bits of X0 are 0.
A few semihosting operations have other differences between the 32-bit and 64-bit versions. These differences are
described in the documentation of those operations.
The available semihosting operation numbers are allocated as follows:
0x00-0x31 Used by ARM.
0x32-0xFF Reserved for future use by ARM.
0x100-0x1FF Reserved for user applications. These semihosting operation numbers are not used by ARM. How-
ever if you are writing your own SVC operations, you are advised to use a different SVC number, rather than
using the semihosted SVC number and these operation type numbers.
0x200-0xFFFFFFFF Undefined and currently unused. ARM recommends that you do not use these semihosting
operation numbers.
Note: Previous versions of the semihosting specification included the operation numbers 0x17
(angel_SWIreason_EnterSVC) and 0x19 (angelSWI_Reason_SyncCacheRange). These semihosting
operation numbers are now reserved, and are not to be used or implemented.
Related information
8
CHAPTER
FOUR
SEMIHOSTING EXTENSIONS
The semihosting API provides an extension mechanism. Semihosting implementations can provide optional function-
ality and advertise to the semihosting caller that they do so. Semihosting callers must check that the implementation
supports the optional functionality before attempting to use it.
Each extension that the specification defines has an associated feature bit. If the implementation provides the extension,
then it reports the feature bit as 1. Each extension definition identifies the feature bit by which feature byte it is in, and
which bit within that byte. For example, feature byte 0, bit 3. Feature bytes and bits within them are both numbered
starting from 0, with feature bit 0 being the least significant bit. Extensions are independent. Unless otherwise stated,
support for one feature does not imply support for any other feature. The caller must check the feature bit for every
feature it wants to use.
Feature bits are reported using a sequence of bytes, which are accessed by using the SYS_OPEN call with the special
path name :semihosting-features. The byte sequence has the following format:
There is no limit to the number of bytes that can be returned. As future extensions are defined, new bytes will be
added. If the read reaches the end of the file before the byte that contains a particular feature bit, then that feature bit
must be taken to be 0.
Since the file is a sequence of bytes, the order remains the same whether the processor is big-endian or little-endian.
The contents must be treated as a byte array, not an array of words or any other larger type.
9
Semihosting for AArch32 and AArch64, Release 2.0
special path name with any other opening mode must fail. The implementation must support opening of this
special path name multiple times, both consecutively and simultaneously.
• Support the following operations on the filehandle returned from SYS_OPEN of :semihosting-features
:
SYS_FLEN Returns the length of the byte sequence, including the magic number bytes.
SYS_ISTTY Always returns 0.
SYS_SEEK Permits random seeks to anywhere within the byte sequence.
SYS_READ Reads bytes from the sequence starting from the current seek position.
SYS_CLOSE Closes the filehandle.
The special path name does not correspond to a real file in a filesystem, and so no special case handling of it is expected
for SYS_REMOVE or SYS_RENAME.
The following C-like pseudocode describes one possible simple implementation of a check for a specific feature bit:
#define MAGICLEN 4
bool sh_feature_supported(int bytenum, int bitnum)
{
unsigned char magic[MAGICLEN];
unsigned char c;
int fh;
int len;
fh = sys_open(":semihosting_features", 0);
if (fh == -1) {
return false;
}
len = sys_flen(fh);
if (len <= bytenum) {
sys_close(fh);
return false;
}
if (sys_read(fh, &magic, MAGICLEN) != 0) {
sys_close(fh);
return false;
}
if (magic[0] != SHFB_MAGIC_0 ||
magic[1] != SHFB_MAGIC_1 ||
magic[2] != SHFB_MAGIC_2 ||
magic[3] != SHFB_MAGIC_3) {
sys_close(fh);
return false;
}
if (sys_seek(fh, bytenum) != 0) {
sys_close(fh);
return false;
}
if (sys_read(fh, &c, 1) != 0) {
sys_close(fh);
return false;
}
sys_close(fh);
return (c & (1 << bitnum)) != 0;
}
More sophisticated implementations can choose to cache the contents of the start of the file with the magic bytes and
the first few bytes of feature bit data. Conversely if, for instance, the caller knows in advance that it is only interested
in feature bits inside the first feature byte, it can simplify this method to perform a single 5 byte read and need not call
SYS_FLEN or SYS_SEEK.
Table 4.1 lists the semihosting extensions currently available, along with their associated feature byte and bit.
FIVE
SEMIHOSTING OPERATIONS
12
Semihosting for AArch32 and AArch64, Release 2.0
SYS_CLOCK (0x10)
Returns the number of centiseconds (hundredths of a second) since the execution started.
Values returned can be of limited use for some benchmarking purposes because of communication overhead or other
agent-specific factors. For example, with a debug hardware unit the request is passed back to the host for execution.
This can lead to unpredictable delays in transmission and process scheduling.
Use this function to calculate time intervals, by calculating differences between intervals with and without the code
sequence to be timed.
Entry
Return
Related information
• SYS_ELAPSED (0x30)
• SYS_TICKFREQ (0x31)
SYS_CLOSE (0x02)
Closes a file on the host system. The handle must reference a file that was opened with SYS_OPEN.
Entry
Return
Related information
• SYS_OPEN (0x01)
SYS_ELAPSED (0x30)
Entry (32-bit)
On entry, the PARAMETER REGISTER points to a two-field data block to be used for returning the number of elapsed
ticks:
field 1 The least significant field and is at the low address.
field 2 The most significant field and is at the high address.
Entry (64-bit)
On entry the PARAMETER REGISTER points to a one-field data block to be used for returning the number of elapsed
ticks:
field 1 The number of elapsed ticks as a 64-bit value.
Return
On exit:
• On success, the RETURN REGISTER contains 0, the PARAMETER REGISTER is unchanged, and the data
block pointed to by the PARAMETER REGISTER is filled in with the number of elapsed ticks.
• On failure, the RETURN REGISTER contains -1, and the PARAMETER REGISTER contains -1.
Note: Some semihosting implementations might not support this semihosting operation, and they always return -1 in
the RETURN REGISTER.
Related information
• SYS_TICKFREQ (0x31)
SYS_ERRNO (0x13)
Returns the value of the C library errno variable that is associated with the semihosting implementation.
The errno variable can be set by a number of C library semihosted functions, including:
• SYS_REMOVE
• SYS_OPEN
• SYS_CLOSE
• SYS_READ
• SYS_WRITE
• SYS_SEEK.
Whether errno is set or not, and to what value, is entirely host-specific, except where the ISO C standard defines the
behavior.
Entry
Return
On exit, the RETURN REGISTER contains the value of the C library errno variable.
Related information
• SYS_CLOSE (0x02)
• SYS_OPEN (0x01)
• SYS_READ (0x06)
• SYS_REMOVE (0x0E)
• SYS_SEEK (0x0A)
• SYS_WRITE (0x05)
SYS_EXIT (0x18)
An application calls this operation to report an exception to the debugger directly. The most common use is to report
that execution has completed, using ADP_Stopped_ApplicationExit.
Note: This semihosting operation provides no means for 32-bit callers to indicate an application
exit with a specified exit code. Semihosting callers may prefer to check for the presence of the
SH_EXT_EXTENDED_REPORT_EXCEPTION extension and use the SYS_REPORT_EXCEPTION_EXTENDED op-
eration instead, if it is available.
Entry (32-bit)
On entry, the PARAMETER register is set to a reason code describing the cause of the trap. Not all semihosting client
implementations will necessarily trap every corresponding event. These reason codes are defined in the following
tables.
The following table shows reason codes relating to hardware exceptions. Exception handlers can use these operations
to report an exception that has not been handled:
Name Hexadecimal value
ADP_Stopped_BranchThroughZero 0x20000
ADP_Stopped_UndefinedInstr 0x20001
ADP_Stopped_SoftwareInterrupt 0x20002
ADP_Stopped_PrefetchAbort 0x20003
ADP_Stopped_DataAbort 0x20004
ADP_Stopped_AddressException 0x20005
ADP_Stopped_IRQ 0x20006
ADP_Stopped_FIQ 0x20007
The following table shows reason codes relating to software events:
Name Hexadecimal value
ADP_Stopped_BreakPoint 0x20020
ADP_Stopped_WatchPoint 0x20021
ADP_Stopped_StepComplete 0x20022
ADP_Stopped_RunTimeErrorUnknown 0x20023
ADP_Stopped_InternalError 0x20024
ADP_Stopped_UserInterruption 0x20025
ADP_Stopped_ApplicationExit 0x20026
ADP_Stopped_StackOverflow 0x20027
ADP_Stopped_DivisionByZero 0x20028
ADP_Stopped_OSSpecific 0x20029
Entry (64-bit)
Return
No return is expected from these calls. However, it is possible for the debugger to request that the application continues
by performing an RDI_Execute request or equivalent. In this case, execution continues with the registers as they
were on entry to the operation, or as subsequently modified by the debugger.
Related information
• SYS_EXIT_EXTENDED (0x20)
SYS_EXIT_EXTENDED (0x20)
Entry
Return
Related information
• SYS_EXIT (0x18)
SYS_FLEN (0x0C)
Entry
Return
SYS_GET_CMDLINE (0x15)
Returns the command line that is used for the call to the executable, that is, argc and argv.
Entry
On entry, the PARAMETER REGISTER points to a two-field data block to be used for returning the command string
and its length:
field 1 A pointer to a buffer of at least the size that is specified in field 2.
field 2 The length of the buffer in bytes.
Return
On exit:
If the call is successful, then the RETURN REGISTER contains 0, the PARAMETER REGISTER is unchanged, and
the data block is updated as follows:
field 1 A pointer to a null-terminated string of the command line.
field 2 The length of the string in bytes.
If the call is not successful, then the RETURN REGISTER contains -1.
Note: The semihosting implementation might impose limits on the maximum length of the string that can be trans-
ferred. However, the implementation must be able to support a command-line length of at least 80 bytes.
SYS_HEAPINFO (0x16)
Entry
On entry, the PARAMETER REGISTER contains the address of a pointer to a four-field data block. The contents of
the data block are filled by the function. The following C-like pseudocode describes the layout of the block:
struct block {
void* heap_base;
void* heap_limit;
void* stack_base;
void* stack_limit;
};
Return
On exit, the PARAMETER REGISTER is unchanged and the data block has been updated.
SYS_ISERROR (0x08)
Determines whether the return code from another semihosting call is an error status or not.
This call is passed a parameter block containing the error code to examine.
Entry
Return
SYS_ISTTY (0x09)
Entry
Return
SYS_OPEN (0x01)
Entry
Return
SYS_READ (0x06)
Entry
Return
On exit, the RETURN REGISTER contains the number of bytes not filled in the buffer (buffer_length
-bytes_read) as follows:
• If the RETURN REGISTER is 0, the entire buffer was successfully filled.
• If the RETURN REGISTER is the same as field 3, no bytes were read (EOF can be assumed).
• If the RETURN REGISTER contains a value smaller than field 3, the read succeeded but the buffer was only
partly filled. For interactive devices, this is the most common return value.
Related information
• SYS_READC (0x07)
SYS_READC (0x07)
Entry
The PARAMETER REGISTER must contain 0. There are no other parameters or values possible.
Return
On exit, the RETURN REGISTER contains the byte read from the console.
Related information
• SYS_READ (0x06)
SYS_REMOVE (0x0E)
Entry
Return
SYS_RENAME (0x0F)
Entry
Return
SYS_SEEK (0x0A)
Seeks to a specified position in a file using an offset specified from the start of the file.
The file is assumed to be a byte array and the offset is given in bytes.
Entry
Return
Note: The effect of seeking outside the current extent of the file object is undefined.
Related information
• SYS_ERRNO (0x13)
SYS_SYSTEM (0x12)
Caution: The command that is passed to the host is executed on the host. Ensure that any command passed has
no unintended consequences.
Entry
Return
SYS_TICKFREQ (0x31)
Entry
Return
Note: Some semihosting implementations might not support this semihosting operation, and they always return -1 in
the RETURN REGISTER.
SYS_TIME (0x11)
Entry
Return
SYS_TMPNAM (0x0D)
Entry
Return
SYS_WRITE (0x05)
Writes the contents of a buffer to a specified file at the current file position.
The file position is specified either:
• Explicitly, by a SYS_SEEK.
• Implicitly as one byte beyond the previous SYS_READ or SYS_WRITE request.
The file position is at the start of the file when the file is opened, and is lost when the file is closed.
Perform the file operation as a single action whenever possible. For example, do not split a write of 16KB into four
4KB chunks unless there is no alternative.
Entry
Return
Related information
• SYS_WRITE0 (0x04)
• SYS_WRITEC (0x03)
SYS_WRITEC (0x03)
Writes a character byte, pointed to by the PARAMETER REGISTER, to the debug channel.
When executed under an ARM debugger, the character appears on the host debugger console.
Entry
Return
Related information
• SYS_WRITE (0x05)
• SYS_WRITE0 (0x04)
SYS_WRITE0 (0x04)
Entry
On entry, the PARAMETER REGISTER contains a pointer to the first byte of the string.
Return
Related information
• SYS_WRITE (0x05)
• SYS_WRITEC (0x03)