am64x/am243x/am263x : initial commit for motor control sdk setup scripts

Initial commit for motor control sdk setup scripts

Fixes: PINDSW-5641

Signed-off-by: Naresh A <nareshk@ti.com>
This commit is contained in:
Naresh A 2023-07-05 13:54:04 +05:30
commit 9d77903d58
10 changed files with 817 additions and 0 deletions

1
LICENSE.md Normal file
View File

@ -0,0 +1 @@
Please refer to docs/manifest.html for license information.

27
README.md Normal file
View File

@ -0,0 +1,27 @@
<div align="center">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/ba/TexasInstruments-Logo.svg" width="150">
# Motor Control SDK SETUP
</div>
## Introduction
Motor Control SDK SETUP is an auxiliary repository to help setup the [Motor Control SDK](https://github.com/TexasInstruments/motor-control-sdk)
for build. This repo mainly contains shell scripts which will download and install the dependencies
for Motor Control SDK which includes but are not limited to:
- Code Composer Studio
- TI ARM CLANG
- SysConfig
- NodeJS and required packages
Currently the scripts only support a Linux / Git Bash environment. Support will
be added soon for Windows native environment.
## Usage in Motor Control SDK
This repo is meant to be used with Motor Control SDK repo for installing the dependencies.
Refer [Motor Control SDK Core repository](https://github.com/TexasInstruments/motor-control-sdk) for
more details regarding the Motor Control SDK.

View File

@ -0,0 +1,54 @@
#!/bin/bash
#
# Script to download and install Motor Control SDK baselined components
#
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--motor_control_folder=*)
motor_control_folder="${1#*=}"
shift # past argument
;;
--install_dir=*)
install_dir="${1#*=}"
shift # past argument
;;
--skip_nodejs=*)
skip_nodejs="${1#*=}"
shift # past argument
;;
--skip_doxygen=*)
skip_doxygen="${1#*=}"
shift # past argument
;;
-h|--help)
echo Usage: $0 [options]
echo
echo Options
echo "--motor_control_folder Path to the Motor Control SDK folder. Default value is motor_control_sdk"
echo "--install_dir Path where the tools should be installed. Default value is "${HOME}/ti""
echo "--skip_nodejs Pass "--skip_nodejs=true" to skip nodejs installation. Default value is false."
echo "--skip_doxygen Pass "--skip_doxygen=true" to skip doxygen installation. Default value is false."
exit 0
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
: ${motor_control_folder:="motor_control_sdk"}
: ${install_dir:="${HOME}/ti"}
: ${skip_nodejs:="false"}
: ${skip_doxygen:="false"}
release_version=09_00_00
product_family="am243x"
THIS_DIR=$(dirname $(realpath $0))
BASE_DIR=$(realpath ${THIS_DIR}/..)
script=${BASE_DIR}/releases/${release_version}/${product_family}/download_components.sh
#Reuse current release version download script
echo "Invoking ${script}"
${script} --motor_control_folder="${motor_control_folder}" --install_dir="${install_dir}" --skip_nodejs="${skip_nodejs}" --skip_doxygen="${skip_doxygen}"

View File

@ -0,0 +1,54 @@
#!/bin/bash
#
# Script to download and install Motor Control SDK baselined components
#
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--motor_control_folder=*)
motor_control_folder="${1#*=}"
shift # past argument
;;
--install_dir=*)
install_dir="${1#*=}"
shift # past argument
;;
--skip_nodejs=*)
skip_nodejs="${1#*=}"
shift # past argument
;;
--skip_doxygen=*)
skip_doxygen="${1#*=}"
shift # past argument
;;
-h|--help)
echo Usage: $0 [options]
echo
echo Options
echo "--motor_control_folder Path to the Motor Control SDK folder. Default value is motor_control_sdk"
echo "--install_dir Path where the tools should be installed. Default value is "${HOME}/ti""
echo "--skip_nodejs Pass "--skip_nodejs=true" to skip nodejs installation. Default value is false."
echo "--skip_doxygen Pass "--skip_doxygen=true" to skip doxygen installation. Default value is false."
exit 0
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
: ${motor_control_folder:="motor_control_sdk"}
: ${install_dir:="${HOME}/ti"}
: ${skip_nodejs:="false"}
: ${skip_doxygen:="false"}
release_version=09_00_00
product_family="am263x"
THIS_DIR=$(dirname $(realpath $0))
BASE_DIR=$(realpath ${THIS_DIR}/..)
script=${BASE_DIR}/releases/${release_version}/${product_family}/download_components.sh
#Reuse current release version download script
echo "Invoking ${script}"
${script} --motor_control_folder="${motor_control_folder}" --install_dir="${install_dir}" --skip_nodejs="${skip_nodejs}" --skip_doxygen="${skip_doxygen}"

