Skip to content

Commit f06a1fa

Browse files
committed
Add an target to support the Cortex-R52.
1 parent 268dbbb commit f06a1fa

File tree

6 files changed

+79
-0
lines changed

6 files changed

+79
-0
lines changed

Diff for: compiler/rustc_target/src/spec/armv8r_none_eabihf.rs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
2+
3+
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
4+
5+
pub fn target() -> Target {
6+
Target {
7+
llvm_target: "armv8r-none-eabihf".into(),
8+
pointer_width: 32,
9+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
10+
arch: "arm".into(),
11+
12+
options: TargetOptions {
13+
abi: "eabihf".into(),
14+
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
15+
linker: Some("rust-lld".into()),
16+
relocation_model: RelocModel::Static,
17+
panic_strategy: PanicStrategy::Abort,
18+
// The Cortex-R52 has two variants with respect to floating-point support:
19+
// 1. fp-armv8, SP-only, with 16 DP (32 SP) registers
20+
// 2. neon-fp-armv8, SP+DP, with 32 DP registers
21+
// Use the lesser of these two options as the default, as it will produce code
22+
// compatible with either variant.
23+
//
24+
// Reference:
25+
// Arm Cortex-R52 Processor Technical Reference Manual
26+
// - Chapter 15 Advanced SIMD and floating-point support
27+
features: "+fp-armv8,-fp64,-d32".into(),
28+
max_atomic_width: Some(64),
29+
emit_debug_gdb_scripts: false,
30+
// GCC defaults to 8 for arm-none here.
31+
c_enum_min_bits: Some(8),
32+
..Default::default()
33+
},
34+
}
35+
}

Diff for: compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,7 @@ supported_targets! {
15431543
("armebv7r-none-eabihf", armebv7r_none_eabihf),
15441544
("armv7r-none-eabi", armv7r_none_eabi),
15451545
("armv7r-none-eabihf", armv7r_none_eabihf),
1546+
("armv8r-none-eabihf", armv8r_none_eabihf),
15461547

15471548
("x86_64-pc-solaris", x86_64_pc_solaris),
15481549
("sparcv9-sun-solaris", sparcv9_sun_solaris),

Diff for: src/doc/rustc/src/platform-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ target | std | notes
160160
[`armv7a-none-eabi`](platform-support/arm-none-eabi.md) | * | Bare ARMv7-A
161161
[`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare ARMv7-R
162162
[`armv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Bare ARMv7-R, hardfloat
163+
`armv8r-none-eabihf` | * | Bare ARMv8-R, hardfloat
163164
`i586-pc-windows-msvc` | * | 32-bit Windows w/o SSE [^x86_32-floats-x87]
164165
`i586-unknown-linux-gnu` | ✓ | 32-bit Linux w/o SSE (kernel 3.2, glibc 2.17) [^x86_32-floats-x87]
165166
`i586-unknown-linux-musl` | ✓ | 32-bit Linux w/o SSE, MUSL [^x86_32-floats-x87]

Diff for: src/doc/rustc/src/platform-support/arm-none-eabi.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [{arm,thumb}v4t-none-eabi](armv4t-none-eabi.md)
1414
- [{arm,thumb}v5te-none-eabi](armv5te-none-eabi.md)
1515
- armv7a-none-eabihf
16+
- [armv8r-none-eabihf](armv8r-none-eabihf.md)
1617

1718
Bare-metal target for 32-bit ARM CPUs.
1819

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# `armv8r-none-eabihf`
2+
3+
**Tier: 3**
4+
5+
Bare-metal target for CPUs in the ARMv8-R architecture family, supporting
6+
dual ARM/Thumb mode, with ARM mode as the default.
7+
8+
Processors in this family include the Arm [Cortex-R52][cortex-r52]
9+
and [Cortex-R52+][cortex-r52-plus].
10+
11+
See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
12+
`arm-none-eabi` targets.
13+
14+
[cortex-r52]: https://www.arm.com/products/silicon-ip-cpu/cortex-r/cortex-r52
15+
[cortex-r52-plus]: https://www.arm.com/products/silicon-ip-cpu/cortex-r/cortex-r52-plus
16+
17+
## Target maintainers
18+
19+
- [Chris Copeland](https://github.com./chrisnc), `[email protected]`
20+
21+
## Requirements
22+
23+
The Cortex-R52 family always includes a floating-point unit, so there is no
24+
non-`hf` version of this target. The floating-point features assumed by this
25+
target are those of the single-precision-only config of the Cortex-R52, which
26+
has 16 double-precision registers, accessible as 32 single-precision registers.
27+
The other variant of Cortex-R52 includes double-precision, 32 double-precision
28+
registers, and Advanced SIMD (Neon).
29+
30+
The manual refers to this as the "Full Advanced SIMD config". To compile code
31+
for this variant, use: `-C target-feature=+fp64,+d32,+neon`. See the [Advanced
32+
SIMD and floating-point support][fpu] section of the Cortex-R52 Processor
33+
Technical Reference Manual for more details.
34+
35+
[fpu]: https://developer.arm.com/documentation/100026/0104/Advanced-SIMD-and-floating-point-support/About-the-Advanced-SIMD-and-floating-point-support
36+
37+
## Cross-compilation toolchains and C code
38+
39+
This target supports C code compiled with the `arm-none-eabi` target triple and
40+
`-march=armv8-r` or a suitable `-mcpu` flag.

Diff for: src/tools/build-manifest/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static TARGETS: &[&str] = &[
8383
"armebv7r-none-eabihf",
8484
"armv7r-none-eabi",
8585
"armv7r-none-eabihf",
86+
"armv8r-none-eabihf",
8687
"armv7s-apple-ios",
8788
"bpfeb-unknown-none",
8889
"bpfel-unknown-none",

0 commit comments

Comments
 (0)