1#!/bin/bash
2
3[[ $_ != $0 ]] && echo "configuring external toolchain for nanohub" || (echo "Script has to be sourced" && exit 1)
4
5if [ ! -e $HOME/toolchains/gcc-arm-none-eabi-5_3-2016q1/bin ] ; then
6    echo Toolchain is not found, downloading
7    (mkdir -p $HOME/toolchains && cd $HOME/toolchains &&
8     wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q1-update/+download/gcc-arm-none-eabi-5_3-2016q1-20160330-linux.tar.bz2 &&
9     tar xjf gcc-arm-none-eabi-5_3-2016q1-20160330-linux.tar.bz2 &&
10     echo Toolchain download done
11    ) || (echo Toolchain download failed)
12fi
13
14export ARM_NONE_GCC_PATH=$HOME/toolchains/gcc-arm-none-eabi-5_3-2016q1
15export CROSS_COMPILE=$ARM_NONE_GCC_PATH/bin/arm-none-eabi-
16export NANOHUB_TOOLCHAIN=$CROSS_COMPILE
17