Description
@RalfJung asked me to open an issue listing all the useful Arm microcontroller feature flags that are currently entirely unsupported by Rust, not even unstably.
These are all listed at https://doc.rust-lang.org/nightly/rustc/platform-support/arm-none-eabi.html and the sub-pages, as modified by #130987.
Selecting a CPU with -C target-cpu=xxx
causes LLVM to enable all the optional features of that type of CPU. However, sometimes CPUs are sold without certain features (e.g. you can get a Cortex-M4 either with or without an FPU). So, we use these -C target-feature=...
flags to disable some of the things that LLVM over-enthusiastically enabled for us when we selected a target-cpu. If you don't select a target-cpu, you don't need these flags because by default, only the architecture's baseline features are enabled and you never want to turn those off.
-
-fpregs
- don't emit FPU instructions -
-fp64
- don't emit double precision FPU instructions -
-mve
- don't emit Float or Integer M-Profile Vector Extension instructions -
-mve.fp
- don't emit Float M-Profile Vector Extension instructions -
-dsp
- don't emit DSP instructions -
+mve
- do emit Integer M-Profile Vector Extension instructions (used with-fpregs
because MVE uses registers shared with the FPU and those registers are present if you have Integer MVE but no FPU)
These are alongside the following target CPUs (-C target-cpu=...
):
cortex-m0
cortex-m0plus
cortex-m3
cortex-m4
cortex-m7
cortex-m33
cortex-m35p
cortex-m55
cortex-m85
If you don't want to use -C target-cpu...
then the following additional flags can enable certain features. However, these aren't currently mentioned in the documentation (except +mve
because it's listed above).
+mve
- M-Profile Vector Extensions (integer)+mve.fp
- M-Profile Vector Extensions (floating point)+dsp
- DSP extensions+fp-armv8d16sp
- single precision FPU for Armv8-M+fp-armv8d16
- double precision FPU for Armv8-M+vfp4d16sp
- single precision FPU for Armv7E-M+vfp4d16
- double precision FPU for Armv7E-M