|
| 1 | +# `aarch64v8r-unknown-none` and `aarch64v8r-unknown-none-softfloat` |
| 2 | + |
| 3 | +* **Tier: 3** |
| 4 | +* **Library Support:** core and alloc (bare-metal, `#![no_std]`) |
| 5 | + |
| 6 | +Bare-metal target for CPUs in the Armv8-R architecture family, running in |
| 7 | +AArch64 mode. Processors in this family include the |
| 8 | +[Arm Cortex-R82][cortex-r82]. |
| 9 | + |
| 10 | +For Armv8-R CPUs running in AArch32 mode (such as the Arm Cortex-R52), see |
| 11 | +[`armv8r-none-eabihf`](armv8r-none-eabihf.md) instead. |
| 12 | + |
| 13 | +[cortex-r82]: https://developer.arm.com/processors/Cortex-R82 |
| 14 | + |
| 15 | +## Target maintainers |
| 16 | + |
| 17 | +- [Rust Embedded Devices Working Group Arm Team] |
| 18 | +- [@rust-lang/arm-maintainers][arm_maintainers] ([rust@arm.com][arm_email]) |
| 19 | + |
| 20 | +[Rust Embedded Devices Working Group Arm Team]: https://github.com/rust-embedded/wg?tab=readme-ov-file#the-arm-team |
| 21 | +[arm_maintainers]: https://github.com/rust-lang/team/blob/master/teams/arm-maintainers.toml |
| 22 | +[arm_email]: mailto:rust@arm.com |
| 23 | + |
| 24 | +## Target CPU and Target Feature options |
| 25 | + |
| 26 | +Unlike AArch64 v8-A processors, not all AArch64 v8-R processors include an FPU |
| 27 | +(that is, not all Armv8-R AArch64 processors implement the optional Armv8 |
| 28 | +`FEAT_FP` extension). If you do not have an FPU, or have an FPU but wish to use |
| 29 | +a soft-float ABI anyway, you should use the `aarch64v8r-unknown-none-softfloat` |
| 30 | +target. If you wish to use the standard hard-float Arm AArch64 calling |
| 31 | +convention, and you have an FPU, you can use the `aarch64v8r-unknown-none` |
| 32 | +target. |
| 33 | + |
| 34 | +When using the `aarch64v8r-unknown-none` target, the minimum floating-point |
| 35 | +features assumed are the Advanced SIMD features (`FEAT_AdvSIMD`, or `+neon`), |
| 36 | +the implementation of which is branded Arm NEON. |
| 37 | + |
| 38 | +If your processor supports a different set of floating-point features than the |
| 39 | +default expectations then these should also be enabled or disabled as needed |
| 40 | +with [`-C target-feature=(+/-)`][target-feature]. However, note that currently |
| 41 | +Rust does not support building hard-float AArch64 targets with Advanced SIMD |
| 42 | +support disabled. It is also possible to tell Rust (or LLVM) that you have a |
| 43 | +specific model of Arm processor, using the [`-Ctarget-cpu`][target-cpu] option. |
| 44 | +Doing so may change the default set of target-features enabled. |
| 45 | + |
| 46 | +[target-feature]: https://doc.rust-lang.org/rustc/codegen-options/index.html#target-feature |
| 47 | +[target-cpu]: https://doc.rust-lang.org/rustc/codegen-options/index.html#target-cpu |
| 48 | + |
| 49 | +## Requirements |
| 50 | + |
| 51 | +These targets are cross-compiled and use static linking. |
| 52 | + |
| 53 | +By default, the `lld` linker included with Rust will be used; however, you may |
| 54 | +want to use the GNU linker instead. This can be obtained for Windows/Mac/Linux |
| 55 | +from the [Arm Developer Website][arm-gnu-toolchain], or possibly from your OS's |
| 56 | +package manager. To use it, add the following to your `.cargo/config.toml`: |
| 57 | + |
| 58 | +```toml |
| 59 | +[target.aarch64-unknown-none] |
| 60 | +linker = "aarch64-none-elf-ld" |
| 61 | +``` |
| 62 | + |
| 63 | +The GNU linker can also be used by specifying `aarch64-none-elf-gcc` as the |
| 64 | +linker. This is needed when using GCC's link time optimization. |
| 65 | + |
| 66 | +These targets don't provide a linker script, so you'll need to bring your own |
| 67 | +according to the specific device you are using. Pass |
| 68 | +`-Clink-arg=-Tyour_script.ld` as a rustc argument to make the linker use |
| 69 | +`your_script.ld` during linking. |
| 70 | + |
| 71 | +[arm-gnu-toolchain]: https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain |
| 72 | + |
| 73 | +## Cross-compilation toolchains and C code |
| 74 | + |
| 75 | +This target supports C code compiled with the `aarch64-none-elf` target |
| 76 | +triple and a suitable `-march` or `-mcpu` flag. |
| 77 | + |
| 78 | +## Start-up and Low-Level Code |
| 79 | + |
| 80 | +The [Rust Embedded Devices Working Group Arm Team] maintain the |
| 81 | +[`aarch64-cpu`] crate, which may be useful for writing bare-metal code using |
| 82 | +this target. |
| 83 | + |
| 84 | +[`aarch64-cpu`]: https://docs.rs/aarch64-cpu |
0 commit comments