From 398943d6c8f2075f836168d5827c912c27f0c467 Mon Sep 17 00:00:00 2001 From: Enrik Berkhan Date: Sat, 17 Oct 2020 09:36:40 +0200 Subject: [PATCH] Add Rust to travis and to the toolchain container. Not sure if this is the way to do it... Make salty build. --- .travis.yml | 17 ++++++++++++++--- Dockerfile | 16 +++++++++++++++- Makefile | 6 +++++- targets/stm32l432/build/application.mk | 3 +++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index cdd81f4..1f70c07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,21 @@ addons: services: - docker before_install: - - sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa - - sudo apt-get update -q - - sudo apt-get install -y gcc-arm-embedded python3-venv + - sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa + - sudo apt-get update -q + - sudo apt-get install -y gcc-arm-embedded python3-venv + - > + set -eu; + url="https://raw.githubusercontent.com/rust-lang/rustup/1.22.1/rustup-init.sh"; + wget -O rustup-init.sh "$url"; + echo "b273275cf4d83cb6b991c1090baeca54 rustup-init.sh" | md5sum -c -; + echo "8928261388c8fae83bfd79b08d9030dfe21d17a8b59e9dcabda779213f6a3d14 rustup-init.sh" | sha256sum -c -; + bash ./rustup-init.sh --profile=minimal -y -t thumbv7em-none-eabihf; + rm rustup-init.sh; + set +eu + script: - export CC=gcc-8 + - source ${HOME}/.cargo/env - pyenv shell 3.6.7 - make travis diff --git a/Dockerfile b/Dockerfile index 2d584ec..ea2a7a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ RUN apt-get update \ wget \ bzip2 \ git \ + gcc \ + libc6-dev \ && rm -rf /var/lib/apt/lists/* # Install ARM compiler @@ -35,4 +37,16 @@ RUN set -eux; \ pip install -U pip # solo-python (Python3.7 script for merging etc.) -RUN pip install -U solo-python \ No newline at end of file +RUN pip install -U solo-python + +# Rust for salty +ENV RUSTUP_HOME=/rust/rustup +ENV CARGO_HOME=/rust/cargo +RUN set -eux; \ + url="https://raw.githubusercontent.com/rust-lang/rustup/1.22.1/rustup-init.sh"; \ + wget -O rustup-init.sh "$url"; \ + echo "b273275cf4d83cb6b991c1090baeca54 rustup-init.sh" | md5sum -c -; \ + echo "8928261388c8fae83bfd79b08d9030dfe21d17a8b59e9dcabda779213f6a3d14 rustup-init.sh" | sha256sum -c -; \ + bash ./rustup-init.sh --profile=minimal -y -t thumbv7em-none-eabihf; \ + rm rustup-init.sh; \ + chmod -R go+rwX /rust diff --git a/Makefile b/Makefile index 57cfc6c..c35b219 100644 --- a/Makefile +++ b/Makefile @@ -41,9 +41,12 @@ all: main tinycbor/Makefile crypto/tiny-AES-c/aes.c: git submodule update --init -.PHONY: cbor +.PHONY: cbor cborclean cbor: $(LIBCBOR) +cborclean: + cd tinycbor && $(MAKE) clean + $(LIBCBOR): cd tinycbor/ && $(MAKE) LDFLAGS='' -j8 @@ -54,6 +57,7 @@ version: @git describe test: venv + $(MAKE) cborclean $(MAKE) clean $(MAKE) -C . main $(MAKE) clean diff --git a/targets/stm32l432/build/application.mk b/targets/stm32l432/build/application.mk index 71d45ae..f53abfd 100644 --- a/targets/stm32l432/build/application.mk +++ b/targets/stm32l432/build/application.mk @@ -86,3 +86,6 @@ cbor: LDFLAGS="$(LDFLAGS_LIB)" \ CFLAGS="$(CFLAGS) -Os -DCBOR_PARSER_MAX_RECURSIONS=3" +salty: + cd ../../crypto/salty/c-api && cargo clean + cd ../../crypto/salty/c-api && $(MAKE)