Skip to content

Commit e30cbd8

Browse files
bors[bot]adamgreig
andauthored
Merge #262
262: Add testing linker=arm-none-eabi-gcc and MSRV to CI r=therealprof a=adamgreig Replacing #260. This PR extends our current tests with `linker=rust-lld` and `linker=arm-none-eabi-ld` to include `linker=arm-none-eabi-gcc`, since those options are all included in our example [`.cargo/config`](https://github.com/rust-embedded/cortex-m-rt/blob/master/.cargo/config). It looks like another linker only adds a handful of seconds to CI, since most time is spent building dependencies once. It also adds a test with Rust 1.32.0 to the CI as a candidate MSRV. Building with 1.31.0 fails because of the dev-dependency on cortex-m-semihosting 0.3.5: ``` error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075) --> /home/adam/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc6299db9ec823/cortex-m-semihosting-0.3.5/src/macros.rs:111:25 | 111 | ($($val:expr),+ $(,)?) => { | ^ error: expected `*` or `+` ``` That's just a test error which end users wouldn't experience, so we could consider making 1.31.0 the MSRV and working around the c-m-semihosting issue. I don't know if there are other 1.31.0 issues. Finally the PR removes the travis check preventing builds on pushes to master. In principle we know that builds to master succeed because bors tests them before pushing, so adding the extra check mostly means we get a well-defined build status from Travis for flags etc. The build times for cortex-m-rt (around 3min overall) are a bit longer than r0 (where we did the same thing), so we could just run a minimal test here instead. I don't think it's a significant overhead given how infrequently we push to master, though. Co-authored-by: Adam Greig <[email protected]>
2 parents 3222d51 + 3603333 commit e30cbd8

File tree

3 files changed

+51
-51
lines changed

3 files changed

+51
-51
lines changed

cortex-m-rt/.travis.yml

+21-12
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,62 @@ matrix:
44
allow_failures:
55
- rust: nightly
66
include:
7+
# MSRV 1.39.0 #############################################################
8+
- env: TARGET=x86_64-unknown-linux-gnu
9+
rust: 1.39.0
10+
11+
- env: TARGET=thumbv6m-none-eabi
12+
rust: 1.39.0
13+
14+
- env: TARGET=thumbv7m-none-eabi
15+
rust: 1.39.0
16+
17+
- env: TARGET=thumbv7em-none-eabi
18+
rust: 1.39.0
19+
20+
- env: TARGET=thumbv7em-none-eabihf
21+
rust: 1.39.0
22+
23+
- env: TARGET=thumbv8m.main-none-eabi
24+
rust: 1.39.0
25+
26+
# Stable ##################################################################
727
- env: TARGET=x86_64-unknown-linux-gnu
828
rust: stable
9-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
1029

1130
- env: TARGET=thumbv6m-none-eabi
1231
rust: stable
13-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
1432

1533
- env: TARGET=thumbv7m-none-eabi
1634
rust: stable
17-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
1835

1936
- env: TARGET=thumbv7em-none-eabi
2037
rust: stable
21-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
2238

2339
- env: TARGET=thumbv7em-none-eabihf
2440
rust: stable
25-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
2641

2742
- env: TARGET=thumbv8m.main-none-eabi
2843
rust: stable
29-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
3044

45+
# Nightly #################################################################
3146
- env: TARGET=x86_64-unknown-linux-gnu
3247
rust: nightly
33-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
3448

3549
- env: TARGET=thumbv6m-none-eabi
3650
rust: nightly
37-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
3851

3952
- env: TARGET=thumbv7m-none-eabi
4053
rust: nightly
41-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
4254

4355
- env: TARGET=thumbv7em-none-eabi
4456
rust: nightly
45-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
4657

4758
- env: TARGET=thumbv7em-none-eabihf
4859
rust: nightly
49-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
5060

5161
- env: TARGET=thumbv8m.main-none-eabi
5262
rust: nightly
53-
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
5463

5564
before_install: set -e
5665

cortex-m-rt/ci/script.sh

