This is demo for emBO++ 2021 talk "QEmu in-the-loop development" by Maciej Nowak.
- Structure application into two runner (HW and QEmu)
- Use EDI to interact with external simulators
In addition there are unit tests example included based on QEmu and GoogleTest. Due to GoogleTest dependencies on functionality not available in newlib, forked version is used.
- Copy
local-example.cmake
as.local/local.cmake
- Modify
.local/local.cmake
to include correct paths to toolchain (arm-none-eabi), QEmu and OpenOCD - Generate CMake build:
cmake -DLOCAL_CFG=<src>/.local/local.cmake <src>
- Build project (
cmake --build <build-dir>
ormake
/ninja
in build directory)
- Get Blue Pill (STM32F103 board)
- Connect USB<->UART adapter to Blue pill (STM32's TX on PA9 pin to RX of adapter)
- Connect button between PB12 and GND
- UART adapter will receive logs (baudrate 115200)
- Pressing button will be recognized by software and trigger some logs
- Create venv
<build>/venv
- Install requirements
<build>/venv/Scripts/pip install -r requirements.txt
- Start listener
<build>/venv/Scripts/python <src>/host/listener.py
- Start
QEMU:
qemu-system-arm -machine virt_cortex_m -semihosting -semihosting-config enable=on,target=native -monitor null -kernel <build>/app/qemu_runner/app_qemu.elf -device kp-edi-group
- Listener will receive logs from firmware and simulate button press every few seconds
- Build
unit_tests
target - Run QEMU:
qemu-system-arm -machine virt_cortex_m -semihosting -kernel <build>/unit_tests/unit_tests.elf