QEMU#

Important

QEMU is only available for STM32 targets

Getting QEMU#

The same QEMU binary found in the SDK can be used to build and develop the firmware. Below you can also find a detailed guide on how to build it from source if you need to do so (e.g. on Apple Silicon).

Building from source#

  1. Install OS-level pre-requisites:

sudo apt install autoconf libglib2.0-dev libpixman-1-dev
brew install autoconf glib pixman
  1. Install pyenv following this guide (steps A-D).

  2. Install Python 2.7:

pyenv install 2.7
  1. Activate Python 2.7 on the current shell:

pyenv local 2.7
  1. Clone QEMU

git clone --recurse-submodules https://github.com/coredevices/qemu
cd qemu
  1. Configure QEMU:

./configure \
  --disable-werror \
  --enable-debug \
  --target-list="arm-softmmu" \
  --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY
  1. Build QEMU:

make
  1. Make sure to make it available on your PATH:

export PATH=$PWD/arm-softmmu:$PATH

Build#

The steps here are similar that of real hardware:

./waf configure --board=$BOARD --qemu
./waf build
./waf qemu_image_spi

where $BOARD is any STM32 based board.

Run#

You can launch QEMU with the built image using:

./waf qemu

Console#

You can launch a console using:

./waf qemu_console

Debug#

You can debug with GDB using:

./waf qemu_gdb