Skip to content

Commit 965a970

Browse files
committed
targets: thumbv8m: Add target for baseline ARMv8-M
1 parent b8b4150 commit 965a970

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

src/librustc_target/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ supported_targets! {
397397
("thumbv7m-none-eabi", thumbv7m_none_eabi),
398398
("thumbv7em-none-eabi", thumbv7em_none_eabi),
399399
("thumbv7em-none-eabihf", thumbv7em_none_eabihf),
400+
("thumbv8m-none-eabi", thumbv8m_none_eabi),
400401

401402
("msp430-none-elf", msp430_none_elf),
402403

src/librustc_target/spec/thumb_base.rs

Lines changed: 3 additions & 2 deletions
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 targets 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
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
max_atomic_width: Some(32),
30+
.. super::thumb_base::opts()
31+
},
32+
})
33+
}

0 commit comments

Comments
 (0)