Skip to content

Commit 1d40f01

Browse files
bors[bot]thejpster
andcommitted
Merge #182
182: Add thumbv8m.main support. r=korken89 a=thejpster * Add thumbv8m.main support. * Also adds feature flags into build.rs so SecureFault gets included. Co-authored-by: Jonathan 'theJPster' Pallant <[email protected]>
2 parents 02317e6 + bb25ff4 commit 1d40f01

11 files changed

+60
-17
lines changed

cortex-m-rt/.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ matrix:
2222
rust: stable
2323
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
2424

25+
- env: TARGET=thumbv8m.main-none-eabi
26+
rust: stable
27+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
28+
2529
- env: TARGET=x86_64-unknown-linux-gnu
2630
rust: nightly
2731
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
@@ -42,6 +46,10 @@ matrix:
4246
rust: nightly
4347
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
4448

49+
- env: TARGET=thumbv8m.main-none-eabi
50+
rust: nightly
51+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
52+
4553
before_install: set -e
4654

4755
install:

cortex-m-rt/Cargo.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,21 @@ autoexamples = true
1919
r0 = "0.2.2"
2020
cortex-m-rt-macros = { path = "macros", version = "0.1.5" }
2121

22+
[target.thumbv7em-none-eabihf.dev-dependencies]
23+
cortex-m-semihosting = "0.3.1"
24+
25+
[target.thumbv7em-none-eabi.dev-dependencies]
26+
cortex-m-semihosting = "0.3.1"
27+
28+
[target.thumbv7m-none-eabi.dev-dependencies]
29+
cortex-m-semihosting = "0.3.1"
30+
31+
[target.thumbv6m-none-eabi.dev-dependencies]
32+
cortex-m-semihosting = "0.3.1"
33+
2234
[dev-dependencies]
23-
cortex-m = ">= 0.5.7, <0.7"
35+
cortex-m = "0.6"
2436
panic-halt = "0.2.0"
25-
cortex-m-semihosting = "0.3.1"
2637

2738
[dev-dependencies.rand]
2839
default-features = false

cortex-m-rt/assemble.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ ar crs bin/thumbv7em-none-eabihf.a bin/$crate.o
2222
arm-none-eabi-as -march=armv8-m.base asm.s -o bin/$crate.o
2323
ar crs bin/thumbv8m.base-none-eabi.a bin/$crate.o
2424

25+
arm-none-eabi-as -march=armv8-m.main asm.s -o bin/$crate.o
26+
ar crs bin/thumbv8m.main-none-eabi.a bin/$crate.o
27+
2528
rm bin/$crate.o

cortex-m-rt/bin/thumbv6m-none-eabi.a

0 Bytes
Binary file not shown.

cortex-m-rt/bin/thumbv7em-none-eabi.a

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

cortex-m-rt/bin/thumbv7m-none-eabi.a

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
944 Bytes
Binary file not shown.

cortex-m-rt/build.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ fn main() {
88
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
99

1010
has_fpu(&target);
11-
let is_armv6m = is_armv6m(&target);
1211

1312
if target.starts_with("thumbv") {
1413
fs::copy(
@@ -43,7 +42,23 @@ INCLUDE device.x"#
4342
f
4443
};
4544

46-
let max_int_handlers = if is_armv6m { 32 } else { 240 };
45+
let max_int_handlers = if target.starts_with("thumbv6m-") {
46+
println!("cargo:rustc-cfg=cortex_m");
47+
println!("cargo:rustc-cfg=armv6m");
48+
32
49+
} else if target.starts_with("thumbv7m-") || target.starts_with("thumbv7em-") {
50+
println!("cargo:rustc-cfg=cortex_m");
51+
println!("cargo:rustc-cfg=armv7m");
52+
240
53+
} else if target.starts_with("thumbv8m") {
54+
println!("cargo:rustc-cfg=cortex_m");
55+
println!("cargo:rustc-cfg=armv8m");
56+
240
57+
} else {
58+
// Non ARM target. We assume you're just testing the syntax.
59+
// This value seems as soon as any
60+
240
61+
};
4762

4863
// checking the size of the interrupts portion of the vector table is sub-architecture dependent
4964
writeln!(
@@ -58,6 +73,10 @@ handlers.");
5873
max_int_handlers
5974
).unwrap();
6075

76+
if target.ends_with("-eabihf") {
77+
println!("cargo:rustc-cfg=has_fpu");
78+
}
79+
6180
println!("cargo:rustc-link-search={}", out.display());
6281

6382
println!("cargo:rerun-if-changed=build.rs");
@@ -69,12 +88,3 @@ fn has_fpu(target: &str) {
6988
println!("cargo:rustc-cfg=has_fpu");
7089
}
7190
}
72-
73-
fn is_armv6m(target: &str) -> bool {
74-
if target.starts_with("thumbv6m-") {
75-
println!("cargo:rustc-cfg=armv6m");
76-
true
77-
} else {
78-
false
79-
}
80-
}

0 commit comments

Comments
 (0)