Many Arm microcontoller target feature flags are missing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
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 https://github.com/rust-lang/rust/pull/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-fpregsbecause 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-m0cortex-m0pluscortex-m3cortex-m4cortex-m7cortex-m33cortex-m35pcortex-m55cortex-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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Arm microcontroller platform-support page and its sub-pages referenced in the issue, then inspect how the listed target-cpu and target-feature flags are represented in Rust's compiler support. Compare the documented flags with the unsupported list. Done means the requested Arm feature flags are supported and the relevant documentation reflects the available enable and disable options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100