- Software Emulation with Renode
- Installation
- Running Unit Tests
- Running a non-test Binary with Renode
- Useful External Links for Renode and Robot Documentation
TensorFlow Lite Micro makes use of Renode to for software emulation.
Here, we document how Renode is used as part of the TFLM project. For more general use of Renode, please refer to the Renode documentation.
You can also read more about Renode from a publicly available slide deck.
Renode can be installed and used in a variety of ways, as documented in the Renode README. For the purpose of Tensorflow Lite Micro, we make use of the portable version for Linux.
Portable renode will be automatically installed when using the TfLite Micro
Makefile to tensorflow/lite/micro/tools/make/downloads/renode
.
The Makefile internally calls the renode_download.sh
script:
tensorflow/lite/micro/tools/make/renode_download.sh tensorflow/lite/micro/tools/make/downloads
All the tests for a specific platform (e.g. bluepill) can be run with:
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=bluepill test
- This makes use of the robot framework from Renode.
- Note that the tests can currently not be run in parallel.
- It takes about 25 second to complete all tests, including around 3 seconds for suite startup/teardown and average 0.38 second per test.
Describe how we wait for a particular string on the UART. Some pointers into the robot files as well as any relevant documentation from Renode.
A test failure is the absence of a specific string on the UART so the test will wait for a specific timeout period (configured in the .robot) file before failing.
-
What this means in practice is that a failing test will take longer to finish than a test that passes.
-
If needed, an optimization on this would be to have a specific failure message as well so that both success and failure can be detected quickly.
Renode can also be used to run and debug binaries interactively. For example,
to debug kernel_addr_test
on Bluepill platform, run Renode:
tensorflow/lite/micro/tools/make/downloads/renode/renode
and issue following commands:
# Create platform
include @tensorflow/lite/micro/testing/bluepill_nontest.resc
# Load ELF file
sysbus LoadELF @gen/bluepill_x86_64_default/bin/kernel_add_test
# Start simulation
start
# To run again:
Clear
include @tensorflow/lite/micro/testing/bluepill_nontest.resc
sysbus LoadELF @gen/bluepill_cortex-m3_default/bin/keyword_benchmark
start
To make repeat runs a bit easier, you can put all the commands into a single line (up arrow will show the last command in the Renode terminal):
Clear; include @tensorflow/lite/micro/testing/bluepill_nontest.resc; sysbus LoadELF @gen/bluepill_x86_64_default/bin/kernel_add_test; start
You can also connect GDB to the simulation.
To do that, start the GDB server in Renode before issuing the start
command:
machine StartGdbServer 3333
Than you can connect from GDB with:
target remote localhost:3333
For further reference please see the Renode documentation.
-
Robot Testing Framework on Github. For someone new to the Robot Framework, the documentation can be a bit hard to navigate, so here are some links that are relevant to the use of the Robot Framework with Renode for TFLM:
-
Creating Test Data section of the user guide.
-
Renode-specific additions to the Robot test description format are in the RobotFrameworkEngine directory. For example,
- Start Emulation
- Wait For Line On Uart
is where
Wait For Line On Uart
is defined.
-
Some documentation for all the Standard Libraries that define commands such as:
-