Discussion:
[Qemu-discuss] console output with -nographic on Windows
Brendan Simon (eTRIX)
2018-09-17 11:26:45 UTC
Permalink
I've been trying to use the following GNU MCU Eclipse QEMU releases to
do unit tests for ARM Cortex binaries.

https://gnu-mcu-eclipse.github.io/qemu/
https://gnu-mcu-eclipse.github.io/qemu/releases/

I compiled the very simple semi-hosting hello world sample in the gcc
arm installation (from ARM download site).  It's a basic `printf("Hello
world!");`

It runs ok on the Mac.  i.e. displays "Hello world!" on the terminal
that I run qemu from.

However the same command line and exact same binary does not show any
output when run on a Windows box (Win 10).  I tried from MSYS2 bash
shell and Windows Command Prompt, and both show no output.

A bit of googling suggests that it displaying console output just
doesn't work on Windows.

Is that really true?  Why can't Windows output to stdout?  Surely it's
technically possible, and not too difficult?  Surely there must be a way
to get stdout working Windows.

What magic do I have to do to get this working?

Thanks, Brendan.
Thomas Huth
2018-09-17 11:43:32 UTC
Permalink
Post by Brendan Simon (eTRIX)
I've been trying to use the following GNU MCU Eclipse QEMU releases to
do unit tests for ARM Cortex binaries.
https://gnu-mcu-eclipse.github.io/qemu/
https://gnu-mcu-eclipse.github.io/qemu/releases/
I compiled the very simple semi-hosting hello world sample in the gcc
arm installation (from ARM download site).  It's a basic `printf("Hello
world!");`
It runs ok on the Mac.  i.e. displays "Hello world!" on the terminal
that I run qemu from.
However the same command line and exact same binary does not show any
output when run on a Windows box (Win 10).  I tried from MSYS2 bash
shell and Windows Command Prompt, and both show no output.
A bit of googling suggests that it displaying console output just
doesn't work on Windows.
Is that really true?  Why can't Windows output to stdout?  Surely it's
technically possible, and not too difficult?  Surely there must be a way
to get stdout working Windows.
What magic do I have to do to get this working?
Is your QEMU binary using SDL1.2 ? In that case, it's likely that SDL
redirects stdout into a file. Try a binary that is linked against SDL2
instead - as far as I know, SDL2 does not do this redirecation anymore.

Thomas
Brendan Simon (eTRIX)
2018-09-17 11:59:17 UTC
Permalink
Post by Thomas Huth
Post by Brendan Simon (eTRIX)
I've been trying to use the following GNU MCU Eclipse QEMU releases to
do unit tests for ARM Cortex binaries.
https://gnu-mcu-eclipse.github.io/qemu/
https://gnu-mcu-eclipse.github.io/qemu/releases/
I compiled the very simple semi-hosting hello world sample in the gcc
arm installation (from ARM download site).  It's a basic `printf("Hello
world!");`
It runs ok on the Mac.  i.e. displays "Hello world!" on the terminal
that I run qemu from.
However the same command line and exact same binary does not show any
output when run on a Windows box (Win 10).  I tried from MSYS2 bash
shell and Windows Command Prompt, and both show no output.
A bit of googling suggests that it displaying console output just
doesn't work on Windows.
Is that really true?  Why can't Windows output to stdout?  Surely it's
technically possible, and not too difficult?  Surely there must be a way
to get stdout working Windows.
What magic do I have to do to get this working?
Is your QEMU binary using SDL1.2 ? In that case, it's likely that SDL
redirects stdout into a file. Try a binary that is linked against SDL2
instead - as far as I know, SDL2 does not do this redirecation anymore.
Not really sure as I'm running a pre-built binary, but the libraries in
the install directory suggest it is SDL2.

$ ls ~/opt/gnu-mcu-eclipse/qemu/2.8.0-3-20180523-0703/bin/
libSDL2-2.0.0.dylib       libglib-2.0.0.dylib      
libintl.8.dylib           libz.1.dylib
libSDL2_image-2.0.0.dylib libgthread-2.0.0.dylib   
libpixman-1.0.dylib       qemu-system-gnuarmeclipse
libgcc_s.1.dylib          libiconv.2.dylib          libstdc++.6.dylib

and the build script on github suggests it is:
    SDL2_VERSION="2.0.5"

https://github.com/gnu-mcu-eclipse/qemu-build/blob/master/scripts/container-build.sh

Brendan.
Brendan Simon (eTRIX)
2018-09-19 12:08:10 UTC
Permalink
Resending, hoping someone has a solution to get semi-hosting console
output on Windows platform.

Thanks, Brendan.
Post by Brendan Simon (eTRIX)
I've been trying to use the following GNU MCU Eclipse QEMU releases to
do unit tests for ARM Cortex binaries.
https://gnu-mcu-eclipse.github.io/qemu/
https://gnu-mcu-eclipse.github.io/qemu/releases/
I compiled the very simple semi-hosting hello world sample in the gcc
arm installation (from ARM download site).  It's a basic
`printf("Hello world!");`
It runs ok on the Mac.  i.e. displays "Hello world!" on the terminal
that I run qemu from.
However the same command line and exact same hellow wolrd image does
not show any output when run on a Windows box (Win 10).  I tried from
MSYS2 bash shell and Windows Command Prompt, and both show no output.
A bit of googling suggests that it displaying console output just
doesn't work on Windows.
Is that really true?  Why can't Windows output to stdout?  Surely it's
technically possible, and not too difficult?  Surely there must be a
way to get stdout working Windows.
What magic do I have to do to get this working?
Thanks, Brendan.
Loading...