BrianSidebotham/arm-tutorial-rpi

Is it possible to run the framebuffer & UART example through qemu?

Closed this issue ยท 4 comments

I am having trouble viewing both the framebuffer animation and connecting to the UART socket.

The command I am using to build is
./build.sh rpi3bp

And running qemu:
qemu-system-aarch64 -M raspi3b -kernel build/kernel.armc-014.rpi3bp.img -serial stdio

I care not so much about viewing the framebuffer but would like to see the output of the printf commands but nothing is spat out :/

Any help would be appreciated, thanks

Hi @F1r3Hydr4nt ,

Thanks for creating an issue. A few things, we do not compile for the aarch64 64-bit archtecure so you need to use qemu-system-arm instead to run a 32-bit kernel.

Also, we're using the mini uart which is not the default output for qemu, so we need to tweak the options a little bit to get the output of the UART we're using the tutorials. My qemu-system-arm version doesn't support raspi3b, so here I show the full emulation command I can use to get the graphics and UART output:

$ ./build.sh rpi1 && cd build

$ qemu-system-arm -M raspi1ap -kernel kernel.armc-014.rpi1 -serial null -serial mon:stdio

------------------------------------------
Valvers.com ARM Bare Metal Tutorials
Initialise UART console with standard libc
CORE Frequency: 700MHz
ARM  Frequency: 700MHz
Board Revision: 0x00900021 rpi-1A+ BCM2835 512MB Sony UK
Firmware Version: 346337
MAC Address: 52:54:00:12:34:57
Serial Number: 0000000000000000
Initialised Framebuffer: 640x480 32bpp
Pitch: 2560 bytes
Framebuffer address: 1C100000

My intention was to do this in Part-6 so we don't have to use physical SD cards all the time! Let's get it in the tutorials to get everyone emulating.

If you want to get rid of the graphical output then just add the -nographic option to the qemu command line.

Thanks for the swift response @BrianSidebotham (it works)

Another option I am considering for quick debugging is network booting, although I am putting this on the long finger until I get gdb running!

Cheers

Also, I have found this which might enable booting qemu with an arm 32 bit image: https://fedoraproject.org/wiki/Architectures/AArch64/Booting_a_32-Bit_QEMU_image

**Debugging with GDB:

qemu-system-arm -M raspi1ap -kernel build/kernel.armc-uart.rpi1 -serial null -serial mon:stdio -nographic -s -S
gdb-multiarch -tui -ex 'target remote localhost:1234'

-s is a shortcut for -gdb tcp::1234
-S means freeze CPU at startup

Yes, it looks like gdb remote works OK for debugging.

image

๐Ÿ‘

Works with qemu too!

If necessary for my objective will share aarch64 build instructions, thanks again.