diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..60d4d89 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,25 @@ +version: 2 +jobs: + build: + machine: true + steps: + - checkout + - run: + name: Checkout submodules + command: git submodule sync && git submodule update --init + - restore_cache: + key: v1-toolchain-checksum-{{ checksum "util/install-toolchain.sh" }} + - run: + name: Install toolchain + command: ./util/install-toolchain.sh + - save_cache: + key: v1-toolchain-checksum-{{ checksum "util/install-toolchain.sh" }} + paths: + - "~/toolchains/" + - run: + name: Compile firmware + command: make -k all + environment: + PREFIX: "~/toolchains/gcc-arm-embedded/bin/arm-none-eabi" + - store_artifacts: + path: build/ diff --git a/circle.yml b/circle.yml deleted file mode 100644 index b5dab6c..0000000 --- a/circle.yml +++ /dev/null @@ -1,12 +0,0 @@ -dependencies: - override: - - ./util/install-toolchain.sh - cache_directories: - - "~/toolchains/" -test: - override: - - PREFIX="~/toolchains/gcc-arm-embedded/bin/arm-none-eabi" make -k all - -general: - artifacts: - - build/ \ No newline at end of file diff --git a/util/install-toolchain.sh b/util/install-toolchain.sh index 14b95e1..95a6754 100755 --- a/util/install-toolchain.sh +++ b/util/install-toolchain.sh @@ -1,8 +1,32 @@ #!/bin/bash -URL=https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 -TOOLCHAIN=gcc-arm-none-eabi-5_2-2015q4 -if [[ ! -d "$HOME/toolchains/gcc-arm-embedded" ]]; then - mkdir -p ~/toolchains - wget -qO- $URL | tar xj -C ~/toolchains/ - ln -s $TOOLCHAIN ~/toolchains/gcc-arm-embedded +set -eo pipefail +URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2016q4/gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2 +TOOLCHAIN=gcc-arm-none-eabi-6_2-2016q4 +TOOLCHAINS=$HOME/toolchains +TOOLCHAIN_MISSING=0 +GCC=${TOOLCHAINS}/gcc-arm-embedded/bin/arm-none-eabi-gcc +if [[ ! -d "${TOOLCHAINS}/gcc-arm-embedded" ]]; then + TOOLCHAIN_MISSING=1 fi; +if [[ ! -f ${GCC} ]]; then + TOOLCHAIN_MISSING=1 +fi; + +if [ $TOOLCHAIN_MISSING -eq 1 ]; then + echo "Installing $TOOLCHAIN from $URL to ${TOOLCHAINS}" + mkdir -p ${TOOLCHAINS} + wget -qO- $URL | tar xj -C ${TOOLCHAINS} + rm -rf ${TOOLCHAINS}/gcc-arm-embedded + ln -s $TOOLCHAIN ${TOOLCHAINS}/gcc-arm-embedded +fi; + +EXISTING_TOOLCHAIN=`readlink -f "${TOOLCHAINS}/gcc-arm-embedded"` +echo "Current toolchain is $EXISTING_TOOLCHAIN" + +if ! ldd ${GCC} >/dev/null; then + echo "${GCC} does not appear to be executable on this machine" + exit 1 +fi; + +TOOLCHAIN_VER=`${GCC} --version | head -n 1` +echo "Installed toolchain version is $TOOLCHAIN_VER"