Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit d33ec98

Browse files
committed
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
1 parent f4ab059 commit d33ec98

File tree

13 files changed

+71
-28
lines changed

13 files changed

+71
-28
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
target
1+
.#*
22
Cargo.lock
3+
bin/*.after
4+
bin/*.before
5+
bin/*.o
6+
target

.travis.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,15 @@ language: rust
33
matrix:
44
include:
55
- env: TARGET=x86_64-unknown-linux-gnu
6+
rust: stable
67
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
78

89
- env: TARGET=thumbv6m-none-eabi
9-
rust: beta
10-
addons:
11-
apt:
12-
packages:
13-
- gcc-arm-none-eabi
10+
rust: stable
1411
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
1512

1613
- env: TARGET=thumbv7m-none-eabi
17-
rust: beta
18-
addons:
19-
apt:
20-
packages:
21-
- gcc-arm-none-eabi
14+
rust: stable
2215
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
2316

2417
- env: TARGET=x86_64-unknown-linux-gnu
@@ -27,24 +20,17 @@ matrix:
2720

2821
- env: TARGET=thumbv6m-none-eabi
2922
rust: nightly
30-
addons:
31-
apt:
32-
packages:
33-
- gcc-arm-none-eabi
3423
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
3524

3625
- env: TARGET=thumbv7m-none-eabi
3726
rust: nightly
38-
addons:
39-
apt:
40-
packages:
41-
- gcc-arm-none-eabi
4227
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
4328

4429
before_install: set -e
4530

4631
install:
4732
- bash ci/install.sh
33+
- export PATH="$PATH:$PWD/gcc/bin"
4834

4935
script:
5036
- bash ci/script.sh

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,5 @@ name = "cortex-m-semihosting"
88
repository = "https://github.com/japaric/cortex-m-semihosting"
99
version = "0.3.0"
1010

11-
[build-dependencies]
12-
cc = "1.0.10"
13-
1411
[features]
1512
inline-asm = []

asm.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
.global __syscall
2-
1+
.section .text.__syscall
2+
.global __syscall
3+
.thumb_func
34
__syscall:
45
bkpt 0xAB
56
bx lr

assemble.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
set -euxo pipefail
4+
5+
# cflags taken from cc 1.0.22
6+
7+
crate=cortex-m-semihosting
8+
9+
arm-none-eabi-as -march=armv6s-m asm.s -o bin/$crate.o
10+
ar crs bin/thumbv6m-none-eabi.a bin/$crate.o
11+
12+
arm-none-eabi-as -march=armv7-m asm.s -o bin/$crate.o
13+
ar crs bin/thumbv7m-none-eabi.a bin/$crate.o
14+
15+
arm-none-eabi-as -march=armv7e-m asm.s -o bin/$crate.o
16+
ar crs bin/thumbv7em-none-eabi.a bin/$crate.o
17+
ar crs bin/thumbv7em-none-eabihf.a bin/$crate.o
18+
19+
rm bin/$crate.o

bin/thumbv6m-none-eabi.a

894 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi.a

894 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf.a

894 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi.a

894 Bytes
Binary file not shown.

build.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
extern crate cc;
2-
3-
use std::env;
1+
use std::path::PathBuf;
2+
use std::{env, fs};
43

54
fn main() {
65
let target = env::var("TARGET").unwrap();
6+
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
7+
let name = env::var("CARGO_PKG_NAME").unwrap();
78

89
if target.starts_with("thumbv") {
910
if env::var_os("CARGO_FEATURE_INLINE_ASM").is_none() {
10-
cc::Build::new().file("asm.s").compile("asm");
11+
fs::copy(
12+
format!("bin/{}.a", target),
13+
out_dir.join(format!("lib{}.a", name)),
14+
).unwrap();
15+
16+
println!("cargo:rustc-link-lib=static={}", name);
17+
println!("cargo:rustc-link-search={}", out_dir.display());
1118
}
1219

1320
println!("cargo:rustc-cfg=thumb");

0 commit comments

Comments
 (0)