Semihosting Host IO Support

Gareth McMullin edited this page Apr 29, 2015 · 2 revisions

Standard ARMv6-M/ARMv7-M semihosting is supported, i.e. you can build your application in a special way to have calls to certain functions (open(), close(), read(), write(), lseek(), rename(), unlink(), stat(), isatty(), system()) executed on the debugging host itself. To make use of these facilities, add --specs=rdimon.specs and -lrdimon to the linker flags for your firmware.

If you're going to use stdin, stdout or stderr (e.g. via printf()/scanf()) and you're not using newlib's C runtime (by specifying -nostartfiles), you need to add this to your initialisation:

void initialise_monitor_handles(void);
initialise_monitor_handles();

Chapter 8 of this document describes the low level interface on the ARM side: http://infocenter.arm.com/help/topic/com.arm.doc.dui0471c/DUI0471C_developing_for_arm_processors.pdf