1#!/bin/bash 2# This script syncs latest TFLM code to the `latest` folder. 3 4DEST_PATH=`dirname "${BASH_SOURCE[0]}"`/latest 5 6# Quit if a command fails. 7set -e 8 9# Option to remove DEST_PATH before syncing. This helps to identify files 10# that are checked in but no longer needed by the nanoapp. 11read -p "Do you want to remove destination $DEST_PATH before proceeding? y/n " 12if [ $REPLY == "y" ] 13then 14 rm -rfv $DEST_PATH 15fi 16 17REAL_DEST_PATH=`realpath $DEST_PATH` 18 19pushd /tmp 20 21# Remove previous checkout if any 22rm -rf tflm 23 24# Check out tensorflow 25git clone https://github.com/tensorflow/tensorflow.git --depth=1 tflm 26 27# Generate chre related files 28cd tflm 29make -f tensorflow/lite/micro/tools/make/Makefile TARGET=chre generate_hello_world_make_project 30rm -rf tensorflow/lite/micro/tools/make/gen/chre_x86_64/prj/hello_world/make/tensorflow/lite/micro/examples 31 32# Remove the destination folder 33rm -rf $REAL_DEST_PATH 34 35# Copy files over 36cp -r tensorflow/lite/micro/tools/make/gen/chre_x86_64/prj/hello_world/make $REAL_DEST_PATH 37 38# Done 39echo "TFLM code sync'ed" 40 41popd