1.3.149 set semihosting

Controls the semihosting settings in the debugger. Semihosting is used to communicate input/output requests from application code to the host workstation running the debugger.


These settings only apply if the target supports semihosting and they cannot be changed while the target is running.


set semihosting option



Specifies additional options:

args arguments

Specifies the command-line arguments that are passed to the main() function in the application using the  argv  parameter. The name of the image is always implicitly passed in argv[0] and it is not necessary to pass this as an argument.

file-base directory

Specifies the base directory where the files that the application opens are relative to.

stderr "stderr"|filename

Specifies either console streams or a file to write stderr for semihosting operations.

stdin "stdin"|filename

Specifies either console streams or a file to read stdin for semihosting operations.

stdout "stdout"|filename

Specifies either console streams or a file to write stdout for semihosting operations.

top-of-memory address

Specifies the top of memory.


Specifies finer controls to manually configure the base address and limits for the stack and heap. If you use stack_heap_options, then these settings take precedence over the top-of-memory and all of the following options must be specified:

stack-base address

The base address of the stack.

stack-limit address

The end address of the stack.

heap-base address

The base address of the heap.

heap-limit address

The end address of the heap.


Automatically enables semihosting operations if appropriate when an image is loaded. This is the default.


Disables all semihosting operations.


Enables all semihosting operations.

You might have to configure semihosting addresses before you enable semihosting. For example:

set semihosting top-of-memory address
set semihosting enabled on

Allows you to specify the semihosting trap mechanism to use on your target.

ADDR trap_address

Specifies a breakpoint address for the vector catch. This instructs the debugger to set a breakpoint at the specified address. When the breakpoint is hit, the debugger takes control to perform the semihosting operation.


Uses SVC vector catch to trap semihosting operations.


Uses UNDEF vector catch to trap semihosting operations.


Uses SVC+UNDEF vector catch to trap semihosting operations.


  • On M-Profile targets, this command produces an error since semihosting is implemented using a compiled in software breakpoint (BKPT) on these targets.

  • On ARMv7-A or R profiles and classic ARM® targets, you can use SVC, UNDEF, SVC+UNDEF, or the ADDR trap_address options to switch between vector catch operations.

  • On ARMv8-A targets, use ADDR trap_address to enable instruction breakpoint based semihosting.

Example 1-152 Examples

set semihosting args 500                  # Set 500 as command-line argument
set semihosting stdout output.log         # Write stdout to output.log
set semihosting enabled on                # Enable semihosting operations
set semihosting vector svc                # Set the semihosting vector catch to SVC
set semihosting vector ADDR 0x800         # Set the semihosting vector catch to 0x00000800
Non-ConfidentialPDF file icon PDF versionARM DUI0452Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.