Semihosting as an additional debug mechanism | Developers

Semihosting as an additional debug mechanism

Estimated reading time: Less than a minute

QEMU implements some semihosted operations which can be triggered from the app. For instance, messages can be printed to stderr with the following code:


void debug_write(char *buf)
  asm volatile (
     "movs r0, #0x04\n"
     "movs r1, %0\n"
     "svc      0xab\n"
     :: "r"(buf) : "r0", "r1"

The operation number must be passed in r0 (here SYS_WRITE0 operation is defined to 0x04) and arguments are in r1, r2 and r3.




Did you find this page helpful?

How would you improve this page for developers?

Automation: press buttons automatically
Getting Started
Theme Features