Page MenuHomePhabricator

Zephyr and Tensorflow Micro
Updated 1,462 Days AgoPublic

Version 6 of 6: You are viewing the current published version of this document.

The page is dedicated to the mixture of Zephyr an RTOS and Tensorflow Micro a subset of the Tensorflow project for Microcontrollers.

Tensorflow as it exists currently doesn't support Zephyr and vise versa so the instructions and code below is a work in progress and not yet pushed upstream.

Howto

This howto is currently specific to the STM32F746ng board and
only gets the Tensorflow Lite Micro Hello World example running on the board with Zephyr.

Download and Setup Zephyr

git clone https://github.com/zephyrproject-rtos/zephyr.git

sudo pip3 install west
sudo pip3 install cmake
install Zephyr SDK
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.10.3/zephyr-sdk-0.10.3-setup.run
chmod +x zephyr-sdk-0.10.3-setup.run
./zephyr-sdk-0.10.3-setup.run -- -d /opt/zephyr-sdk
sudo pip3 install -r zephyr/scripts/requirements.txt

export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk

cd zephyr
cd zephyr-project

Download tensorflow with experimental zephyr support
git clone https://github.com/tom-gall/tensorflow.git
cd tensorflow
git checkout disco_f746ng_hello

make -f tensorflow/lite/micro/tools/make/Makefile TARGET=zephyr-disco_f746ng hello_world_bin

The resulting binary is tensorflow/lite/micro/tools/make/gen/zephyr-disco_f746ng_x86_64/hello_world/CMake/zephyr/zephyr.bin

Connect the USB cable to the board, mount the device and copy over the binary
(dmesg will show you what device the USB storage device is visible as)

Ex: mount /dev/sdb /t
cp tensorflow/lite/micro/tools/make/gen/zephyr-disco_f746ng_x86_64/hello_world/CMake/zephyr/zephyr.bin /t/.

The board will reboot and run your binary.

Connect minicom to /dev/ACM0 to see output.

Todo
redo LCD code so it uses Zephyr stack
enable CMSIS

Last Author
tom-gall
Last Edited
Mar 27 2020, 8:08 PM

Event Timeline

tom-gall edited the content of this document. (Show Details)Mar 26 2020, 6:56 PM
tom-gall published a new version of this document.
tom-gall edited the content of this document. (Show Details)Mar 26 2020, 7:03 PM
tom-gall edited the content of this document. (Show Details)Mar 26 2020, 7:22 PM
tom-gall edited the content of this document. (Show Details)
tom-gall edited the content of this document. (Show Details)Mar 27 2020, 8:08 PM
spoonix changed the visibility from "All Users" to "Public (No Login Required)".Apr 1 2020, 12:17 PM