1#!/usr/bin/env bash
2# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ==============================================================================
16#
17# Tests the microcontroller code for esp32 platform
18
19set -e
20
21SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22ROOT_DIR=${SCRIPT_DIR}/../../../../..
23cd "${ROOT_DIR}"
24pwd
25
26source tensorflow/lite/micro/tools/ci_build/helper_functions.sh
27
28TARGET=esp
29TARGET_ARCH=xtensa-esp32
30
31readable_run make -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} third_party_downloads
32
33# clean all
34readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
35
36# validate esp32 build for libtensorflow-microlite.a
37readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_TOOLCHAIN_PREFIX=xtensa-esp32-elf-
38
39# generate examples
40readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} generate_hello_world_esp_project
41
42# readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} generate_person_detection_int8_esp_project
43
44readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} generate_micro_speech_esp_project
45
46# build examples
47cd "${ROOT_DIR}"/tensorflow/lite/micro/tools/make/gen/esp_xtensa-esp32_default/prj/hello_world/esp-idf
48readable_run idf.py build
49
50#cd "${ROOT_DIR}"/tensorflow/lite/micro/tools/make/gen/esp_xtensa-esp32_default/prj/person_detection_int8/esp-idf
51#readable_run git clone https://github.com/espressif/esp32-camera.git components/esp32-camera
52#cd components/esp32-camera/
53#readable_run git checkout eacd640b8d379883bff1251a1005ebf3cf1ed95c
54#cd ../../
55#readable_run idf.py build
56
57cd "${ROOT_DIR}"/tensorflow/lite/micro/tools/make/gen/esp_xtensa-esp32_default/prj/micro_speech/esp-idf
58readable_run idf.py build
59
60