SimAVR

SimAVR is a lean, mean and hackable AVR simulator.

Warning

SimAVR does not work on Windows for the Unit Testing due to issue #489.

Configuration

Integration of the SimAVR simulator requires adding the platformio/tool-simavr package to the platform_packages option in your “platformio.ini” (Project Configuration File), setting test_speed to the 9600, and overriding test_testing_command.

See the example of platformio.ini for the Arduino Uno board from Atmel AVR:

[env:uno]
platform = atmelavr
framework = arduino
board = uno

platform_packages =
    platformio/tool-simavr
test_speed = 9600
test_testing_command =
    ${platformio.packages_dir}/tool-simavr/bin/simavr
    -m
    atmega328p
    -f
    16000000L
    ${platformio.build_dir}/${this.__env__}/firmware.elf

Testing

SimAVR 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 uno environment
----------------------------------------
Building...
Testing...
test/test_dummy/test_main.cpp:19: dummy_test  [PASSED]
--------------------------- uno:test_dummy [PASSED] Took 0.94 seconds -------------------------

=============================== SUMMARY ===============================
Environment    Test        Status    Duration
-------------  ----------  --------  ------------
uno            test_dummy  PASSED    00:00:00.942
======================= 1 test cases: 1 succeeded in 00 ==================================