xref: /aosp_15_r20/system/chre/external/tflm/tflm_sync_srcs.sh (revision 84e339476a462649f82315436d70fd732297a399)
1*84e33947SAndroid Build Coastguard Worker#!/bin/bash
2*84e33947SAndroid Build Coastguard Worker# This script syncs latest TFLM code to the `latest` folder.
3*84e33947SAndroid Build Coastguard Worker
4*84e33947SAndroid Build Coastguard WorkerDEST_PATH=`dirname "${BASH_SOURCE[0]}"`/latest
5*84e33947SAndroid Build Coastguard Worker
6*84e33947SAndroid Build Coastguard Worker# Quit if a command fails.
7*84e33947SAndroid Build Coastguard Workerset -e
8*84e33947SAndroid Build Coastguard Worker
9*84e33947SAndroid Build Coastguard Worker# Option to remove DEST_PATH before syncing. This helps to identify files
10*84e33947SAndroid Build Coastguard Worker# that are checked in but no longer needed by the nanoapp.
11*84e33947SAndroid Build Coastguard Workerread -p "Do you want to remove destination $DEST_PATH before proceeding? y/n "
12*84e33947SAndroid Build Coastguard Workerif [ $REPLY == "y" ]
13*84e33947SAndroid Build Coastguard Workerthen
14*84e33947SAndroid Build Coastguard Worker  rm -rfv $DEST_PATH
15*84e33947SAndroid Build Coastguard Workerfi
16*84e33947SAndroid Build Coastguard Worker
17*84e33947SAndroid Build Coastguard WorkerREAL_DEST_PATH=`realpath $DEST_PATH`
18*84e33947SAndroid Build Coastguard Worker
19*84e33947SAndroid Build Coastguard Workerpushd /tmp
20*84e33947SAndroid Build Coastguard Worker
21*84e33947SAndroid Build Coastguard Worker# Remove previous checkout if any
22*84e33947SAndroid Build Coastguard Workerrm -rf tflm
23*84e33947SAndroid Build Coastguard Worker
24*84e33947SAndroid Build Coastguard Worker# Check out tensorflow
25*84e33947SAndroid Build Coastguard Workergit clone https://github.com/tensorflow/tensorflow.git --depth=1 tflm
26*84e33947SAndroid Build Coastguard Worker
27*84e33947SAndroid Build Coastguard Worker# Generate chre related files
28*84e33947SAndroid Build Coastguard Workercd tflm
29*84e33947SAndroid Build Coastguard Workermake -f tensorflow/lite/micro/tools/make/Makefile TARGET=chre generate_hello_world_make_project
30*84e33947SAndroid Build Coastguard Workerrm -rf gen/chre_x86_64/prj/hello_world/make/tensorflow/lite/micro/examples
31*84e33947SAndroid Build Coastguard Worker
32*84e33947SAndroid Build Coastguard Worker# Remove the destination folder
33*84e33947SAndroid Build Coastguard Workerrm -rf $REAL_DEST_PATH
34*84e33947SAndroid Build Coastguard Worker
35*84e33947SAndroid Build Coastguard Worker# Copy files over
36*84e33947SAndroid Build Coastguard Workercp -r gen/chre_x86_64/prj/hello_world/make $REAL_DEST_PATH
37*84e33947SAndroid Build Coastguard Worker
38*84e33947SAndroid Build Coastguard Worker# Done
39*84e33947SAndroid Build Coastguard Workerecho "TFLM code sync'ed"
40*84e33947SAndroid Build Coastguard Worker
41*84e33947SAndroid Build Coastguard Workerpopd