+25-39
Original file line numberDiff line numberDiff line change
@@ -32,54 +32,40 @@ main() {
3232
local fail_examples=(
3333
data_overflow
3434
)
35+
local linkers=(
36+
# Link with arm-none-eabi-ld
37+
"-C linker=arm-none-eabi-ld"
38+
# Link with arm-none-eabi-gcc, requires -nostartfiles
39+
"-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles"
40+
# Link with rust-lld (default)
41+
""
42+
)
3543
if [ "$TARGET" != x86_64-unknown-linux-gnu ]; then
3644
RUSTDOCFLAGS="-Cpanic=abort" cargo test --doc
3745

38-
# linking with GNU LD
39-
for ex in "${examples[@]}"; do
40-
cargo rustc --target "$TARGET" --example "$ex" -- \
41-
-C linker=arm-none-eabi-ld
42-
43-
cargo rustc --target "$TARGET" --example "$ex" --release -- \
44-
-C linker=arm-none-eabi-ld
45-
done
46-
for ex in "${fail_examples[@]}"; do
47-
! cargo rustc --target "$TARGET" --example "$ex" -- \
48-
-C linker=arm-none-eabi-ld
49-
50-
! cargo rustc --target "$TARGET" --example "$ex" --release -- \
51-
-C linker=arm-none-eabi-ld
52-
done
53-
54-
cargo rustc --target "$TARGET" --example device --features device -- \
55-
-C linker=arm-none-eabi-ld
56-
57-
cargo rustc --target "$TARGET" --example device --features device --release -- \
58-
-C linker=arm-none-eabi-ld
59-
60-
# linking with rustc's LLD
61-
for ex in "${examples[@]}"; do
62-
cargo rustc --target "$TARGET" --example "$ex"
63-
cargo rustc --target "$TARGET" --example "$ex" --release
46+
for linker in "${linkers[@]}"; do
47+
for ex in "${examples[@]}"; do
48+
cargo rustc --target "$TARGET" --example "$ex" -- $linker
49+
cargo rustc --target "$TARGET" --example "$ex" --release -- $linker
50+
done
51+
for ex in "${fail_examples[@]}"; do
52+
! cargo rustc --target "$TARGET" --example "$ex" -- $linker
53+
! cargo rustc --target "$TARGET" --example "$ex" --release -- $linker
54+
done
55+
cargo rustc --target "$TARGET" --example device --features device -- $linker
56+
cargo rustc --target "$TARGET" --example device --features device --release -- $linker
6457
done
65-
for ex in "${fail_examples[@]}"; do
66-
! cargo rustc --target "$TARGET" --example "$ex"
67-
! cargo rustc --target "$TARGET" --example "$ex" --release
68-
done
69-
70-
cargo rustc --target "$TARGET" --example device --features device
71-
cargo rustc --target "$TARGET" --example device --features device --release
7258
fi
7359

7460
case $TARGET in
7561
thumbv6m-none-eabi|thumbv7m-none-eabi)
76-
# linking with GNU LD
77-
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target "$TARGET" --example qemu | grep "x = 42"
78-
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target "$TARGET" --example qemu --release | grep "x = 42"
62+
for linker in "${linkers[@]}"; do
63+
env RUSTFLAGS="$linker -C link-arg=-Tlink.x" cargo run \
64+
--target "$TARGET" --example qemu | grep "x = 42"
65+
env RUSTFLAGS="$linker -C link-arg=-Tlink.x" cargo run \
66+
--target "$TARGET" --example qemu --release | grep "x = 42"
67+
done
7968

80-
# linking with rustc's LLD
81-
cargo run --target "$TARGET" --example qemu | grep "x = 42"
82-
cargo run --target "$TARGET" --example qemu --release | grep "x = 42"
8369
;;
8470
esac
8571

cortex-m-rt/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@
372372
//! [`MaybeUninit`]: https://doc.rust-lang.org/core/mem/union.MaybeUninit.html
373373
//!
374374
//! ```no_run,edition2018
375+
//! # extern crate core;
375376
//! use core::mem::MaybeUninit;
376377
//!
377378
//! const STACK_SIZE: usize = 8 * 1024;
@@ -388,6 +389,10 @@
388389
//! [attr-entry]: attr.entry.html
389390
//! [attr-exception]: attr.exception.html
390391
//! [attr-pre_init]: attr.pre_init.html
392+
//!
393+
//! # Minimum Supported Rust Version (MSRV)
394+
//!
395+
//! The MSRV of this release is Rust 1.39.0.
391396
392397
// # Developer notes
393398
//

0 commit comments

Comments
 (0)