|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2019 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 | +# Called with following arguments: |
| 18 | +# 1 - Path to the downloads folder which is typically |
| 19 | +# tensorflow/lite/micro/tools/make/downloads |
| 20 | +# |
| 21 | +# This script is called from the Makefile and uses the following convention to |
| 22 | +# enable determination of sucess/failure: |
| 23 | +# |
| 24 | +# - If the script is successful, the only output on stdout should be SUCCESS. |
| 25 | +# The makefile checks for this particular string. |
| 26 | +# |
| 27 | +# - Any string on stdout that is not SUCCESS will be shown in the makefile as |
| 28 | +# the cause for the script to have failed. |
| 29 | +# |
| 30 | +# - Any other informational prints should be on stderr. |
| 31 | + |
| 32 | +set -e |
| 33 | + |
| 34 | +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 35 | +ROOT_DIR=${SCRIPT_DIR}/../../../../../.. |
| 36 | +cd "${ROOT_DIR}" |
| 37 | + |
| 38 | +source tensorflow/lite/micro/tools/make/bash_helpers.sh |
| 39 | + |
| 40 | +DOWNLOADS_DIR=${1} |
| 41 | +if [ ! -d ${DOWNLOADS_DIR} ]; then |
| 42 | + echo "The top-level downloads directory: ${DOWNLOADS_DIR} does not exist." |
| 43 | + exit 1 |
| 44 | +fi |
| 45 | + |
| 46 | +DOWNLOADED_CMSIS_PATH=${DOWNLOADS_DIR}/cmsis |
| 47 | + |
| 48 | +if [ -d ${DOWNLOADED_CMSIS_PATH} ]; then |
| 49 | + echo >&2 "${DOWNLOADED_CMSIS_PATH} already exists, skipping the download." |
| 50 | +else |
| 51 | + |
| 52 | + ZIP_PREFIX="01f5b32badf7b78c85a24a7149b56400fa6a2999" |
| 53 | + CMSIS_URL="http://github.com/ARM-software/CMSIS_5/archive/${ZIP_PREFIX}.zip" |
| 54 | + CMSIS_MD5="823916c6f1749c65fd0bfdeec20b30ed" |
| 55 | + |
| 56 | + # wget is much faster than git clone of the entire repo. So we wget a specific |
| 57 | + # version and can then apply a patch, as needed. |
| 58 | + wget ${CMSIS_URL} -O /tmp/${ZIP_PREFIX}.zip >&2 |
| 59 | + check_md5 /tmp/${ZIP_PREFIX}.zip ${CMSIS_MD5} |
| 60 | + |
| 61 | + unzip -qo /tmp/${ZIP_PREFIX}.zip -d /tmp >&2 |
| 62 | + mv /tmp/CMSIS_5-${ZIP_PREFIX} ${DOWNLOADED_CMSIS_PATH} |
| 63 | +fi |
| 64 | + |
| 65 | +echo "SUCCESS" |
0 commit comments