This is a template project for developing a Riotee application. The Makefile-based project optionally supports Visual Studio Code.
Follow the instructions to create TFLM files.
git clone [email protected]:tensorflow/tflite-micro.git
Create the lib and copy it from gen/cortex_m_generic_cortex-m4+fp_default/lib
into root directory.
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4+fp OPTIMIZED_KERNEL_DIR=cmsis_nn TARGET_TOOLCHAIN_ROOT=[PATH TO TOOLCHAIN] microlite
Create tenserflow src and headers. Copy ./tree
to root directory and rename it to tensorflow
:
python tensorflow/lite/micro/tools/project_generation/create_tflm_tree.py ./tree --rename_cc_to_cpp --makefile_options "TARGET=cortex_m_generic TARGET_ARCH=cortex-m4+fp OPTIMIZED_KERNEL_DIR=cmsis_nn TARGET_TOOLCHAIN_ROOT=[PATH TO TOOLCHAIN]"
Follow the instructions to install the Riotee SDK and its dependencies to a location on your computer.
If you want to develop your application in a GitHub repository, make sure you're signed in to GitHub and click on the green Use this template
button on this repository's GitHub page to create your own repository from this template.
Give your repository a name, for example, my-riotee-app
.
Clone your new repository using its URL.
git clone [email protected]:yourusername/my-riotee-app.git
If you're not using GitHub, you can download this template by clicking on Code->Download Zip
on the repository's GitHub page and extracting the downloaded file to a location on your computer.
If you're planning to use Visual Studio Code for development you can skip this step and continue reading here.
If you want to build the project from the commandline or some other IDE, set an environment variable called RIOTEE_SDK_ROOT
to the corresponding path on your machine.
export RIOTEE_SDK_ROOT=[PATH TO RIOTEE SDK]
If the arm-none-eabi-gcc toolchain is not on your path, point to it with another environment variable:
export GNU_INSTALL_ROOT=[PATH TO TOOLCHAIN]
As an alternative to these environment variables, you can also set the two variables at the top of the project's Makefile.
Now build the project and upload it to your Riotee device with
make flash
- Install Visual Studio Code from the official website and open it.
- On the left panel select
Extensions
, search for theC/C++ Extension Pack
and install it. - Open the project's folder via
File->Open Folder
.
Adjust the three configuration keys in .vscode/settings.json according to your setup:
rioteeSdkRoot
: Path to the Riotee SDKoperSys
: Mac, Linux or Win32gnuInstallRoot
: Location of arm-none-eabi toolchain, leave empty if it is in yourPATH
variable already.
Restart Visual Studio Code.
Open main.c
and check that code-completion works and that all imports are correctly resolved. For example, selecting riotee_wait_cap_charged()
and pressing F12
should take you straight into the SDK's code.
If you installed the riotee-probe
Python package into a virtual environment when setting up the SDK, press Ctrl
+Shift
+p
, search for Python: Select Interpreter
, and point it to the Python executable of your virtual environment.
To install keyboard shortcuts, press Ctrl
+Shift
+p
, type Open Keyboard Shortcuts (JSON)
and press Enter
, insert the following keybindings and save the file:
{
"key": "ctrl+alt+b",
"command": "workbench.action.tasks.runTask",
"args": "build"
},
{
"key": "ctrl+alt+c",
"command": "workbench.action.tasks.runTask",
"args": "clean"
},
{
"key": "ctrl+alt+u",
"command": "workbench.action.tasks.runTask",
"args": "flash"
},
Now you can conveniently build, clean and flash the code using the corresponding keyboard shortcuts.