View File

@ -0,0 +1,55 @@
#!/bin/bash
#
# Script to download and install Motor Control SDK baselined components
#
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--motor_control_folder=*)
motor_control_folder="${1#*=}"
shift # past argument
;;
--install_dir=*)
install_dir="${1#*=}"
shift # past argument
;;
--skip_nodejs=*)
skip_nodejs="${1#*=}"
shift # past argument
;;
--skip_doxygen=*)
skip_doxygen="${1#*=}"
shift # past argument
;;
-h|--help)
echo Usage: $0 [options]
echo
echo Options
echo "--motor_control_folder Path to the Motor Control SDK folder. Default value is motor_control_sdk"
echo "--install_dir Path where the tools should be installed. Default value is "${HOME}/ti""
echo "--skip_nodejs Pass "--skip_nodejs=true" to skip nodejs installation. Default value is false."
echo "--skip_doxygen Pass "--skip_doxygen=true" to skip doxygen installation. Default value is false."
exit 0
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
: ${motor_control_folder:="motor_control_sdk"}
: ${install_dir:="${HOME}/ti"}
: ${skip_nodejs:="false"}
: ${skip_doxygen:="false"}
release_version=09_00_00
product_family="am64x"
THIS_DIR=$(dirname $(realpath $0))
BASE_DIR=$(realpath ${THIS_DIR}/..)
script=${BASE_DIR}/releases/${release_version}/${product_family}/download_components.sh
#Reuse current release version download script
echo "Invoking ${script}"
${script} --motor_control_folder="${motor_control_folder}" --install_dir="${install_dir}" --skip_nodejs="${skip_nodejs}" --skip_doxygen="${skip_doxygen}"

View File

@ -0,0 +1,21 @@
#CCS
CCS_VERSION="12.1.0.00007"
#TI Compilers
CGT_TI_ARM_CLANG_VERSION="2.1.2"
CGT_TI_ARM_CLANG_VERSION_SUFFIX="LTS"
NODEJS_VERSION="12.18.4"
SYSCFG_VERSION="1.14.0_2667"
DOXYGEN_VERSION="1.8.20"
#GCC Compilers
GCC_AARCH64_VERSION="9.2-2019.12"
GCC_ARM_VERSION="7-2017-q4-major"
GCC_ARM_VERSION_FOLDER="7-2017q4"
#MCU PLUS SDK
MCU_PLUS_SDK_AM64X="09.00.00.01"
MCU_PLUS_SDK_AM243X="09.00.00.01"
MCU_PLUS_SDK_AM263X="09.00.00.01"

View File

