From 62b8dc10c4fbb9f9a1c300aea954192febf829d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20=C4=90=E1=BB=A9c=20Hi=E1=BA=BFu?= Date: Mon, 8 Oct 2018 16:36:37 +0700 Subject: [PATCH 1/2] switch to rust-lld --- .cargo/config | 2 -- .travis.yml | 4 ---- Makefile | 1 + README.md | 10 +--------- scripts/generate_dfu.sh | 2 +- scripts/install.sh | 10 +--------- 6 files changed, 4 insertions(+), 25 deletions(-) diff --git a/.cargo/config b/.cargo/config index 5018d13..cd9e64e 100644 --- a/.cargo/config +++ b/.cargo/config @@ -2,8 +2,6 @@ runner = 'arm-none-eabi-gdb' rustflags = [ "-C", "link-arg=-Tlink.x", - "-C", "linker=arm-none-eabi-ld", - "-Z", "linker-flavor=ld", "-Z", "thinlto=no", ] diff --git a/.travis.yml b/.travis.yml index e9b4fe3..1008e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,6 @@ before_install: install: - bash ./scripts/install.sh - - export PATH="$PATH:$PWD/gcc/bin" script: - make @@ -35,13 +34,10 @@ script: cache: cargo: true - directories: - - ${HOME}/gcc before_cache: # Travis can't cache files that are not readable by "others" - chmod -R a+r ${HOME}/.cargo - - chmod -R a+r ${HOME}/gcc before_deploy: - git config --local user.name "Andreas Heider" diff --git a/Makefile b/Makefile index 999411f..cd40d66 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ all: $(MAKE) dfu build: + rustup component add llvm-tools-preview rustup target add thumbv7m-none-eabi cargo build --release diff --git a/README.md b/README.md index 788f2d2..81984cd 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Many fellow projects provide insights into the obins firmware and app protocol: To build your own firmware, you need the following components: - rustup: to make use of the `rust-toolchain` file -- ARM linker: usually named `arm-none-eabi-ld`, please check with your OS +- cargo-objcopy: you need to build it outside this directory `cd ~ ; cargo install cargo-binutils` Then, `make dfu` in the top directory will build your `anne-key.dfu`. @@ -129,11 +129,3 @@ Our CI requires consistent formatting, please run rustfmt before you submit PRs: Troubleshooting --------- - -### error: linker arm-none-eabi-ld not found - -You need to install the ARM tools. If you're on macOS run the following: - -``` -brew install caskroom/cask/gcc-arm-embedded -``` diff --git a/scripts/generate_dfu.sh b/scripts/generate_dfu.sh index d514845..74018ed 100755 --- a/scripts/generate_dfu.sh +++ b/scripts/generate_dfu.sh @@ -2,5 +2,5 @@ set -ex -arm-none-eabi-objcopy -O binary target/thumbv7m-none-eabi/release/anne-key anne-key.bin +cargo objcopy -- -O binary target/thumbv7m-none-eabi/release/anne-key anne-key.bin ./scripts/dfu-convert.py -b 0x08004000:anne-key.bin anne-key.dfu diff --git a/scripts/install.sh b/scripts/install.sh index c473f13..9a7032e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -4,15 +4,7 @@ set -eux main() { which cargo-bloat || (cd /; cargo install cargo-bloat) - - if [ ${TRAVIS_OS_NAME} != 'osx' ]; then - mkdir gcc - curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update | tar --strip-components=1 -C gcc -xj - fi - - if [ ${TRAVIS_OS_NAME} = 'osx' ]; then - brew install caskroom/cask/gcc-arm-embedded - fi + which cargo-objcopy || (cd /; cargo install cargo-binutils) } main From cbb9fa85937cdf92186645be8aa5e17f799f4d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20=C4=90=E1=BB=A9c=20Hi=E1=BA=BFu?= Date: Mon, 22 Oct 2018 07:53:27 +0700 Subject: [PATCH 2/2] travis: add failing windows job cargo-bloat doesn't support windows. But it's still failing for no reason. --- .travis.yml | 5 ++++- scripts/install.sh | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1008e3d..0f0e5e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ rust: nightly-2018-12-06 os: - linux - osx + - windows matrix: include: @@ -12,6 +13,8 @@ matrix: rustup component add rustfmt script: cargo fmt --all -- --check + allow_failures: + - os: windows before_install: - | @@ -30,7 +33,7 @@ install: script: - make - cargo build --features use_semihosting - - make bloat + - "[[ ${TRAVIS_OS_NAME} != 'windows' ]] && make bloat" cache: cargo: true diff --git a/scripts/install.sh b/scripts/install.sh index 9a7032e..5e762db 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,6 +5,8 @@ set -eux main() { which cargo-bloat || (cd /; cargo install cargo-bloat) which cargo-objcopy || (cd /; cargo install cargo-binutils) + # For Travis CI on Windows + which make || choco install make python2 } main