configure_avh.sh 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # Copyright (c) 2022 Arm Limited and Contributors. All rights reserved.
  3. # Licensed to the Apache Software Foundation (ASF) under one
  4. # or more contributor license agreements. See the NOTICE file
  5. # distributed with this work for additional information
  6. # regarding copyright ownership. The ASF licenses this file
  7. # to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance
  9. # with the License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing,
  14. # software distributed under the License is distributed on an
  15. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. # KIND, either express or implied. See the License for the
  17. # specific language governing permissions and limitations
  18. # under the License.
  19. set -e
  20. set -u
  21. set -o pipefail
  22. # Show usage
  23. function show_usage() {
  24. cat <<EOF
  25. Usage: Set up running environment by installing the required prerequisites.
  26. -h, --help
  27. Display this help message.
  28. EOF
  29. }
  30. if [ "$#" -eq 1 ] && [ "$1" == "--help" -o "$1" == "-h" ]; then
  31. show_usage
  32. exit 0
  33. elif [ "$#" -ge 1 ]; then
  34. show_usage
  35. exit 1
  36. fi
  37. echo -e "\e[36mStart setting up running environment\e[0m"
  38. # Install CMSIS
  39. echo -e "\e[36mStart installing CMSIS\e[0m"
  40. CMSIS_PATH="/opt/arm/ethosu/cmsis"
  41. mkdir -p "${CMSIS_PATH}"
  42. CMSIS_SHA="977abe9849781a2e788b02282986480ff4e25ea6"
  43. CMSIS_SHASUM="86c88d9341439fbb78664f11f3f25bc9fda3cd7de89359324019a4d87d169939eea85b7fdbfa6ad03aa428c6b515ef2f8cd52299ce1959a5444d4ac305f934cc"
  44. CMSIS_URL="http://github.com/ARM-software/CMSIS_5/archive/${CMSIS_SHA}.tar.gz"
  45. DOWNLOAD_PATH="/tmp/${CMSIS_SHA}.tar.gz"
  46. wget ${CMSIS_URL} -O "${DOWNLOAD_PATH}"
  47. echo "$CMSIS_SHASUM" ${DOWNLOAD_PATH} | sha512sum -c
  48. tar -xf "${DOWNLOAD_PATH}" -C "${CMSIS_PATH}" --strip-components=1
  49. touch "${CMSIS_PATH}"/"${CMSIS_SHA}".sha
  50. echo -e "\e[36mCMSIS Installation SUCCESS\e[0m"
  51. # Install Arm(R) Ethos(TM)-U NPU driver stack
  52. echo -e "\e[36mStart installing Arm(R) Ethos(TM)-U NPU driver stack\e[0m"
  53. git clone "https://review.mlplatform.org/ml/ethos-u/ethos-u-core-platform" /opt/arm/ethosu/core_platform
  54. cd /opt/arm/ethosu/core_platform
  55. git checkout tags/"21.11"
  56. echo -e "\e[36mArm(R) Ethos(TM)-U Core Platform Installation SUCCESS\e[0m"
  57. # Install Arm(R) GNU Toolchain
  58. echo -e "\e[36mStart installing Arm(R) GNU Toolchain\e[0m"
  59. mkdir -p /opt/arm/gcc-arm-none-eabi
  60. export gcc_arm_url='https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A'
  61. curl --retry 64 -sSL ${gcc_arm_url} | tar -C /opt/arm/gcc-arm-none-eabi --strip-components=1 -jx
  62. export PATH=/opt/arm/gcc-arm-none-eabi/bin:$PATH
  63. arm-none-eabi-gcc --version
  64. arm-none-eabi-g++ --version
  65. echo -e "\e[36mArm(R) Arm(R) GNU Toolchain Installation SUCCESS\e[0m"
  66. # Install TVM from TLCPack
  67. echo -e "\e[36mStart installing TVM\e[0m"
  68. pip install tlcpack-nightly -f https://tlcpack.ai/wheels
  69. echo -e "\e[36mTVM Installation SUCCESS\e[0m"