Microblaze QEMU

What is QEMU?

Look at Qemu inside PetaLinux

Supported peripherals

  • Microblaze with/without MMU
  • timer
  • intc
  • uartlite
  • emaclite
  • ll_temac - testing phase - available only for customers


.config         kernelconfig for the vmlinux.nommu build.
mb.dtb          The dtb passed to the guest kernel by QEMU.
mb.dts          Source for mb.dtb.
vmlinux.mmu     An MMU linux kernel build.

To build the microblaze emulator do this:

$ git clone git://git.sv.gnu.org/qemu.git
$ cd qemu
$ ./configure --target-list=microblaze-linux-user,microblaze-softmmu
$ make

After while you should have two binaries:


I suggest copying them to /usr/local/bin/.

To emulate user-mode programs, use the linux-user version. I've provided sample programs for testing (just a cross compiled busybox installation). Please note that the QEMU linux user version cannot load FLAT binaries so the uclinux nommu user apps cannot be emulated at the moment.

$ qemu-microblaze -L busybox-root busybox-root/bin/echo microblaze
$ qemu-microblaze -L busybox-root busybox-root/bin/vi

System emulation expects to find a dtb file named mb.dtb on the current directory (hardcoded). I provided an mmu kernel and the dtb/dts files. Two try it out run qemu like this:

$ qemu-system-microblaze -kernel vmlinux.nommu -serial stdio -m 256 -s -append "rdinit=/bin/sh"

The black window that pops up is the QEMU console available for controlling QEMU itself. The emulation should bring you into a user-space shell waiting for input on your terminal. The console is over the emulated uartlite.

You can at any time attach with gdb:

$ mb-linux-gdb -nw vmlinux.mmu 
GNU gdb
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=microblaze-linux-gnu"...
(gdb) target remote :1234
Remote debugging using :1234
[New thread 1]
default_idle () at arch/microblaze/kernel/process.c:88
88                              cpu_relax();

If you want to single-step the boot with gdb, pass the -S flag to qemu and it will wait for the debugger to attach before executing the first instruction.

GDB debugging in linux-user mode doesn't work at the moment.

Run with cachegrind

./run-qemu.sh -d cachegrind

Analyze result

kcachegrind cachegrind.out.qemu 

qemu/qemu.txt · Last modified: 2010/09/08 08:04 (external edit)
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki