QEMU — PlatformIO latest documentation (original) (raw)
QEMU is a free and open-source emulator that performs hardware virtualization. Official reference can be found here.
Configuration
Integration of the QEMU requires adding the platform compatible package to the platform_packages option in your“platformio.ini” (Project Configuration File), and overriding the test_testing_command.
See the example of platformio.ini
for the HiFive1board from SiFive:
[env:hifive1] platform = sifive framework = freedom-e-sdk board = hifive1
platform_packages = platformio/tool-qemu-riscv test_testing_command = ${platformio.packages_dir}/tool-qemu-riscv/bin/qemu-system-riscv32 -nographic -machine sifive_e -kernel platformio.builddir/{platformio.build_dir}/platformio.builddir/{this.env}/firmware.elf
Testing
QEMU does not require a firmware uploading stage. Please use the pio test --without-uploading command option.
pio test --without-uploading
Verbose mode can be enabled via -v, --verbose
option
Collected 1 tests
Processing test_dummy in hifive1 environment
Building... Testing... test/test_dummy/main.c🔞 dummy_test [PASSED] ---------------------- hifive1:test_dummy [PASSED] Took 2.05 seconds ----------------------
======================================= SUMMARY ======================================= Environment Test Status Duration
hifive1 test_dummy PASSED 00:00:02.055 ====================== 1 test cases: 1 succeeded in 00:00:02.055 ======================