@ -0,0 +1,92 @@
#!/bin/bash
#
# Script to download and install current baselined components
#
install_win_package_on_linux="false"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--install_win_package_on_linux)
install_win_package_on_linux="true"
shift # past argument
;;
--motor_control_folder=*)
motor_control_folder="${1#*=}"
shift # past argument
;;
--install_dir=*)
install_dir="${1#*=}"
shift # past argument
;;
--skip_nodejs=*)
skip_nodejs="${1#*=}"
shift # past argument
;;
--skip_doxygen=*)
skip_doxygen="${1#*=}"
shift # past argument
;;
-h|--help)
echo Usage: $0 [options]
echo
echo Options
echo --install_win_package_on_linux Used to install windows packages in linux environment for release packaging
exit 0
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
THIS_DIR=$(dirname $(realpath $0))
BASE_DIR=${THIS_DIR}/../../..
COMPONENT_DIR=${BASE_DIR}/../..
: ${motor_control_folder:="motor_control_sdk"}
: ${install_dir:="${HOME}/ti"}
: ${skip_nodejs:="false"}
: ${skip_doxygen:="false"}
#Source common component versions
source ${THIS_DIR}/../.component_versions
source ${BASE_DIR}/scripts/common.sh
gcc_arm_install_folder="gcc-arm-none-eabi-${GCC_ARM_VERSION}"
gcc_arm_download_file="gcc-arm-none-eabi-${GCC_ARM_VERSION}-linux.tar.bz2"
if [ "$install_win_package_on_linux" == "true" ]; then
echo "Installing windows packages on linux machine...."
#Nothing yet!!
fi
clang_url_folder="${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}"
clang_install_folder="ti-cgt-armllvm_${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}"
clang_install_file="ti_cgt_armllvm_${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}_linux-x64_installer.bin"
# MCU + SDK
mcu_sdk_version="${MCU_PLUS_SDK_AM243X}"
platform="am243x"
if [ "${OS}" = "Windows_NT" ]; then
echo "Installing windows packages"
#TODO
else
install_ccs ${CCS_VERSION} ${install_dir}
#install_clang ${CGT_TI_ARM_CLANG_VERSION} ${clang_url_folder} ${clang_install_folder} ${clang_install_file} ${install_dir}
install_gcc_arm ${GCC_ARM_VERSION} ${gcc_arm_install_folder} ${gcc_arm_download_file} ${install_dir} ${GCC_ARM_VERSION_FOLDER}
install_syscfg ${SYSCFG_VERSION} ${install_dir}
install_mcu_plus_sdk ${mcu_sdk_version} ${platform} ${install_dir}
if [ "$skip_nodejs" == "false" ]; then
install_nodejs ${NODEJS_VERSION} ${motor_control_folder}
fi
if [ "$skip_doxygen" == "false" ]; then
install_doxygen ${DOXYGEN_VERSION}
fi
ccs_discover_tools ${CCS_VERSION} ${install_dir}
fi
#
# PC OS agnostic installer packages
#
#None

View File

@ -0,0 +1,88 @@
#!/bin/bash
#
# Script to download and install current baselined components
#
install_win_package_on_linux="false"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--install_win_package_on_linux)
install_win_package_on_linux="true"
shift # past argument
;;
--motor_control_folder=*)
motor_control_folder="${1#*=}"
shift # past argument
;;
--install_dir=*)
install_dir="${1#*=}"
shift # past argument
;;
--skip_nodejs=*)
skip_nodejs="${1#*=}"
shift # past argument
;;
--skip_doxygen=*)
skip_doxygen="${1#*=}"
shift # past argument
;;
-h|--help)
echo Usage: $0 [options]
echo
echo Options
echo --install_win_package_on_linux Used to install windows packages in linux environment for release packaging
exit 0
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
THIS_DIR=$(dirname $(realpath $0))
BASE_DIR=${THIS_DIR}/../../..
COMPONENT_DIR=${BASE_DIR}/../..
: ${motor_control_folder:="motor_control_sdk"}
: ${install_dir:="${HOME}/ti"}
: ${skip_nodejs:="false"}
: ${skip_doxygen:="false"}
#Source common component versions
source ${THIS_DIR}/../.component_versions
source ${BASE_DIR}/scripts/common.sh
if [ "$install_win_package_on_linux" == "true" ]; then
echo "Installing windows packages on linux machine...."
#Nothing yet!!
fi
clang_url_folder="${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}"
clang_install_folder="ti-cgt-armllvm_${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}"
clang_install_file="ti_cgt_armllvm_${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}_linux-x64_installer.bin"
# MCU + SDK
mcu_sdk_version="${MCU_PLUS_SDK_AM263X}"
platform="am263x"
if [ "${OS}" = "Windows_NT" ]; then
echo "Installing windows packages"
#TODO
else
install_ccs ${CCS_VERSION} ${install_dir}
#install_clang ${CGT_TI_ARM_CLANG_VERSION} ${clang_url_folder} ${clang_install_folder} ${clang_install_file} ${install_dir}
install_syscfg ${SYSCFG_VERSION} ${install_dir}
install_mcu_plus_sdk ${mcu_sdk_version} ${platform} ${install_dir}
if [ "$skip_nodejs" == "false" ]; then
install_nodejs ${NODEJS_VERSION} ${motor_control_folder}
fi
if [ "$skip_doxygen" == "false" ]; then
install_doxygen ${DOXYGEN_VERSION}
fi
ccs_discover_tools ${CCS_VERSION} ${install_dir}
fi
#
# PC OS agnostic installer packages
#
#None

