You copied the Doc URL to your clipboard.

set semihosting

This command 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 must configure semihosting addresses before you enable semihosting.

For example:

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


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