diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1af8d436..79517350 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,22 @@ jobs: name: Arduino CLI Build steps: - uses: actions/checkout@v2 + - name: Test run: | ./scripts/install_arduino_cli.sh ./scripts/test_arduino_library.sh "${PWD}" + + - name: Apply serial patch on tflite-micro + run: | + sed --in-place '/#define DEBUG_SERIAL_OBJECT/s/(Serial)/(Serial1)/' src/tensorflow/lite/micro/system_setup.cpp + + - name: Build patched binaries + run: | + ./scripts/test_arduino_library.sh "${PWD}" + + - name: Test patched builds in Renode + uses: antmicro/renode-test-action@v1.0.0 + with: + renode-version: '1.12.0+20210914gitc77eea21' + tests-to-run: 'examples/**/*.robot' diff --git a/examples/hello_world/hello_world.robot b/examples/hello_world/hello_world.robot new file mode 100644 index 00000000..d6295ed9 --- /dev/null +++ b/examples/hello_world/hello_world.robot @@ -0,0 +1,32 @@ +*** Settings *** +Suite Setup Setup +Suite Teardown Teardown +Test Setup Reset Emulation +Test Teardown Test Teardown +Resource ${RENODEKEYWORDS} + +*** Variables *** +${UART} sysbus.uart0 + +*** Keywords *** +Create Machine + Execute Command mach create + Execute Command machine LoadPlatformDescription @platforms/boards/arduino_nano_33_ble.repl + + Execute Command sysbus LoadELF @${CURDIR}/output/hello_world.ino.elf + +*** Test Cases *** +Should Print Brightness Sequence + Create Machine + Create Terminal Tester ${UART} + + Execute Command machine EnableProfiler @${CURDIR}/hello_world.dump + Start Emulation + + Wait For Line On Uart 127 + Wait For Line On Uart 260 + Wait For Line On Uart 205 + Wait For Line On Uart 195 + Wait For Line On Uart 10 + Wait For Line On Uart 1 + Wait For Line On Uart 100 diff --git a/examples/magic_wand/magic_wand.robot b/examples/magic_wand/magic_wand.robot new file mode 100644 index 00000000..9abc02a9 --- /dev/null +++ b/examples/magic_wand/magic_wand.robot @@ -0,0 +1,39 @@ +*** Settings *** +Suite Setup Setup +Suite Teardown Teardown +Test Setup Reset Emulation +Test Teardown Test Teardown +Resource ${RENODEKEYWORDS} + +*** Variables *** +${UART} sysbus.uart0 + +*** Keywords *** +Create Machine + Execute Command mach create + Execute Command machine LoadPlatformDescription @platforms/boards/arduino_nano_33_ble.repl + + Execute Command sysbus LoadELF @${CURDIR}/output/magic_wand.ino.elf + +*** Test Cases *** +Should Detect RING Motion + Create Machine + Create Terminal Tester ${UART} + + Execute Command sysbus.twi0.lsm9ds1_imu FeedAccelerationSample @${CURDIR}/test_files/circle_rotated.data + + Execute Command machine EnableProfiler "${CURDIR}/magic_wand_ring.dump" + Start Emulation + Wait For Line On Uart Magic starts + Wait For Line On Uart RING: + +Should Detect SLOPE Motion + Create Machine + Create Terminal Tester ${UART} + + Execute Command sysbus.twi0.lsm9ds1_imu FeedAccelerationSample @${CURDIR}/test_files/angle_rotated.data + + Execute Command machine EnableProfiler "${CURDIR}/magic_wand_slope.dump" + Start Emulation + Wait For Line On Uart Magic starts + Wait For Line On Uart SLOPE: diff --git a/examples/magic_wand/test_files/angle_rotated.data b/examples/magic_wand/test_files/angle_rotated.data new file mode 100644 index 00000000..33012f26 --- /dev/null +++ b/examples/magic_wand/test_files/angle_rotated.data @@ -0,0 +1,650 @@ +# This file contains accelerometer test samples +# for TensorFlow magic wand demo encoding the SLOPE motion. +# +# Original data from: +# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.cc +# +# Samples modified to be compatible with +# Arduino Nano 33 BLE board (rotated and inverted channels, each sample repeated 5 times) +# and Renode (samples expressed in floating point numbers in G units). +# + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.709 0.132 0.766 + 0.709 0.132 0.766 + 0.709 0.132 0.766 + 0.709 0.132 0.766 + 0.709 0.132 0.766 + 0.659 0.249 0.751 + 0.659 0.249 0.751 + 0.659 0.249 0.751 + 0.659 0.249 0.751 + 0.659 0.249 0.751 + 0.630 0.314 0.714 + 0.630 0.314 0.714 + 0.630 0.314 0.714 + 0.630 0.314 0.714 + 0.630 0.314 0.714 + 0.623 0.244 0.709 + 0.623 0.244 0.709 + 0.623 0.244 0.709 + 0.623 0.244 0.709 + 0.623 0.244 0.709 + 0.659 0.230 0.707 + 0.659 0.230 0.707 + 0.659 0.230 0.707 + 0.659 0.230 0.707 + 0.659 0.230 0.707 + 0.748 0.202 0.704 + 0.748 0.202 0.704 + 0.748 0.202 0.704 + 0.748 0.202 0.704 + 0.748 0.202 0.704 + 0.728 0.219 0.714 + 0.728 0.219 0.714 + 0.728 0.219 0.714 + 0.728 0.219 0.714 + 0.728 0.219 0.714 + 0.710 0.239 0.722 + 0.710 0.239 0.722 + 0.710 0.239 0.722 + 0.710 0.239 0.722 + 0.710 0.239 0.722 + 0.612 0.116 0.744 + 0.612 0.116 0.744 + 0.612 0.116 0.744 + 0.612 0.116 0.744 + 0.612 0.116 0.744 + 0.570 -0.049 0.753 + 0.570 -0.049 0.753 + 0.570 -0.049 0.753 + 0.570 -0.049 0.753 + 0.570 -0.049 0.753 + 0.527 -0.279 0.748 + 0.527 -0.279 0.748 + 0.527 -0.279 0.748 + 0.527 -0.279 0.748 + 0.527 -0.279 0.748 + 0.592 -0.664 0.668 + 0.592 -0.664 0.668 + 0.592 -0.664 0.668 + 0.592 -0.664 0.668 + 0.592 -0.664 0.668 + 0.609 -0.635 0.601 + 0.609 -0.635 0.601 + 0.609 -0.635 0.601 + 0.609 -0.635 0.601 + 0.609 -0.635 0.601 + 0.606 -0.559 0.509 + 0.606 -0.559 0.509 + 0.606 -0.559 0.509 + 0.606 -0.559 0.509 + 0.606 -0.559 0.509 + 0.536 -0.162 0.286 + 0.536 -0.162 0.286 + 0.536 -0.162 0.286 + 0.536 -0.162 0.286 + 0.536 -0.162 0.286 + 0.495 -0.144 0.255 + 0.495 -0.144 0.255 + 0.495 -0.144 0.255 + 0.495 -0.144 0.255 + 0.495 -0.144 0.255 + 0.495 -0.085 0.209 + 0.495 -0.085 0.209 + 0.495 -0.085 0.209 + 0.495 -0.085 0.209 + 0.495 -0.085 0.209 + 0.698 0.416 -0.006 + 0.698 0.416 -0.006 + 0.698 0.416 -0.006 + 0.698 0.416 -0.006 + 0.698 0.416 -0.006 + 1.117 0.304 0.033 + 1.117 0.304 0.033 + 1.117 0.304 0.033 + 1.117 0.304 0.033 + 1.117 0.304 0.033 + 1.480 0.405 0.082 + 1.480 0.405 0.082 + 1.480 0.405 0.082 + 1.480 0.405 0.082 + 1.480 0.405 0.082 + 1.908 1.008 0.198 + 1.908 1.008 0.198 + 1.908 1.008 0.198 + 1.908 1.008 0.198 + 1.908 1.008 0.198 + 1.743 0.990 0.229 + 1.743 0.990 0.229 + 1.743 0.990 0.229 + 1.743 0.990 0.229 + 1.743 0.990 0.229 + 1.453 0.934 0.234 + 1.453 0.934 0.234 + 1.453 0.934 0.234 + 1.453 0.934 0.234 + 1.453 0.934 0.234 + 0.896 0.838 0.126 + 0.896 0.838 0.126 + 0.896 0.838 0.126 + 0.896 0.838 0.126 + 0.896 0.838 0.126 + 0.911 0.792 0.078 + 0.911 0.792 0.078 + 0.911 0.792 0.078 + 0.911 0.792 0.078 + 0.911 0.792 0.078 + 0.918 0.741 0.027 + 0.918 0.741 0.027 + 0.918 0.741 0.027 + 0.918 0.741 0.027 + 0.918 0.741 0.027 + 0.960 0.734 -0.114 + 0.960 0.734 -0.114 + 0.960 0.734 -0.114 + 0.960 0.734 -0.114 + 0.960 0.734 -0.114 + 0.959 0.613 -0.135 + 0.959 0.613 -0.135 + 0.959 0.613 -0.135 + 0.959 0.613 -0.135 + 0.959 0.613 -0.135 + 1.015 0.426 -0.152 + 1.015 0.426 -0.152 + 1.015 0.426 -0.152 + 1.015 0.426 -0.152 + 1.015 0.426 -0.152 + 1.110 -0.116 -0.106 + 1.110 -0.116 -0.106 + 1.110 -0.116 -0.106 + 1.110 -0.116 -0.106 + 1.110 -0.116 -0.106 + 1.129 -0.314 -0.063 + 1.129 -0.314 -0.063 + 1.129 -0.314 -0.063 + 1.129 -0.314 -0.063 + 1.129 -0.314 -0.063 + 1.179 -0.486 0.012 + 1.179 -0.486 0.012 + 1.179 -0.486 0.012 + 1.179 -0.486 0.012 + 1.179 -0.486 0.012 + 1.510 -0.656 0.118 + 1.510 -0.656 0.118 + 1.510 -0.656 0.118 + 1.510 -0.656 0.118 + 1.510 -0.656 0.118 + 1.553 -0.558 0.116 + 1.553 -0.558 0.116 + 1.553 -0.558 0.116 + 1.553 -0.558 0.116 + 1.553 -0.558 0.116 + 1.367 -0.361 0.126 + 1.367 -0.361 0.126 + 1.367 -0.361 0.126 + 1.367 -0.361 0.126 + 1.367 -0.361 0.126 + 0.922 -0.076 0.222 + 0.922 -0.076 0.222 + 0.922 -0.076 0.222 + 0.922 -0.076 0.222 + 0.922 -0.076 0.222 + 0.971 -0.026 0.210 + 0.971 -0.026 0.210 + 0.971 -0.026 0.210 + 0.971 -0.026 0.210 + 0.971 -0.026 0.210 + 1.053 0.050 0.194 + 1.053 0.050 0.194 + 1.053 0.050 0.194 + 1.053 0.050 0.194 + 1.053 0.050 0.194 + 1.082 0.072 0.178 + 1.082 0.072 0.178 + 1.082 0.072 0.178 + 1.082 0.072 0.178 + 1.082 0.072 0.178 + 1.073 0.100 0.169 + 1.073 0.100 0.169 + 1.073 0.100 0.169 + 1.073 0.100 0.169 + 1.073 0.100 0.169 + 1.050 0.133 0.162 + 1.050 0.133 0.162 + 1.050 0.133 0.162 + 1.050 0.133 0.162 + 1.050 0.133 0.162 + 0.976 0.226 0.156 + 0.976 0.226 0.156 + 0.976 0.226 0.156 + 0.976 0.226 0.156 + 0.976 0.226 0.156 + 0.886 0.323 0.154 + 0.886 0.323 0.154 + 0.886 0.323 0.154 + 0.886 0.323 0.154 + 0.886 0.323 0.154 + 1.154 0.240 0.130 + 1.154 0.240 0.130 + 1.154 0.240 0.130 + 1.154 0.240 0.130 + 1.154 0.240 0.130 + 0.916 0.124 0.116 + 0.916 0.124 0.116 + 0.916 0.124 0.116 + 0.916 0.124 0.116 + 0.916 0.124 0.116 + 0.937 0.124 0.132 + 0.937 0.124 0.132 + 0.937 0.124 0.132 + 0.937 0.124 0.132 + 0.937 0.124 0.132 + 0.981 0.115 0.153 + 0.981 0.115 0.153 + 0.981 0.115 0.153 + 0.981 0.115 0.153 + 0.981 0.115 0.153 + 0.962 0.094 0.184 + 0.962 0.094 0.184 + 0.962 0.094 0.184 + 0.962 0.094 0.184 + 0.962 0.094 0.184 + 1.017 0.085 0.177 + 1.017 0.085 0.177 + 1.017 0.085 0.177 + 1.017 0.085 0.177 + 1.017 0.085 0.177 + 1.027 0.092 0.173 + 1.027 0.092 0.173 + 1.027 0.092 0.173 + 1.027 0.092 0.173 + 1.027 0.092 0.173 + 1.110 0.158 0.168 + 1.110 0.158 0.168 + 1.110 0.158 0.168 + 1.110 0.158 0.168 + 1.110 0.158 0.168 + 1.030 0.101 0.181 + 1.030 0.101 0.181 + 1.030 0.101 0.181 + 1.030 0.101 0.181 + 1.030 0.101 0.181 + 1.054 0.139 0.180 + 1.054 0.139 0.180 + 1.054 0.139 0.180 + 1.054 0.139 0.180 + 1.054 0.139 0.180 + 1.044 0.010 0.152 + 1.044 0.010 0.152 + 1.044 0.010 0.152 + 1.044 0.010 0.152 + 1.044 0.010 0.152 + 1.007 0.074 0.169 + 1.007 0.074 0.169 + 1.007 0.074 0.169 + 1.007 0.074 0.169 + 1.007 0.074 0.169 diff --git a/examples/magic_wand/test_files/circle_rotated.data b/examples/magic_wand/test_files/circle_rotated.data new file mode 100644 index 00000000..ba03bbc9 --- /dev/null +++ b/examples/magic_wand/test_files/circle_rotated.data @@ -0,0 +1,650 @@ +# This file contains accelerometer test samples +# for TensorFlow magic wand demo encoding the RING motion. +# +# Original data from: +# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.cc +# +# Samples modified to be compatible with +# Arduino Nano 33 BLE board (rotated and inverted channels, each sample repeated 5 times) +# and Renode (samples expressed in floating point numbers in G units). +# + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.000 0.000 0.000 + 0.827 0.228 0.665 + 0.827 0.228 0.665 + 0.827 0.228 0.665 + 0.827 0.228 0.665 + 0.827 0.228 0.665 + 0.716 0.339 0.680 + 0.716 0.339 0.680 + 0.716 0.339 0.680 + 0.716 0.339 0.680 + 0.716 0.339 0.680 + 0.812 0.564 0.680 + 0.812 0.564 0.680 + 0.812 0.564 0.680 + 0.812 0.564 0.680 + 0.812 0.564 0.680 + 0.818 0.552 0.679 + 0.818 0.552 0.679 + 0.818 0.552 0.679 + 0.818 0.552 0.679 + 0.818 0.552 0.679 + 0.751 0.528 0.665 + 0.751 0.528 0.665 + 0.751 0.528 0.665 + 0.751 0.528 0.665 + 0.751 0.528 0.665 + 0.618 0.432 0.658 + 0.618 0.432 0.658 + 0.618 0.432 0.658 + 0.618 0.432 0.658 + 0.618 0.432 0.658 + 0.592 0.445 0.655 + 0.592 0.445 0.655 + 0.592 0.445 0.655 + 0.592 0.445 0.655 + 0.592 0.445 0.655 + 0.556 0.484 0.667 + 0.556 0.484 0.667 + 0.556 0.484 0.667 + 0.556 0.484 0.667 + 0.556 0.484 0.667 + 0.510 0.590 0.684 + 0.510 0.590 0.684 + 0.510 0.590 0.684 + 0.510 0.590 0.684 + 0.510 0.590 0.684 + 0.475 0.672 0.674 + 0.475 0.672 0.674 + 0.475 0.672 0.674 + 0.475 0.672 0.674 + 0.475 0.672 0.674 + 0.390 0.786 0.660 + 0.390 0.786 0.660 + 0.390 0.786 0.660 + 0.390 0.786 0.660 + 0.390 0.786 0.660 + 0.128 1.124 0.562 + 0.128 1.124 0.562 + 0.128 1.124 0.562 + 0.128 1.124 0.562 + 0.128 1.124 0.562 + 0.111 1.140 0.526 + 0.111 1.140 0.526 + 0.111 1.140 0.526 + 0.111 1.140 0.526 + 0.111 1.140 0.526 + 0.033 1.044 0.486 + 0.033 1.044 0.486 + 0.033 1.044 0.486 + 0.033 1.044 0.486 + 0.033 1.044 0.486 +-0.134 0.652 0.416 +-0.134 0.652 0.416 +-0.134 0.652 0.416 +-0.134 0.652 0.416 +-0.134 0.652 0.416 +-0.143 0.534 0.390 +-0.143 0.534 0.390 +-0.143 0.534 0.390 +-0.143 0.534 0.390 +-0.143 0.534 0.390 +-0.117 0.381 0.365 +-0.117 0.381 0.365 +-0.117 0.381 0.365 +-0.117 0.381 0.365 +-0.117 0.381 0.365 + 0.094 0.060 0.314 + 0.094 0.060 0.314 + 0.094 0.060 0.314 + 0.094 0.060 0.314 + 0.094 0.060 0.314 + 0.190 0.007 0.322 + 0.190 0.007 0.322 + 0.190 0.007 0.322 + 0.190 0.007 0.322 + 0.190 0.007 0.322 + 0.342 -0.095 0.338 + 0.342 -0.095 0.338 + 0.342 -0.095 0.338 + 0.342 -0.095 0.338 + 0.342 -0.095 0.338 + 0.842 -0.106 0.360 + 0.842 -0.106 0.360 + 0.842 -0.106 0.360 + 0.842 -0.106 0.360 + 0.842 -0.106 0.360 + 0.965 -0.041 0.351 + 0.965 -0.041 0.351 + 0.965 -0.041 0.351 + 0.965 -0.041 0.351 + 0.965 -0.041 0.351 + 0.960 0.012 0.352 + 0.960 0.012 0.352 + 0.960 0.012 0.352 + 0.960 0.012 0.352 + 0.960 0.012 0.352 + 1.124 0.042 0.366 + 1.124 0.042 0.366 + 1.124 0.042 0.366 + 1.124 0.042 0.366 + 1.124 0.042 0.366 + 1.178 0.056 0.322 + 1.178 0.056 0.322 + 1.178 0.056 0.322 + 1.178 0.056 0.322 + 1.178 0.056 0.322 + 1.338 0.015 0.312 + 1.338 0.015 0.312 + 1.338 0.015 0.312 + 1.338 0.015 0.312 + 1.338 0.015 0.312 + 1.532 0.010 0.254 + 1.532 0.010 0.254 + 1.532 0.010 0.254 + 1.532 0.010 0.254 + 1.532 0.010 0.254 + 1.590 0.005 0.241 + 1.590 0.005 0.241 + 1.590 0.005 0.241 + 1.590 0.005 0.241 + 1.590 0.005 0.241 + 1.565 0.060 0.227 + 1.565 0.060 0.227 + 1.565 0.060 0.227 + 1.565 0.060 0.227 + 1.565 0.060 0.227 + 1.560 0.282 0.204 + 1.560 0.282 0.204 + 1.560 0.282 0.204 + 1.560 0.282 0.204 + 1.560 0.282 0.204 + 1.524 0.262 0.180 + 1.524 0.262 0.180 + 1.524 0.262 0.180 + 1.524 0.262 0.180 + 1.524 0.262 0.180 + 1.522 0.385 0.138 + 1.522 0.385 0.138 + 1.522 0.385 0.138 + 1.522 0.385 0.138 + 1.522 0.385 0.138 + 1.626 0.596 0.084 + 1.626 0.596 0.084 + 1.626 0.596 0.084 + 1.626 0.596 0.084 + 1.626 0.596 0.084 + 1.604 0.639 0.055 + 1.604 0.639 0.055 + 1.604 0.639 0.055 + 1.604 0.639 0.055 + 1.604 0.639 0.055 + 1.511 0.771 0.019 + 1.511 0.771 0.019 + 1.511 0.771 0.019 + 1.511 0.771 0.019 + 1.511 0.771 0.019 + 1.132 0.932 -0.016 + 1.132 0.932 -0.016 + 1.132 0.932 -0.016 + 1.132 0.932 -0.016 + 1.132 0.932 -0.016 + 1.013 0.924 -0.015 + 1.013 0.924 -0.015 + 1.013 0.924 -0.015 + 1.013 0.924 -0.015 + 1.013 0.924 -0.015 + 0.812 0.849 -0.001 + 0.812 0.849 -0.001 + 0.812 0.849 -0.001 + 0.812 0.849 -0.001 + 0.812 0.849 -0.001 + 0.500 0.628 0.088 + 0.500 0.628 0.088 + 0.500 0.628 0.088 + 0.500 0.628 0.088 + 0.500 0.628 0.088 + 0.463 0.609 0.114 + 0.463 0.609 0.114 + 0.463 0.609 0.114 + 0.463 0.609 0.114 + 0.463 0.609 0.114 + 0.382 0.559 0.155 + 0.382 0.559 0.155 + 0.382 0.559 0.155 + 0.382 0.559 0.155 + 0.382 0.559 0.155 + 0.278 0.420 0.234 + 0.278 0.420 0.234 + 0.278 0.420 0.234 + 0.278 0.420 0.234 + 0.278 0.420 0.234 + 0.272 0.390 0.254 + 0.272 0.390 0.254 + 0.272 0.390 0.254 + 0.272 0.390 0.254 + 0.272 0.390 0.254 + 0.336 0.200 0.327 + 0.336 0.200 0.327 + 0.336 0.200 0.327 + 0.336 0.200 0.327 + 0.336 0.200 0.327 + 0.630 -0.556 0.558 + 0.630 -0.556 0.558 + 0.630 -0.556 0.558 + 0.630 -0.556 0.558 + 0.630 -0.556 0.558 + 0.740 -0.607 0.640 + 0.740 -0.607 0.640 + 0.740 -0.607 0.640 + 0.740 -0.607 0.640 + 0.740 -0.607 0.640 + 0.868 -0.430 0.706 + 0.868 -0.430 0.706 + 0.868 -0.430 0.706 + 0.868 -0.430 0.706 + 0.868 -0.430 0.706 + 1.042 0.042 0.778 + 1.042 0.042 0.778 + 1.042 0.042 0.778 + 1.042 0.042 0.778 + 1.042 0.042 0.778 + 0.973 0.084 0.763 + 0.973 0.084 0.763 + 0.973 0.084 0.763 + 0.973 0.084 0.763 + 0.973 0.084 0.763 + 0.931 0.185 0.735 + 0.931 0.185 0.735 + 0.931 0.185 0.735 + 0.931 0.185 0.735 + 0.931 0.185 0.735 + 0.766 0.252 0.682 + 0.766 0.252 0.682 + 0.766 0.252 0.682 + 0.766 0.252 0.682 + 0.766 0.252 0.682 + 0.757 0.230 0.673 + 0.757 0.230 0.673 + 0.757 0.230 0.673 + 0.757 0.230 0.673 + 0.757 0.230 0.673 + 0.757 0.218 0.671 + 0.757 0.218 0.671 + 0.757 0.218 0.671 + 0.757 0.218 0.671 + 0.757 0.218 0.671 + 0.714 0.222 0.656 + 0.714 0.222 0.656 + 0.714 0.222 0.656 + 0.714 0.222 0.656 + 0.714 0.222 0.656 + 0.746 0.238 0.659 + 0.746 0.238 0.659 + 0.746 0.238 0.659 + 0.746 0.238 0.659 + 0.746 0.238 0.659 + 0.731 0.276 0.640 + 0.731 0.276 0.640 + 0.731 0.276 0.640 + 0.731 0.276 0.640 + 0.731 0.276 0.640 + 0.754 0.214 0.634 + 0.754 0.214 0.634 + 0.754 0.214 0.634 + 0.754 0.214 0.634 + 0.754 0.214 0.634 + 0.735 0.207 0.637 + 0.735 0.207 0.637 + 0.735 0.207 0.637 + 0.735 0.207 0.637 + 0.735 0.207 0.637 + 0.742 0.194 0.637 + 0.742 0.194 0.637 + 0.742 0.194 0.637 + 0.742 0.194 0.637 + 0.742 0.194 0.637 + 0.716 0.248 0.634 + 0.716 0.248 0.634 + 0.716 0.248 0.634 + 0.716 0.248 0.634 + 0.716 0.248 0.634 + 0.697 0.265 0.631 + 0.697 0.265 0.631 + 0.697 0.265 0.631 + 0.697 0.265 0.631 + 0.697 0.265 0.631 + 0.797 0.252 0.628 + 0.797 0.252 0.628 + 0.797 0.252 0.628 + 0.797 0.252 0.628 + 0.797 0.252 0.628 + 0.816 0.204 0.592 + 0.816 0.204 0.592 + 0.816 0.204 0.592 + 0.816 0.204 0.592 + 0.816 0.204 0.592 + 0.812 0.218 0.618 + 0.812 0.218 0.618 + 0.812 0.218 0.618 + 0.812 0.218 0.618 + 0.812 0.218 0.618 + 0.828 0.231 0.633 + 0.828 0.231 0.633 + 0.828 0.231 0.633 + 0.828 0.231 0.633 + 0.828 0.231 0.633 + 0.736 0.222 0.640 + 0.736 0.222 0.640 + 0.736 0.222 0.640 + 0.736 0.222 0.640 + 0.736 0.222 0.640 + 0.787 0.221 0.634 + 0.787 0.221 0.634 + 0.787 0.221 0.634 + 0.787 0.221 0.634 + 0.787 0.221 0.634 diff --git a/examples/micro_speech/micro_speech.robot b/examples/micro_speech/micro_speech.robot new file mode 100644 index 00000000..1e4cf425 --- /dev/null +++ b/examples/micro_speech/micro_speech.robot @@ -0,0 +1,27 @@ +*** Settings *** +Suite Setup Setup +Suite Teardown Teardown +Test Setup Reset Emulation +Test Teardown Test Teardown +Resource ${RENODEKEYWORDS} + +*** Variables *** +${UART} sysbus.uart0 + +*** Keywords *** +Create Machine + Execute Command mach create + Execute Command machine LoadPlatformDescription @platforms/boards/arduino_nano_33_ble.repl + + Execute Command sysbus LoadELF @${CURDIR}/output/micro_speech.ino.elf + +*** Test Cases *** +Should Detect Yes Pattern + Create Machine + Execute Command sysbus.pdm SetInputFile @${CURDIR}/test_files/audio_yes_1s.s16le.pcm + + Create Terminal Tester ${UART} + Execute Command machine EnableProfiler @${CURDIR}/micro_speech.dump + Start Emulation + + Wait For Line On Uart Heard yes diff --git a/examples/micro_speech/test_files/README b/examples/micro_speech/test_files/README new file mode 100644 index 00000000..314ffdb2 --- /dev/null +++ b/examples/micro_speech/test_files/README @@ -0,0 +1 @@ +The `audio_yes_1s.s16le.pcm` file was originally downloaded (and adapted) from https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/examples/micro_speech diff --git a/examples/micro_speech/test_files/audio_yes_1s.s16le.pcm b/examples/micro_speech/test_files/audio_yes_1s.s16le.pcm new file mode 100644 index 00000000..3fa74a6f Binary files /dev/null and b/examples/micro_speech/test_files/audio_yes_1s.s16le.pcm differ diff --git a/examples/person_detection/person_detection.robot b/examples/person_detection/person_detection.robot new file mode 100644 index 00000000..a3b8c2c1 --- /dev/null +++ b/examples/person_detection/person_detection.robot @@ -0,0 +1,60 @@ +*** Settings *** +Suite Setup Setup +Suite Teardown Teardown +Test Setup Reset Emulation +Test Teardown Test Teardown +Resource ${RENODEKEYWORDS} + +*** Keywords *** +Should Run Detection + Wait For Line On Uart Attempting to start Arducam + Wait For Line On Uart Starting capture + Wait For Line On Uart Image captured + Wait For Line On Uart Reading \\d+ bytes from Arducam treatAsRegex=true + Wait For Line On Uart Finished reading + Wait For Line On Uart Decoding JPEG and converting to greyscale + Wait For Line On Uart Image decoded and processed + ${l}= Wait For Line On Uart Person score: (-?\\d+) No person score: (-?\\d+) treatAsRegex=true + ${s}= Evaluate int(${l.groups[0]}) - int(${l.groups[1]}) + + [return] ${s} + +Run Test + [Arguments] ${image} + + Execute Command Clear + Execute Command mach create + Execute Command machine LoadPlatformDescription @platforms/boards/arduino_nano_33_ble.repl + Execute Command sysbus LoadELF @${CURDIR}/output/person_detection.ino.elf + + Create Terminal Tester sysbus.uart0 + Execute Command sysbus.spi2.camera ImageSource @${image} + Execute Command machine EnableProfiler "${CURDIR}/person_detection.dump" + Start Emulation + +Detect Template + [Arguments] ${image} + + Run Test ${image} + ${r}= Should Run Detection + Should Be True ${r} > 30 + +No Detect Template + [Arguments] ${image} + + Run Test ${image} + ${r}= Should Run Detection + Should Be True ${r} < -30 + +*** Test Cases *** +Should Detect Person + [Template] Detect Template + + ${CURDIR}/test_files/person_image_0.jpg + ${CURDIR}/test_files/person_image_1.jpg + +Should Not Detect Person + [Template] No Detect Template + + ${CURDIR}/test_files/no_person_image_0.jpg + ${CURDIR}/test_files/no_person_image_1.jpg diff --git a/examples/person_detection/test_files/README b/examples/person_detection/test_files/README new file mode 100644 index 00000000..a734145b --- /dev/null +++ b/examples/person_detection/test_files/README @@ -0,0 +1,9 @@ +The following files were originally downloaded (and later resized and converted) from https://unsplash.com/: +* no_person_image_0.jpg +* no_person_image_1.jpg +* person_image_0.jpg +* person_image_1.jpg + +This is the Unsplash license (https://unsplash.com/license): + +Unsplash grants you an irrevocable, nonexclusive, worldwide copyright license to download, copy, modify, distribute, perform, and use photos from Unsplash for free, including for commercial purposes, without permission from or attributing the photographer or Unsplash. This license does not include the right to compile photos from Unsplash to replicate a similar or competing service. diff --git a/examples/person_detection/test_files/no_person_image_0.jpg b/examples/person_detection/test_files/no_person_image_0.jpg new file mode 100644 index 00000000..08cb8a7a Binary files /dev/null and b/examples/person_detection/test_files/no_person_image_0.jpg differ diff --git a/examples/person_detection/test_files/no_person_image_1.jpg b/examples/person_detection/test_files/no_person_image_1.jpg new file mode 100644 index 00000000..94fc5cee Binary files /dev/null and b/examples/person_detection/test_files/no_person_image_1.jpg differ diff --git a/examples/person_detection/test_files/person_image_0.jpg b/examples/person_detection/test_files/person_image_0.jpg new file mode 100644 index 00000000..0935bd31 Binary files /dev/null and b/examples/person_detection/test_files/person_image_0.jpg differ diff --git a/examples/person_detection/test_files/person_image_1.jpg b/examples/person_detection/test_files/person_image_1.jpg new file mode 100644 index 00000000..89b24e55 Binary files /dev/null and b/examples/person_detection/test_files/person_image_1.jpg differ diff --git a/scripts/test_arduino_library.sh b/scripts/test_arduino_library.sh index c6cccd62..33faab98 100755 --- a/scripts/test_arduino_library.sh +++ b/scripts/test_arduino_library.sh @@ -60,8 +60,12 @@ InstallLibraryDependencies () { InstallLibraryDependencies for f in ${ARDUINO_LIBRARIES_DIR}/${LIBRARY_NAME}/examples/*/*.ino; do - echo "compiling $(basename ${f} .ino)" + EXAMPLE_NAME=$(basename ${f} .ino) + EXAMPLE_BINARIES=examples/${EXAMPLE_NAME}/output + mkdir -p ${EXAMPLE_BINARIES} + echo "compiling ${EXAMPLE_NAME}" ${ARDUINO_CLI_TOOL} compile --build-cache-path ${TEMP_BUILD_DIR} --build-path ${TEMP_BUILD_DIR} --fqbn arduino:mbed:nano33ble $f + cp ${TEMP_BUILD_DIR}/${EXAMPLE_NAME}.ino.* ${EXAMPLE_BINARIES} done rm -rf ${ARDUINO_LIBRARIES_DIR}