View File

@ -0,0 +1,95 @@
#!/bin/bash
#
# Script to download and install current baselined components
#
install_win_package_on_linux="false"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--install_win_package_on_linux)
install_win_package_on_linux="true"
shift # past argument
;;
--motor_control_folder=*)
motor_control_folder="${1#*=}"
shift # past argument
;;
--install_dir=*)
install_dir="${1#*=}"
shift # past argument
;;
--skip_nodejs=*)
skip_nodejs="${1#*=}"
shift # past argument
;;
--skip_doxygen=*)
skip_doxygen="${1#*=}"
shift # past argument
;;
-h|--help)
echo Usage: $0 [options]
echo
echo Options
echo --install_win_package_on_linux Used to install windows packages in linux environment for release packaging
exit 0
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
THIS_DIR=$(dirname $(realpath $0))
BASE_DIR=${THIS_DIR}/../../..
COMPONENT_DIR=${BASE_DIR}/../..
: ${motor_control_folder:="motor_control_sdk"}
: ${install_dir:="${HOME}/ti"}
: ${skip_nodejs:="false"}
: ${skip_doxygen:="false"}
#Source common component versions
source ${THIS_DIR}/../.component_versions
source ${BASE_DIR}/scripts/common.sh
gcc_aarch64_install_folder="gcc-arm-${GCC_AARCH64_VERSION}-x86_64-aarch64-none-elf"
gcc_aarch64_download_file="gcc-arm-${GCC_AARCH64_VERSION}-x86_64-aarch64-none-elf.tar.xz"
gcc_arm_install_folder="gcc-arm-none-eabi-${GCC_ARM_VERSION}"
gcc_arm_download_file="gcc-arm-none-eabi-${GCC_ARM_VERSION}-linux.tar.bz2"
if [ "$install_win_package_on_linux" == "true" ]; then
echo "Installing windows packages on linux machine...."
#Nothing yet!!
fi
clang_url_folder="${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}"
clang_install_folder="ti-cgt-armllvm_${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}"
clang_install_file="ti_cgt_armllvm_${CGT_TI_ARM_CLANG_VERSION}.${CGT_TI_ARM_CLANG_VERSION_SUFFIX}_linux-x64_installer.bin"
# MCU + SDK
mcu_sdk_version="${MCU_PLUS_SDK_AM64X}"
platform="am64x"
if [ "${OS}" = "Windows_NT" ]; then
echo "Installing windows packages"
#TODO
else
install_ccs ${CCS_VERSION} ${install_dir}
#install_clang ${CGT_TI_ARM_CLANG_VERSION} ${clang_url_folder} ${clang_install_folder} ${clang_install_file} ${install_dir}
install_gcc_aarch64 ${GCC_AARCH64_VERSION} ${gcc_aarch64_install_folder} ${gcc_aarch64_download_file} ${install_dir}
install_gcc_arm ${GCC_ARM_VERSION} ${gcc_arm_install_folder} ${gcc_arm_download_file} ${install_dir} ${GCC_ARM_VERSION_FOLDER}
install_syscfg ${SYSCFG_VERSION} ${install_dir}
install_mcu_plus_sdk ${mcu_sdk_version} ${platform} ${install_dir}
if [ "$skip_nodejs" == "false" ]; then
install_nodejs ${NODEJS_VERSION} ${motor_control_folder}
fi
if [ "$skip_doxygen" == "false" ]; then
install_doxygen ${DOXYGEN_VERSION}
fi
ccs_discover_tools ${CCS_VERSION} ${install_dir}
fi
#
# PC OS agnostic installer packages
#
#None

