Get logged in with semi-hosting QEMU and ARM?

For the ARM architecture, we make system calls using the SVC command. My recommendation is the following ARM What is semi-hosting? . In particular, select any version, select Arm Compiler Toolchain Developing Software ..., then select Semihosting to see the available system call numbers.

One wants to define a getChar() procedure that leaves a char in the r0 register. According to the documentation, r1 must be 0 when called, and after the exit, r0 contains the read character. So we think something like

 mov r1,#0 mov r0,#7 svc 123456 

Must be the main ingredients. However, the program does not wait for input. I can also say for sure that the register r0 always contains the value 0 after the exit. Any thoughts on what's going on? I suspect the problem is understanding what the console means in the documentation.

+4
source share
1 answer

From qemu 1.4.0 source: ( target-arm/arm-semi.c , lines 303-305)

 case TARGET_SYS_READC: /* XXX: Read from debug console. Not implemented. */ return 0; 

I suggest you use SYS_READ with a buffer size of 1 instead, if you really want to use qihu semihosted mode and read from the "console".

+3
source

All Articles