qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: qemu hello world prints nothing..


From: Peter Maydell
Subject: Re: qemu hello world prints nothing..
Date: Tue, 26 Jan 2021 09:46:42 +0000

On Tue, 26 Jan 2021 at 07:02, <ckim@etri.re.kr> wrote:
> I wish someone could help me here. Running a simple program on qemu is not 
> easy for me.
>
> I tried to run baremetal hello world program and found this web page.
>
> (https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/)
>
> This page is somewhat so old, but I decided to give it a try.
[details of changes for aarch64 skipped]
> When I execute
>
> “qemu-system-aarch64 -M virt -cpu cortex-a57 -kernel test.bin -nographic”
>
> nothing comes out.
>
> What can be wrong?

You tried to run a bare-metal program, and it isn't built correctly,
so it has crashed. "Nothing happens" is the most common visible
effect of a bug in initial startup of bare-metal programs. It's not
specific to QEMU -- if you try to do bare metal development on
real hardware you will see a lot of "nothing happened" there too.
Now you have to debug it :-)

This is a good point to look into how to use gdb and connect it
to the QEMU debug stub so that you can single step the initial
startup of your program and see where it does something you don't
expect it to.

As a more specific suggestion: the linker script in the tutorial
is written for the 32-bit 'versatilepb' board, which has RAM
starting at address 0. You're running on the aarch64 'virt' board,
where address 0 has flash (ROM) memory, and RAM starts at
0x4000_0000. The UART also is not at the same address in 'virt'
as it is in 'versatilepb'. You will need to adjust your linker
script and the definition of UART0DR to work on the 'virt' board.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]