330
scripts/common.sh Normal file
View File

@ -0,0 +1,330 @@
#!/bin/bash
#
# Script to have common download, install and utility functions
#
: ${quiet_mode:="true"}
if [ "$quiet_mode" == "true" ]; then
quiet_mode_flag="-q"
fi
#
# This function downloads a installer using wget
#
# $1 is the install folder name, used as tag for log
# $2 is the installer executable name
# $3 is the web path from which to download (wget) the installer
# $4 is additional options to pass to 'wget'
#
wget_download() {
if [ ! -e $2 ]
then
echo "[$1] Downloading ..."
wget $quiet_mode_flag $3/$2 $4
chmod +x $2
echo "[$1] Done"
fi
}
install_ccs() {
local ccs_version=$1
local install_dir=$2
local ccs_version_major=`echo ${ccs_version} | cut -d "." -f 1`
local ccs_version_short=`echo ${ccs_version} | cut -d "." -f -3 | sed -e "s|\.|_|g"`
local ccs_version_short_dot=`echo ${ccs_version_short} | sed -e "s|\_|.|g"`
local ccs_folder=ccs`echo ${ccs_version} | cut -d "." -f -3 | sed -e "s|\.||g"`
local ccs_install_file="CCS${ccs_version}_linux-x64.tar.gz"
local ccs_url="https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-J1VdearkvK/${ccs_version_short_dot}"
local ccs_untar_folder=`echo ${ccs_install_file} | sed -e "s|\.tar\.gz||g"`
echo "[ccs $1] Checking ..."
if [ ! -d "${install_dir}/${ccs_folder}" ]
then
wget_download ${ccs_folder} ${ccs_install_file} ${ccs_url}
mkdir -p "${install_dir}"
tar xf ${ccs_install_file} -C "${install_dir}"
echo "[${ccs_folder}] Installing ..."
${install_dir}/${ccs_untar_folder}/ccs_setup_${ccs_version}.run --mode unattended --prefix "${install_dir}/${ccs_folder}"
#Clean-up
rm -f ${ccs_install_file}
rm -rf "${install_dir}/${ccs_untar_folder}"
fi
echo "[${ccs_folder}] Done "
}
ccs_discover_tools() {
local ccs_version=$1
local install_dir=$2
local ccs_folder=ccs`echo ${ccs_version} | cut -d "." -f -3 | sed -e "s|\.||g"`
if [ -d "${install_dir}/${ccs_folder}" ]
then
echo "[ccs $1] Discover installed tools ..."
pushd ${install_dir}/${ccs_folder}/ccs/eclipse 1>/dev/null
./eclipse -nosplash -application com.ti.common.core.initialize -data ~/workspace 2>>ccs_log.txt
cat ./configuration/com.ti.common.project.core/compilerProperties.cache.log
popd 1>/dev/null
echo "[ccs $1] Discover installed tools ... Done "
fi
}
install_nodejs() {
local version=$1
local motor_control_folder=$2
local nvm_pass=1
echo "[nodejs ${version}] Installing ..."
# Check for possible node folders
if [ ! -d ~/.nvm/versions/node/v${version} ] && [ ! -d ~/node-v${version} ] && ! command -v node &> /dev/null; then
# node is not installed. Try using NVM first
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh -o install_nvm.sh
if [ -e install_nvm.sh ]; then
if grep -q "nvm" install_nvm.sh; then
bash install_nvm.sh
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install ${version}
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
rm -f install_nvm.sh
echo "export PATH=$HOME/.nvm/versions/node/v${version}/bin:\$PATH" >> ~/.bashrc
export PATH=~/.nvm/versions/node/v${version}/bin:$PATH
else
echo "INFO: Installation of NodeJS using NVM script v${version} failed (NVM script Error)"
nvm_pass=0
fi
else
echo "INFO: Installation of NodeJS using NVM script v${version} failed (Couldn't download NVM script)"
nvm_pass=0
fi
# Check if NVM was successful
if [ $nvm_pass == 0 ]; then
# NVM script has failed, try downloading from NodeJS website directly
echo "INFO: Trying NodeJS v${version} installation directly"
wget -q https://nodejs.org/download/release/v${version}/node-v${version}-linux-x64.tar.xz
mkdir -p ~/node-v${version}
tar -xf node-v${version}-linux-x64.tar.xz -C ~/node-v${version} --strip-components=1
echo "export PATH=$HOME/node-v${version}/bin:\$PATH" >> ~/.bashrc
export PATH=~/node-v${version}/bin:$PATH
rm -rf node-v${version}-linux-x64.tar.xz
fi
else
export PATH=~/.nvm/versions/node/v${version}/bin:$PATH
export PATH=~/node-v${version}/bin:$PATH
fi
echo "[nodejs ${version}] Done "
#Install required nodejs packages
if [ ! -d ${motor_control_folder}/node_modules ]; then
echo "[nodejs packages] Installing required nodejs packages ..."
cd ${motor_control_folder}
npm install lodash
npm install yargs
cd - 1>/dev/null
echo "[nodejs packages] Done "
fi
}
install_syscfg() {
local version=$1
local install_dir=$2
local version_dot=`echo ${version} | sed -e "s|\_|.|g"`
local syscfg_install_file="sysconfig-${version}-setup.run"
local syscfg_build_version=`echo ${version} | cut -d "_" -f 2`
local syscfg_folder=sysconfig_`echo ${version} | cut -d "_" -f 1`
local syscfg_url="https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-nsUM6f7Vvb/${version_dot}"
echo "[syscfg ${version}] Checking ..."
if [ ! -d "${install_dir}/${syscfg_folder}" ]
then
echo "[syscfg ${version}] Installing ..."
wget_download ${syscfg_folder} ${syscfg_install_file} ${syscfg_url}
./${syscfg_install_file} --mode unattended --prefix "${install_dir}/${syscfg_folder}"
# Clean-up
rm -f ${syscfg_install_file}
fi
echo "[syscfg ${version}] Done "
}
install_clang() {
local version=$1
local clang_url_folder=$2
local clang_install_folder=$3
local clang_install_file=$4
local install_dir=$5
echo "[ti-cgt-armllvm ${version}] Checking ..."
if [ ! -d "${install_dir}"/${clang_install_folder} ]
then
wget -q https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-ayxs93eZNN/${clang_url_folder}/${clang_install_file}
chmod +x ${clang_install_file}
./${clang_install_file} --mode unattended --prefix "${install_dir}"
#Clean-up
rm -f ${clang_install_file}
fi
echo "[ti-cgt-armllvm ${version}] Done "
}
install_gcc_aarch64() {
local version=$1
local gcc_install_folder=$2
local gcc_download_file=$3
local install_dir=$4
local gcc_url="https://developer.arm.com/-/media/Files/downloads/gnu-a/${version}/binrel"
echo "[gcc-arm-none-eabi ${version}] Checking ..."
if [ ! -d "${install_dir}"/${gcc_install_folder} ]
then
wget_download ${gcc_install_folder} ${gcc_download_file} ${gcc_url}
tar -C ${install_dir} -xf ${gcc_download_file}
#Clean-up
rm ${gcc_download_file}
fi
echo
}
install_gcc_arm() {
local version=$1
local gcc_install_folder=$2
local gcc_download_file=$3
local install_dir=$4
local version_folder=$5
local gcc_url="https://developer.arm.com/-/media/Files/downloads/gnu-rm/${version_folder}"
echo "[gcc-arm-none-eabi ${version}] Checking ..."
if [ ! -d "${install_dir}"/${gcc_install_folder} ]
then
wget_download ${gcc_install_folder} ${gcc_download_file} ${gcc_url}
tar -C ${install_dir} -xf ${gcc_download_file}
#Clean-up
rm ${gcc_download_file}
fi
echo
}
install_doxygen() {
local version=$1
local version_underscore=`echo ${version} | sed -e "s|\.|_|g"`
sudo apt-get install -y cmake flex bison
sudo apt-get remove -y doxygen
if ! command -v doxygen &> /dev/null
then
echo "[doxygen ${version}] Installing ..."
pushd ${HOME} 1>/dev/null
git clone -q https://github.com/doxygen/doxygen.git
cd doxygen
git checkout Release_${version_underscore} 1>/dev/null
mkdir build
cd build
cmake -G "Unix Makefiles" .. 1>/dev/null
make -j8 1>/dev/null
sudo make install
echo "[doxygen ${version}] Done"
popd 1>/dev/null
fi
}
install_mcu_plus_sdk() {
local version=$1
local platform=$2
local install_dir=$3
local version_underscore=`echo ${version} | sed -e "s|\.|_|g"`
local mcu_plus_sdk_url="http://mcupnas.dhcp.ti.com/release_area/nightly_builds/mcu_plus_sdk_${platform}_nightly/latest/artifacts/output/webgen/exports"
local mcu_plus_sdk_download_file="mcu_plus_sdk_${platform}_${version_underscore}-linux-x64-installer.run"
echo "[mcu_plus_sdk_${platform}_${version_underscore}] Checking ..."
if [ ! -d "${install_dir}"/mcu_plus_sdk_${platform}_${version_underscore} ]
then
echo "[ mcu_plus_sdk_${platform}_${version_underscore} ] Downloading ..."
pwd
wget ${mcu_plus_sdk_url}/${mcu_plus_sdk_download_file}
ls -l
chmod +x ${mcu_plus_sdk_download_file}
echo "[ mcu_plus_sdk_${platform}_${version_underscore} ] Installing ..."
./${mcu_plus_sdk_download_file} --mode unattended --prefix "${install_dir}"
#Clean-up
rm ${mcu_plus_sdk_download_file} 1>/dev/null
echo "[ mcu_plus_sdk_${platform}_${version_underscore} ] Done ..."
fi
echo
}
#
# This function is used to replace the tag/reference in a repo manifest file
#
# $1 is the repo manifest file path
# $2 is the repo name to grep
# $3 is the tag to replace
#
tag_replace() {
if [ $# -ge 3 ] && [ -n "$3" ]; then
#For Branches or Tags
local find_str="$2\"[ \t]*revision=\"[0-9A-Za-z_\-\.\/]*\""
local replace_str="$2\" revision=\"$3\" clone-depth=\"1\""
sed -i -e "s|$find_str|$replace_str|g" $1
else
local find_str="$2\"[ \t]*revision=(\"[0-9A-Za-z_\-]*\")"
local replace_str="$2\" revision=\1 clone-depth=\"1\""
sed -r -i -e "s|$find_str|$replace_str|g" $1
fi
}
#
# This function is used to print the time difference
#
# $1 is the start time
#
print_time_diff() {
local end_time=`date +%s`
local start_time=$1
local deltatime=$((end_time-start_time))
local hours=$((deltatime/3600))
local minutes=$((deltatime/60))
local minutes=$((minutes%60))
local seconds=$((deltatime%60))
LC_NUMERIC="en_US.UTF-8" printf "$2: %d:%02d:%02d\n" $hours $minutes $seconds
}
# find highest numbered file with pattern $1, strip filename and extension and keep only the version
get_version_file() {
if [ -d $3 ]; then
cd $3
find . -maxdepth 1 -name "$1*" | sort -r -n | head -n1 | sed "s/.\///" | sed "s/$2//" | sed "s/$1//"
cd - > /dev/null
else
# file not found, script will give a error later, return a reasonable file name here, i.e $1$2
echo $1$2
fi
}
recur_copy() {
#echo "Copying files of type $1 from $2 to $3 ..."
find ./ -iname $1 | \
while read filepath; do
cp --parent --target-directory=$2 "$filepath"
done
}
tar_xz() {
tar -cJf ${2}.tar.xz ${1}
}
untar_xz() {
tar -xf ${1} ${2}
}