From d33ec98e397a42c8a17e6c091ce7dd765985df84 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 25 Aug 2018 15:47:04 +0200 Subject: [PATCH 1/3] remove build dependency on arm-none-eabi-gcc by shipping pre-assembled object files. This is the same approach as the one used in rust-embedded/cortex-m#95 --- .gitignore | 6 +++++- .travis.yml | 22 ++++------------------ Cargo.toml | 3 --- asm.s | 5 +++-- assemble.sh | 19 +++++++++++++++++++ bin/thumbv6m-none-eabi.a | Bin 0 -> 894 bytes bin/thumbv7em-none-eabi.a | Bin 0 -> 894 bytes bin/thumbv7em-none-eabihf.a | Bin 0 -> 894 bytes bin/thumbv7m-none-eabi.a | Bin 0 -> 894 bytes build.rs | 15 +++++++++++---- check-blobs.sh | 21 +++++++++++++++++++++ ci/install.sh | 4 ++++ ci/script.sh | 4 ++++ 13 files changed, 71 insertions(+), 28 deletions(-) create mode 100755 assemble.sh create mode 100644 bin/thumbv6m-none-eabi.a create mode 100644 bin/thumbv7em-none-eabi.a create mode 100644 bin/thumbv7em-none-eabihf.a create mode 100644 bin/thumbv7m-none-eabi.a create mode 100755 check-blobs.sh diff --git a/.gitignore b/.gitignore index a9d37c5..c857ba8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ -target +.#* Cargo.lock +bin/*.after +bin/*.before +bin/*.o +target diff --git a/.travis.yml b/.travis.yml index e2b3d36..cee361f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,22 +3,15 @@ language: rust matrix: include: - env: TARGET=x86_64-unknown-linux-gnu + rust: stable if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - env: TARGET=thumbv6m-none-eabi - rust: beta - addons: - apt: - packages: - - gcc-arm-none-eabi + rust: stable if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - env: TARGET=thumbv7m-none-eabi - rust: beta - addons: - apt: - packages: - - gcc-arm-none-eabi + rust: stable if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - env: TARGET=x86_64-unknown-linux-gnu @@ -27,24 +20,17 @@ matrix: - env: TARGET=thumbv6m-none-eabi rust: nightly - addons: - apt: - packages: - - gcc-arm-none-eabi if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - env: TARGET=thumbv7m-none-eabi rust: nightly - addons: - apt: - packages: - - gcc-arm-none-eabi if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) before_install: set -e install: - bash ci/install.sh + - export PATH="$PATH:$PWD/gcc/bin" script: - bash ci/script.sh diff --git a/Cargo.toml b/Cargo.toml index 6c33b55..c69ad2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,5 @@ name = "cortex-m-semihosting" repository = "https://github.com/japaric/cortex-m-semihosting" version = "0.3.0" -[build-dependencies] -cc = "1.0.10" - [features] inline-asm = [] \ No newline at end of file diff --git a/asm.s b/asm.s index 1b6d9df..26a13fc 100644 --- a/asm.s +++ b/asm.s @@ -1,5 +1,6 @@ -.global __syscall - + .section .text.__syscall + .global __syscall + .thumb_func __syscall: bkpt 0xAB bx lr diff --git a/assemble.sh b/assemble.sh new file mode 100755 index 0000000..4ff81c8 --- /dev/null +++ b/assemble.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -euxo pipefail + +# cflags taken from cc 1.0.22 + +crate=cortex-m-semihosting + +arm-none-eabi-as -march=armv6s-m asm.s -o bin/$crate.o +ar crs bin/thumbv6m-none-eabi.a bin/$crate.o + +arm-none-eabi-as -march=armv7-m asm.s -o bin/$crate.o +ar crs bin/thumbv7m-none-eabi.a bin/$crate.o + +arm-none-eabi-as -march=armv7e-m asm.s -o bin/$crate.o +ar crs bin/thumbv7em-none-eabi.a bin/$crate.o +ar crs bin/thumbv7em-none-eabihf.a bin/$crate.o + +rm bin/$crate.o diff --git a/bin/thumbv6m-none-eabi.a b/bin/thumbv6m-none-eabi.a new file mode 100644 index 0000000000000000000000000000000000000000..d01b38c603e5312518a3f097ba9f07c6f38e689f GIT binary patch literal 894 zcmah{%}T>S5T2O+1`+kDhZF>Ru$w9+^iYHz)JtwLbx5;yM;YN7KThZ@m{Y+*N#I=8gZb# zS()RmDOG!$L>rpWfRE4B&F}~lGLdl#&H=jB@U9aby;KGhorPwXS zl~PBgRIdVMc<3QTCmM>2gHY>*mN8nL89QSSH?NG(CcN`at+D0;>4HWE_nERCOa zqP8ag9ng7br&GU8jg^p#FzD%lYiN_QiPaz;Lb5Y^0Ch31 qbIEcK^i)mT^DrMpO_0 literal 0 HcmV?d00001 diff --git a/bin/thumbv7em-none-eabi.a b/bin/thumbv7em-none-eabi.a new file mode 100644 index 0000000000000000000000000000000000000000..254b42fcdf8213e59bcb3b2ee6ad42c4f4d51017 GIT binary patch literal 894 zcmah{%}&BV5T05Jw24N&>H!iHImi}GQ#lY54(J6g#yj0&BTcA~?wZI+pGV)pr|=1U z5@*>?x+VTh^6mV6GdnwNd%*MA{L1rNRp}Y7w#~EEI`0!9@&Ld>yiKQKEoOYN0Drq3 zk$=$_0VN`Dw#;Sn+|9Zo$-OLu#?0 zvl*HEo=!QzCeQ&Fn(+Ryx)~l}fG0do!8$? z)A&gyqH^=!j#`geUA>^`{gpNJ>UP1SS8wy^%bX&wiTICqR`fIPH8)204s@>-s*UvV vJT7dd=w79%M#b+CuZTtg)q5Y|B4{==;S;f^j6$fN`d3We7y4r&p(frp)8AAD literal 0 HcmV?d00001 diff --git a/bin/thumbv7em-none-eabihf.a b/bin/thumbv7em-none-eabihf.a new file mode 100644 index 0000000000000000000000000000000000000000..254b42fcdf8213e59bcb3b2ee6ad42c4f4d51017 GIT binary patch literal 894 zcmah{%}&BV5T05Jw24N&>H!iHImi}GQ#lY54(J6g#yj0&BTcA~?wZI+pGV)pr|=1U z5@*>?x+VTh^6mV6GdnwNd%*MA{L1rNRp}Y7w#~EEI`0!9@&Ld>yiKQKEoOYN0Drq3 zk$=$_0VN`Dw#;Sn+|9Zo$-OLu#?0 zvl*HEo=!QzCeQ&Fn(+Ryx)~l}fG0do!8$? z)A&gyqH^=!j#`geUA>^`{gpNJ>UP1SS8wy^%bX&wiTICqR`fIPH8)204s@>-s*UvV vJT7dd=w79%M#b+CuZTtg)q5Y|B4{==;S;f^j6$fN`d3We7y4r&p(frp)8AAD literal 0 HcmV?d00001 diff --git a/bin/thumbv7m-none-eabi.a b/bin/thumbv7m-none-eabi.a new file mode 100644 index 0000000000000000000000000000000000000000..5b7f5cc3a6783aab98c861d637a5f57f6f10b4e9 GIT binary patch literal 894 zcmah`%}&EG40h@MngarkaOor@c3|m1)7W7`+5xz17sP!{OT{W}Y-)nUPVhYN4m<@< zz?0xKwVF=+SaNK~pFcZJdnB@We#rvADm^PSzJ2=s*^mGs0{{p0Z8nn|8H>dNf^9ki z|6UFS=7`u;$d;q0%3%TVV%qp^A6$#ugW9 zTNO1sjp#Ze%$jxLKu5<4%8dh;o23#FT9p|)ClA-DfZq!xfJagS*B893<>T8a7fNMm z^rRA5>HK$aglWCHMgcSXD{JW0?E*)y-p0|-oFJ}+`XBDJ;IsSM8>7A>!?i|}%MedJ tGYR$8mTGkF4)qnaS*YgL|L>vFZ0N!#>aKPQA-;W#ZQK{e69S bin/${filename%.a}.before +done + +./assemble.sh + +for lib in $(ls bin/*.a); do + filename=$(basename $lib) + arm-none-eabi-objdump -Cd $lib > bin/${filename%.a}.after +done + +for cksum in $(ls bin/*.after); do + diff -u $cksum ${cksum%.after}.before +done diff --git a/ci/install.sh b/ci/install.sh index 3c41921..e63e805 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -4,6 +4,10 @@ main() { if [ $TARGET != x86_64-unknown-linux-gnu ]; then rustup target add $TARGET fi + + 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 } main diff --git a/ci/script.sh b/ci/script.sh index eb1a313..dc0be46 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -6,6 +6,10 @@ main() { if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo check --target $TARGET --features inline-asm fi + + if [ $TARGET = x86_64-unknown-linux-gnu ]; then + ./check-blobs.sh + fi } main From e9c74c0fb1d180b1230c117c2d874cd4a3858c49 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 26 Aug 2018 23:43:57 +0200 Subject: [PATCH 2/3] #!/bin/bash --- assemble.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assemble.sh b/assemble.sh index 4ff81c8..0d6c044 100755 --- a/assemble.sh +++ b/assemble.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -euxo pipefail From e4d90c13d7f94ae2c6df4da4ab934e89a78dc71e Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 27 Aug 2018 12:57:40 +0200 Subject: [PATCH 3/3] test the other two targets --- .travis.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.travis.yml b/.travis.yml index cee361f..1abe94d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,14 @@ matrix: rust: stable if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + - env: TARGET=thumbv7em-none-eabi + rust: stable + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + + - env: TARGET=thumbv7em-none-eabihf + rust: stable + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + - env: TARGET=x86_64-unknown-linux-gnu rust: nightly if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) @@ -26,6 +34,14 @@ matrix: rust: nightly if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + - env: TARGET=thumbv7em-none-eabi + rust: nightly + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + + - env: TARGET=thumbv7em-none-eabihf + rust: nightly + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + before_install: set -e install: