Skip to content

Commit c8ae2de

Browse files
committed
Auto merge of #55041 - evq:thumbv8m, r=alexcrichton
targets: thumbv8m: Add target for baseline ARMv8-M Tested against a SAM L11 MCU.
2 parents 0c999ed + 8a0666d commit c8ae2de

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

src/librustc_target/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ supported_targets! {
399399
("thumbv7m-none-eabi", thumbv7m_none_eabi),
400400
("thumbv7em-none-eabi", thumbv7em_none_eabi),
401401
("thumbv7em-none-eabihf", thumbv7em_none_eabihf),
402+
("thumbv8m.base-none-eabi", thumbv8m_base_none_eabi),
402403

403404
("msp430-none-elf", msp430_none_elf),
404405

src/librustc_target/spec/thumb_base.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// These 4 `thumbv*` targets cover the ARM Cortex-M family of processors which are widely used in
11+
// These `thumbv*` targets cover the ARM Cortex-M family of processors which are widely used in
1212
// microcontrollers. Namely, all these processors:
1313
//
1414
// - Cortex-M0
@@ -17,8 +17,9 @@
1717
// - Cortex-M3
1818
// - Cortex-M4(F)
1919
// - Cortex-M7(F)
20+
// - Cortex-M23
2021
//
21-
// We have opted for 4 targets instead of one target per processor (e.g. `cortex-m0`, `cortex-m3`,
22+
// We have opted for these instead of one target per processor (e.g. `cortex-m0`, `cortex-m3`,
2223
// etc) because the differences between some processors like the cortex-m0 and cortex-m1 are almost
2324
// non-existent from the POV of codegen so it doesn't make sense to have separate targets for them.
2425
// And if differences exist between two processors under the same target, rustc flags can be used to
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Targets the Cortex-M23 processor (Baseline ARMv8-M)
12+
13+
use spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult};
14+
15+
pub fn target() -> TargetResult {
16+
Ok(Target {
17+
llvm_target: "thumbv8m.base-none-eabi".to_string(),
18+
target_endian: "little".to_string(),
19+
target_pointer_width: "32".to_string(),
20+
target_c_int_width: "32".to_string(),
21+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
22+
arch: "arm".to_string(),
23+
target_os: "none".to_string(),
24+
target_env: String::new(),
25+
target_vendor: String::new(),
26+
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
27+
28+
options: TargetOptions {
29+
// ARMv8-M baseline doesn't support unaligned loads/stores so we disable them
30+
// with +strict-align.
31+
features: "+strict-align".to_string(),
32+
max_atomic_width: Some(32),
33+
.. super::thumb_base::opts()
34+
},
35+
})
36+
}

0 commit comments

Comments
 (0)