Skip to content

Commit

Permalink
Merge pull request #78 from hdhoang/rust-lld
Browse files Browse the repository at this point in the history
use rust-lld
  • Loading branch information
hdhoang authored Dec 17, 2018
2 parents 8239134 + cbb9fa8 commit 42c1f98
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rust: nightly-2018-12-06
os:
- linux
- osx
- windows

matrix:
include:
Expand All @@ -12,6 +13,8 @@ matrix:
rustup component add rustfmt
script:
cargo fmt --all -- --check
allow_failures:
- os: windows

before_install:
- |
Expand All @@ -26,22 +29,18 @@ before_install:
install:
- bash ./scripts/install.sh
- export PATH="$PATH:$PWD/gcc/bin"

script:
- make
- cargo build --features use_semihosting
- make bloat
- "[[ ${TRAVIS_OS_NAME} != 'windows' ]] && make bloat"

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"
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ all:
$(MAKE) dfu

build:
rustup component add llvm-tools-preview
rustup target add thumbv7m-none-eabi
cargo build --release

Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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
```
2 changes: 1 addition & 1 deletion scripts/generate_dfu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 3 additions & 9 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ 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)
# For Travis CI on Windows
which make || choco install make python2
}

main

0 comments on commit 42c1f98

Please sign in to comment.