Table of Contents

Microblaze QEMU

What is QEMU?

Look at Qemu inside PetaLinux

<html> <object width=“640” height=“505”><param name=“movie” value=“http://www.youtube.com/v/f3cC44OPZ1M&hl=en&fs=1&”></param><param name=“allowFullScreen” value=“true”></param><param name=“allowscriptaccess” value=“always”></param><embed src=“http://www.youtube.com/v/KAg3vmkx9Yk&hl=en&fs=1&” type=“application/x-shockwave-flash” allowscriptaccess=“always” allowfullscreen=“true” width=“640” height=“505”></embed></object> </html>

<html> <object width=“640” height=“505”><param name=“movie” value=“http://www.youtube.com/v/f3cC44OPZ1M&hl=en&fs=1&”></param><param name=“allowFullScreen” value=“true”></param><param name=“allowscriptaccess” value=“always”></param><embed src=“http://www.youtube.com/v/f3cC44OPZ1M&hl=en&fs=1&” type=“application/x-shockwave-flash” allowscriptaccess=“always” allowfullscreen=“true” width=“640” height=“505”></embed></object> </html>

Supported peripherals

README

Files:
.config         kernelconfig for the vmlinux.nommu build.
README
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:

microblaze-linux-user/qemu-microblaze
microblaze-softmmu/qemu-system-microblaze

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
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 6.5.0.20060626-cvs
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();
(gdb) 

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