Skip to content
Gabriel Staples edited this page Feb 12, 2025 · 35 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

Source code

See here.

Binary files

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: Max32-Hello-World.md

Here 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: RetroBSD-Example.md

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: LiteBSD-Example.md

Network: on MEB-II board

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-meb2.hex \
    -sd litebsd.img

Example run and output