qemu.md 1.6 KB

QEMU

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:

:::::{tab-set} :sync-group: os

::::{tab-item} Ubuntu 24.04 LTS :sync: ubuntu

sudo apt install autoconf libglib2.0-dev libpixman-1-dev

::::

::::{tab-item} macOS :sync: macos

brew install autoconf glib pixman

:::: :::::

  1. Install pyenv following this guide (steps A-D).
  2. Install Python 2.7:

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

    pyenv local 2.7
    
  4. Clone QEMU

    git clone --recurse-submodules https://github.com/pebble-dev/qemu
    cd qemu
    
  5. Configure QEMU:

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

    make
    
  7. 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