Discussion:
[Qemu-discuss] QEMU NIOS2 "Hello world"
Zeeshan Hayat
2018-11-20 18:11:05 UTC
Permalink
Hi,


I am trying to run a simple program by running,


qemu-system-nios2 -nographic -kernel a.out


Where a.out is the binary file of hello world program.


The terminal just hangs by running this. Is there a way to print the "hello world" in the same terminal as QEMU.


/Zeeshan
Peter Maydell
2018-11-20 18:21:29 UTC
Permalink
Post by Zeeshan Hayat
Hi,
I am trying to run a simple program by running,
qemu-system-nios2 -nographic -kernel a.out
Where a.out is the binary file of hello world program.
The terminal just hangs by running this. Is there a way to print the "hello world" in the same terminal as QEMU.
Your command line should direct the output from a serial
port to the terminal. If your guest program is hanging
without printing anything I would start by trying to
debug what it is doing -- it's probable that it is
crashing before it gets to sending anything to the
serial port. For instance, if the binary has not
been compiled for the correct target machine model or
has been compiled to load somewhere there is no RAM
you can see this sort of behaviour.

Using the QEMU debug stub (pass QEMU the '-s' and '-S'
options and then connect a nios2-aware gdb to it on
port 1234) is probably a good place to start.

If your binary is actually a Linux userspace binary
(ie not a standalone image for running on a bare-metal
board), then the problem is that you're trying to run it
with the wrong QEMU executable. qemu-system-nios2 is
for system images, and qemu-nios2 is for single Linux
executables.

thanks
-- PMM

Loading...