Skip to content
Serge Vakulenko edited this page Dec 22, 2015 · 28 revisions

How to build QEMU for MIPS

On Ubuntu Linux, use these commands:

$ sudo apt-get install libpixman-1-dev libfdt-dev zlib1g-dev libglib2.0-dev libsdl-dev
$ git clone https://github.com/sergev/qemu.git
$ cd qemu
$ ./configure --prefix=/usr/local/qemu-mips --target-list=mipsel-softmmu
$ make
$ make install

It will build QEMU for MIPS (little endian) and install the binaries to /usr/local/qemu/mips directory. You can choose whatever destination you want.

Supported PIC32 microcontrollers and boards

Machine selector Microcontroller and board
pic32mx7-explorer16 PIC32MX7 on Microchip Explorer-16 board
pic32mx7-max32 PIC32MX7 on chipKIT Max32 board
pic32mx7-maximite PIC32MX7 on Geoff's Maximite board
pic32mz-explorer16 PIC32MZ on Microchip Explorer-16 board
pic32mz-meb2 PIC32MZ on Microchip MEB-II board
pic32mz-wifire PIC32MZ on chipKIT WiFire board

To select the processor and board, use "-machine" option. Different boards use different assignments for console UART port, and SPI port for SD card.

Run PIC32 simulation

You can get the binary files, mentioned below, using these links:

To enable instruction tracing, add options "-d instr -D output.trace".

Hello World

Run 'Hello World' application on Max32 board:

/usr/local/qemu-mips/bin/qemu-system-mipsel -machine pic32mx7-max32 \
    -nographic \
    -monitor none \
    -serial stdio \
    -bios boot-max32.hex \
    -kernel hello-max32.hex

See [result here](Max32 Hello World).

[Here](Example of instruction trace) you can find an example of instruction trace file, generated by options "-d instr -D output.trace".

2.11bsd for pic32mx7

Run RetroBSD on Max32 board:

/usr/local/qemu-mips/bin/qemu-system-mipsel -machine pic32mx7-max32 \
    -nographic \
    -monitor none \
    -serial stdio \
    -bios boot-max32.hex \
    -kernel unix.hex \
    -sd retrobsd.img

See [result here](RetroBSD Example).

4.4bsd for pic32mz

Run LiteBSD on WiFire board:

/usr/local/qemu-mips/bin/qemu-system-mipsel -machine pic32mz-wifire \
    -nographic \
    -monitor none \
    -serial vc \
    -serial vc \
    -serial vc \
    -serial stdio \
    -bios boot-wifire.hex \
    -kernel vmunix.hex \
    -sd litebsd.img

See [result here](LiteBSD Example).

Network

Run LiteBSD on MEB-II board with Ethernet enabled:

sudo tunctl -t tap0 -u $USER
sudo ifconfig tap0 20.2.2.2
/usr/local/qemu-mips/bin/qemu-system-mipsel -machine pic32mz-meb2 \
    -nographic \
    -monitor none \
    -serial stdio \
    -net nic \
    -net tap,ifname=tap0,script=no,downscript=no \
    -kernel vmunix.hex \
    -sd litebsd.img