Skip to content

Commit ac0cb85

Browse files
automate, automate
1 parent 5e9347e commit ac0cb85

18 files changed

+49
-16
lines changed

asm-toolchain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly-2020-08-26

asm.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@
1414
//! assembly.
1515
//!
1616
//! For developers and contributors to `cortex-m`, this setup means that they don't have to install
17-
//! any binutils, assembler, or C compiler to hack on the crate. All they need is a nightly rustc
18-
//! and run `cargo xtask assemble` to rebuild the archives from this file.
17+
//! any binutils, assembler, or C compiler to hack on the crate. All they need is to run `cargo
18+
//! xtask assemble` to rebuild the archives from this file.
1919
//!
2020
//! Cool, right?
2121
//!
22+
//! # Rust version management
23+
//!
24+
//! Since inline assembly is still unstable, and we want to ensure that the created blobs are
25+
//! up-to-date in CI, we have to pin the nightly version we use for this. The nightly toolchain is
26+
//! stored in `asm-toolchain`.
27+
//!
28+
//! The `cargo xtask` automation will automatically install the `asm-toolchain` as well as all
29+
//! Cortex-M targets needed to generate the blobs.
30+
//!
2231
//! [linker plugin LTO]: https://doc.rust-lang.org/stable/rustc/linker-plugin-lto.html
2332
2433
#![feature(asm)]

bin/thumbv6m-none-eabi-lto.a

76 Bytes
Binary file not shown.

bin/thumbv6m-none-eabi.a

16 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi-lto.a

72 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi.a

16 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf-lto.a

72 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf.a

16 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi-lto.a

80 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi.a

12 Bytes
Binary file not shown.

bin/thumbv8m.base-none-eabi-lto.a

64 Bytes
Binary file not shown.

bin/thumbv8m.base-none-eabi.a

16 Bytes
Binary file not shown.

bin/thumbv8m.main-none-eabi-lto.a

84 Bytes
Binary file not shown.

bin/thumbv8m.main-none-eabi.a

16 Bytes
Binary file not shown.

bin/thumbv8m.main-none-eabihf-lto.a

76 Bytes
Binary file not shown.

bin/thumbv8m.main-none-eabihf.a

16 Bytes
Binary file not shown.

ci/install.sh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@ main() {
55
thumbv*-none-eabi*)
66
rustup target add $TARGET
77
;;
8-
x86_64-unknown-linux-gnu)
9-
# We need *all* targets and nightly as we're checking the blobs.
10-
rustup install nightly
11-
rustup target add \
12-
thumbv6m-none-eabi \
13-
thumbv7m-none-eabi \
14-
thumbv7em-none-eabi \
15-
thumbv7em-none-eabihf \
16-
thumbv8m.base-none-eabi \
17-
thumbv8m.main-none-eabi \
18-
thumbv8m.main-none-eabihf \
19-
--toolchain nightly
20-
;;
218
esac
229
}
2310

xtask/src/main.rs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44
//!
55
//! Also see the docs in `asm.rs`.
66
7+
use process::Stdio;
78
use std::env::{self, current_dir};
89
use std::{
910
collections::BTreeMap,
1011
fs::{self, File},
1112
process::{self, Command},
1213
};
1314

15+
fn toolchain() -> String {
16+
fs::read_to_string("asm-toolchain")
17+
.unwrap()
18+
.trim()
19+
.to_string()
20+
}
21+
1422
fn rustc() -> Command {
1523
let mut cmd = Command::new("rustc");
16-
cmd.arg("+nightly");
24+
cmd.arg(format!("+{}", toolchain()));
1725
cmd
1826
}
1927

@@ -105,6 +113,34 @@ static TARGETS: &[(&str, &[&str])] = &[
105113
];
106114

107115
fn assemble_blobs() {
116+
let mut cmd = rustc();
117+
cmd.arg("-V");
118+
cmd.stdout(Stdio::null());
119+
let status = cmd.status().unwrap();
120+
121+
if !status.success() {
122+
let toolchain = toolchain();
123+
println!(
124+
"asm toolchain {} does not seem to be installed. installing it now.",
125+
toolchain
126+
);
127+
128+
let mut rustup = Command::new("rustup");
129+
let status = rustup.arg("install").arg(&toolchain).status().unwrap();
130+
assert!(status.success(), "rustup command failed: {:?}", rustup);
131+
132+
let mut rustup = Command::new("rustup");
133+
let status = rustup
134+
.arg("target")
135+
.arg("add")
136+
.args(TARGETS.iter().map(|(target, _)| *target))
137+
.arg("--toolchain")
138+
.arg(toolchain)
139+
.status()
140+
.unwrap();
141+
assert!(status.success(), "rustup command failed: {:?}", rustup);
142+
}
143+
108144
for (target, cfgs) in TARGETS {
109145
println!("building artifacts for {}", target);
110146
assemble(target, cfgs);

0 commit comments

Comments
 (0)