Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,8 @@ supported_targets! {
("thumbv8m.base-none-eabi", thumbv8m_base_none_eabi),
("thumbv8m.main-none-eabi", thumbv8m_main_none_eabi),
("thumbv8m.main-none-eabihf", thumbv8m_main_none_eabihf),
("thumbv8.1m.main-none-eabi", thumbv81m_main_none_eabi),
("thumbv8.1m.main-none-eabihf", thumbv81m_main_none_eabihf),

("armv7a-none-eabi", armv7a_none_eabi),
("thumbv7a-none-eabi", thumbv7a_none_eabi),
Expand Down
28 changes: 28 additions & 0 deletions compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Targets the Cortex-M55/-M85 processors (Armv8.1-M Mainline architecture profile),
// without the Floating Point extension.

use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};

pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8.1m.main-none-eabi".into(),
metadata: TargetMetadata {
description: Some("Bare ARMv8.1-M Mainline with DSP and LOB".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: Arch::Arm,

options: TargetOptions {
cfg_abi: CfgAbi::Eabi,
llvm_floatabi: Some(FloatAbi::Soft),
// We assume you have the DSP and LOB extensions (which are technically optional).
features: "+dsp,+lob".into(),
max_atomic_width: Some(32),
..base::arm_none::opts()
},
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Targets the Cortex-M55/-M85 processors (Armv8.1-M Mainline architecture profile),
// with the Floating Point extension.
//
// It does not assume you have M-Profile Vector Extensions (aka Helium)

use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};

pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8.1m.main-none-eabihf".into(),
metadata: TargetMetadata {
description: Some("Bare ARMv8.1-M Mainline, hardfloat, with DSP and LOB".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: Arch::Arm,

options: TargetOptions {
Comment thread
adamgemmell marked this conversation as resolved.
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
// The Cortex-M55 and Cortex-M85 both have FPv5-D16 double-precision FPUs
// We also assume you have the DSP and LOB extensions (which are technically optional).
features: "+dsp,+fp-armv8d16,+lob".into(),
max_atomic_width: Some(32),
..base::arm_none::opts()
},
}
}
2 changes: 2 additions & 0 deletions src/bootstrap/src/core/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub struct Finder {
const STAGE0_MISSING_TARGETS: &[&str] = &[
// just a dummy comment so the list doesn't get onelined
"aarch64-unknown-qtee",
"thumbv8.1m.main-none-eabihf",
"thumbv8.1m.main-none-eabi",
];

/// Minimum version threshold for libstdc++ required when using prebuilt LLVM
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
- [thumbv7m-none-eabi](./platform-support/thumbv7m-none-eabi.md)
- [thumbv8m.base-none-eabi](./platform-support/thumbv8m.base-none-eabi.md)
- [thumbv8m.main-none-eabi\*](./platform-support/thumbv8m.main-none-eabi.md)
- [thumbv8.1m.main-none-eabi\*](./platform-support/thumbv8.1m.main-none-eabi.md)
- [armebv7r-none-eabi{,hf}](platform-support/armebv7r-none-eabi.md)
- [arm\*-unknown-linux-\*](./platform-support/arm-linux.md)
- [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
Expand Down
2 changes: 2 additions & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ target | std | host | notes
[`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX
[`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX
[`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat
[`thumbv8.1m.main-none-eabi`](platform-support/thumbv8.1m.main-none-eabi.md) | * | | Bare Armv8.1-M Mainline, with DSP and LOB
[`thumbv8.1m.main-none-eabihf`](platform-support/thumbv8.1m.main-none-eabi.md) | * | | Bare Armv8.1-M Mainline, hardfloat, with DSP and LOB
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
[`wasm32-wali-linux-musl`](platform-support/wasm32-wali-linux.md) | ? | | WebAssembly with [WALI](https://github.com/arjunr2/WALI)
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support/arm-none-eabi.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ their own document.
- [`thumbv7em-none-eabi` and `thumbv7em-none-eabihf`](thumbv7em-none-eabi.md)
- [`thumbv8m.base-none-eabi`](thumbv8m.base-none-eabi.md)
- [`thumbv8m.main-none-eabi` and `thumbv8m.main-none-eabihf`](thumbv8m.main-none-eabi.md)
- [`thumbv8.1m.main-none-eabi` and `thumbv8.1m.main-none-eabihf`](thumbv8.1m.main-none-eabi.md)
- *Legacy* Arm Architectures
- None

Expand Down
111 changes: 111 additions & 0 deletions src/doc/rustc/src/platform-support/thumbv8.1m.main-none-eabi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# `thumbv8.1m.main-none-eabi` and `thumbv8.1m.main-none-eabihf`

* **Tier: 3**
* **Library Support:** core and alloc (bare-metal, `#![no_std]`)

Bare-metal target for CPUs in the Mainline [Armv8.1-M] architecture family,
supporting a subset of the [T32 ISA][t32-isa].

Processors in this family include the:

* [Arm Cortex-M55][cortex-m55]
* [Arm Cortex-M85][cortex-m85]

This target assumes your processor supports the *DSP* and *Low-Overhead Branch* extensions.

See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
`arm-none-eabi` targets, in particular the difference between the `eabi` and
`eabihf` ABI.

[t32-isa]: https://developer.arm.com/Architectures/T32%20Instruction%20Set%20Architecture
[Armv8.1-M]: https://developer.arm.com/documentation/ddi0553/latest/
[cortex-m55]: https://developer.arm.com/Processors/Cortex-M55
[cortex-m85]: https://developer.arm.com/Processors/Cortex-M85

## Target maintainers

- [Rust Embedded Devices Working Group Arm Team](https://github.com/rust-embedded/wg?tab=readme-ov-file#the-arm-team)
- [arm-maintainers][arm_maintainers] ([rust@arm.com][arm_email])
- Use `@rustbot ping arm-maintainers` to ping us

[arm_maintainers]: https://github.com/rust-lang/team/blob/master/teams/arm-maintainers.toml
[arm_email]: mailto:rust@arm.com

## Target CPU and Target Feature options

See [the bare-metal Arm
docs](arm-none-eabi.md#target-cpu-and-target-feature-options) for details on how
to use these flags.

### Table of supported CPUs for `thumbv8.1m.main-none-eabi`

| CPU | FPU | MVE | Target CPU | Target Features |
| ----------- | --- | --------- | ------------- | --------------------- |
| Unspecified | No | No | None | None |
| Cortex-M55 | No | No | `cortex-m55` | `-fpregs,-mve` |
| Cortex-M55 | DP | No | `cortex-m55` | `-mve` |
| Cortex-M55 | No | Int | `cortex-m55` | `-fpregs,-mve.fp,+mve`|
| Cortex-M55 | DP | Int | `cortex-m55` | `-mve.fp` |
| Cortex-M55 | DP | Int+Float | `cortex-m55` | None |
| Cortex-M85 | No | No | `cortex-m85` | `-fpregs,-mve` |
| Cortex-M85 | DP | No | `cortex-m85` | `-mve` |
| Cortex-M85 | No | Int | `cortex-m85` | `-fpregs,-mve.fp,+mve`|
| Cortex-M85 | DP | Int | `cortex-m85` | `-mve.fp` |
| Cortex-M85 | DP | Int+Float | `cortex-m85` | None |

### Table of supported CPUs for `thumbv8.1m.main-none-eabihf`

| CPU | FPU | MVE | Target CPU | Target Features |
| ----------- | --- | --------- | ------------- | --------------------- |
| Unspecified | DP | No | None | None |
| Cortex-M55 | DP | No | `cortex-m55` | `-mve` |
| Cortex-M55 | DP | Int | `cortex-m55` | `-mve.fp` |
| Cortex-M55 | DP | Int+Float | `cortex-m55` | None |
| Cortex-M85 | DP | No | `cortex-m85` | `-mve` |
| Cortex-M85 | DP | Int | `cortex-m85` | `-mve.fp` |
| Cortex-M85 | DP | Int+Float | `cortex-m85` | None |

*Technically* you can use this hard-float ABI on a CPU which has no FPU but does
have Integer MVE, because MVE provides the same set of registers as the FPU
(including `s0` and `d0`). The particular set of flags that might enable this
unusual scenario are currently not recorded here.

<div class="warning">

Never use the `-fpregs` *target-feature* with the `thumbv8.1m.main-none-eabihf`
target as it will cause compilation units to have different ABIs, which is
unsound.

</div>

### M-Profile Vector Extensions

The M-Profile Vector Extensions (also known as MVE, and marketed as "Helium") allow the processor to perform SIMD operations. MVE is available in either *integer-only* or *integer-and-float* variants. This target does not assume MVE support by default, but it can be added by specifying a *target-cpu*, or using certain *target-features* (noted below).

### Arm Cortex-M55

The target CPU is `cortex-m55`.

* Has an optional double-precision FPU that also supports half-precision FP16
values
* support is enabled by default with this *target-cpu* the 'eabihf' target
* disable support using the `-fpregs` *target-feature* (`eabi` only)
* Has optional support for M-Profile Vector Extensions
* The appropriate feature for the MVE is either `mve` (integer) or `mve.fp`
(float)
* `mve.fp` is enabled by default on this *target-cpu*
* disable using `-mve.fp` (disable float MVE) or `-mve` (disable all MVE)

### Arm Cortex-M85

The target CPU is `cortex-m85`.

* Has an optional double-precision FPU that also supports half-precision FP16
values
* support is enabled by default with this *target-cpu* or the 'eabihf' target
* disable support using the `-fpregs` *target-feature* (`eabi` only)
* Has optional support for M-Profile Vector Extensions
* The appropriate feature for the MVE is either `mve` (integer) or `mve.fp`
(float)
* `mve.fp` is enabled by default on this *target-cpu*
* disable using `-mve.fp` (disable float MVE) or `-mve` (disable all MVE)
63 changes: 0 additions & 63 deletions src/doc/rustc/src/platform-support/thumbv8m.main-none-eabi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Processors in this family include the:

* [Arm Cortex-M33][cortex-m33]
* [Arm Cortex-M35P][cortex-m35p]
* [Arm Cortex-M55][cortex-m55]
* [Arm Cortex-M85][cortex-m85]

See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
`arm-none-eabi` targets, in particular the difference between the `eabi` and
Expand All @@ -21,8 +19,6 @@ See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
[Armv8-M]: https://developer.arm.com/documentation/ddi0553/latest/
[cortex-m33]: https://developer.arm.com/Processors/Cortex-M33
[cortex-m35p]: https://developer.arm.com/Processors/Cortex-M35P
[cortex-m55]: https://developer.arm.com/Processors/Cortex-M55
[cortex-m85]: https://developer.arm.com/Processors/Cortex-M85

## Target maintainers

Expand Down Expand Up @@ -52,16 +48,6 @@ to use these flags.
| Cortex-M35P | No | Yes | No | `cortex-m35p` | `-fpregs` |
| Cortex-M35P | SP | No | No | `cortex-m35p` | `-dsp` |
| Cortex-M35P | SP | Yes | No | `cortex-m35p` | None |
| Cortex-M55 | No | Yes | No | `cortex-m55` | `-fpregs,-mve` |
| Cortex-M55 | DP | Yes | No | `cortex-m55` | `-mve` |
| Cortex-M55 | No | Yes | Int | `cortex-m55` | `-fpregs,-mve.fp,+mve`|
| Cortex-M55 | DP | Yes | Int | `cortex-m55` | `-mve.fp` |
| Cortex-M55 | DP | Yes | Int+Float | `cortex-m55` | None |
| Cortex-M85 | No | Yes | No | `cortex-m85` | `-fpregs,-mve` |
| Cortex-M85 | DP | Yes | No | `cortex-m85` | `-mve` |
| Cortex-M85 | No | Yes | Int | `cortex-m85` | `-fpregs,-mve.fp,+mve`|
| Cortex-M85 | DP | Yes | Int | `cortex-m85` | `-mve.fp` |
| Cortex-M85 | DP | Yes | Int+Float | `cortex-m85` | None |

### Table of supported CPUs for `thumbv8m.main-none-eabihf`

Expand All @@ -72,17 +58,6 @@ to use these flags.
| Cortex-M33 | SP | Yes | No | `cortex-m33` | None |
| Cortex-M33P | SP | No | No | `cortex-m35p` | `-dsp` |
| Cortex-M33P | SP | Yes | No | `cortex-m35p` | None |
| Cortex-M55 | DP | Yes | No | `cortex-m55` | `-mve` |
| Cortex-M55 | DP | Yes | Int | `cortex-m55` | `-mve.fp` |
| Cortex-M55 | DP | Yes | Int+Float | `cortex-m55` | None |
| Cortex-M85 | DP | Yes | No | `cortex-m85` | `-mve` |
| Cortex-M85 | DP | Yes | Int | `cortex-m85` | `-mve.fp` |
| Cortex-M85 | DP | Yes | Int+Float | `cortex-m85` | None |

*Technically* you can use this hard-float ABI on a CPU which has no FPU but does
have Integer MVE, because MVE provides the same set of registers as the FPU
(including `s0` and `d0`). The particular set of flags that might enable this
unusual scenario are currently not recorded here.

<div class="warning">

Expand Down Expand Up @@ -113,41 +88,3 @@ The target CPU is `cortex-m35p`.
* Has an optional single precision FPU
* support is enabled by default with this *target-cpu*
* disable support using the `-fpregs` *target-feature* (`eabi` only)

### Arm Cortex-M55

The target CPU is `cortex-m55`.

* Has DSP extensions
* support is controlled by the `dsp` *target-feature*
* enabled by default with this *target-cpu*
* Has an optional double-precision FPU that also supports half-precision FP16
values
* support is enabled by default with this *target-cpu*
* disable support using the `-fpregs` *target-feature* (`eabi` only)
* Has optional support for M-Profile Vector Extensions
* Also known as *Helium Technology*
* Available with only integer support, or both integer/float support
* The appropriate feature for the MVE is either `mve` (integer) or `mve.fp`
(float)
* `mve.fp` is enabled by default on this target CPU
* disable using `-mve.fp` (disable float MVE) or `-mve` (disable all MVE)

### Arm Cortex-M85

The target CPU is `cortex-m85`.

* Has DSP extensions
* support is controlled by the `dsp` *target-feature*
* enabled by default with this *target-cpu*
* Has an optional double-precision FPU that also supports half-precision FP16
values
* support is enabled by default with this *target-cpu*
* disable support using the `-fpregs` *target-feature* (`eabi` only)
* Has optional support for M-Profile Vector Extensions
* Also known as *Helium Technology*
* Available with only integer support, or both integer/float support
* The appropriate feature for the MVE is either `mve` (integer) or `mve.fp`
(float)
* `mve.fp` is enabled by default on this target CPU
* disable using `-mve.fp` (disable float MVE) or `-mve` (disable all MVE)
2 changes: 2 additions & 0 deletions src/tools/tier-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ fn main() {
"thumbv8m.base-none-eabi",
"thumbv8m.main-none-eabi",
"thumbv8m.main-none-eabihf",
"thumbv8.1m.main-none-eabi",
"thumbv8.1m.main-none-eabihf",
"thumbv8m.base-nuttx-eabi",
"thumbv8m.main-nuttx-eabi",
"thumbv8m.main-nuttx-eabihf",
Expand Down
6 changes: 6 additions & 0 deletions tests/assembly-llvm/targets/targets-elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,15 @@
//@ revisions: thumbv8m_main_none_eabi
//@ [thumbv8m_main_none_eabi] compile-flags: --target thumbv8m.main-none-eabi
//@ [thumbv8m_main_none_eabi] needs-llvm-components: arm
//@ revisions: thumbv81m_main_none_eabi
//@ [thumbv81m_main_none_eabi] compile-flags: --target thumbv8.1m.main-none-eabi
//@ [thumbv81m_main_none_eabi] needs-llvm-components: arm
//@ revisions: thumbv8m_main_none_eabihf
//@ [thumbv8m_main_none_eabihf] compile-flags: --target thumbv8m.main-none-eabihf
//@ [thumbv8m_main_none_eabihf] needs-llvm-components: arm
//@ revisions: thumbv81m_main_none_eabihf
//@ [thumbv81m_main_none_eabihf] compile-flags: --target thumbv8.1m.main-none-eabihf
//@ [thumbv81m_main_none_eabihf] needs-llvm-components: arm
//@ revisions: wasm32_unknown_emscripten
//@ [wasm32_unknown_emscripten] compile-flags: --target wasm32-unknown-emscripten
//@ [wasm32_unknown_emscripten] needs-llvm-components: webassembly
Expand Down
Loading