-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Update the arm-* and aarch64-* platform docs. #146419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The Rust Embedded Devices Working Group (wg-embedded) Arm Team (t-arm) agreed to listed as maintainers of: * aarch64-unknown-none * aarch64-unknown-none-softfloat * armv7a-none-eabi * armv7r-none-eabi * armv7r-none-eabihf The aarch64-unknown-none* target didn't have a page so I added it. wg-embedded t-arm did not want to take over: * armebv7r-none-eabi * armebv7r-none-eabihf So I gave them their own target page. The current maintainer remains.
8a54175
to
faf0e14
Compare
Force-pushed with fixed markdown formatting. |
This comment has been minimized.
This comment has been minimized.
827e2cd
to
f1abb70
Compare
This comment has been minimized.
This comment has been minimized.
r? @workingjubilee maybe? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may find more nits but the maintainer assent one is blocking, I think.
## Start-up and Low-Level Code | ||
|
||
The [Rust Embedded Devices Working Group Arm Team] maintain the | ||
[`aarch64-cpu`], which may be useful for writing bare-metal code using this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the aarch64-cpu... what?
I think you mean "crate", or you mean to delete the "the" from the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. Fixed.
|
||
```toml | ||
[target.<your-target>] | ||
linker = "arm-none-eabi-ld" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be the right linker name for aarch64 targets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Fixed.
processor supports a different set of floating-point features than the default | ||
expectations of `fp-armv8`, then these should also be enabled or disabled as | ||
needed with `-C target-feature=(+/-)`. For example, | ||
`-Ctarget-feature=+neon-fp-armv8`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this need a comma?
`-Ctarget-feature=+neon-fp-armv8`. | |
`-Ctarget-feature=+neon,-fp-armv8`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. I'll remove the example, as I don't think it's actually helpful.
|
||
## Target maintainers | ||
|
||
* [@chrisnc](https://github.com/chrisnc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm. Hrm.
@chrisnc Do you assent?
@thejpster I am not sure I have seen an assent by Chris to maintain this specific target variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The armebv7r and armv7r targets were on the same page, and so I concluded Chris was the maintainer for both. Pretty sure he wrote the page back in 90893e4.
https://doc.rust-lang.org/beta/rustc/platform-support/armv7r-none-eabi.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format for these was updated a while ago to drop the bullet points for ease of copy-pasting the usernames in GitHub issues and PRs. Please drop those, no matter who's being listed here (and in all the other files) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only looked at the aarch64 document since that's what I'm most familiar with, most of my comments should also apply to the other documents from what I can tell. I'm very happy about more extensive documentation, this is a fairly good first step.
It is possible to tell Rust (or LLVM) that you have a specific model of Arm | ||
processor, using the [`-Ctarget-cpu`][target-cpu] option. You can also control | ||
whether Rust (or LLVM) will include instructions that target optional hardware | ||
features, e.g. hardware floating-point, or Advanced SIMD operations, using | ||
[`-Ctarget-feature`][target-feature]. | ||
|
||
It is important to note that selecting a *target-cpu* will typically enable | ||
*all* the optional features available from Arm on that model of CPU and your | ||
particular implementation of that CPU may not have those features available. | ||
In that case, you can use `-Ctarget-feature=-option` to turn off the specific | ||
CPU features you do not have available, leaving you with the optimized | ||
instruction scheduling and support for the features you do have. More details | ||
are available in the detailed target-specific documentation. | ||
|
||
<div class="warning"> | ||
|
||
Many target-features are currently unstable and subject to change, and | ||
if you use them you should disassemble the compiler output and manually inspect | ||
it to ensure only appropriate instructions for your CPU have been generated. | ||
|
||
</div> | ||
|
||
If you wish to use the *target-cpu* and *target-feature* options, you can add | ||
them to your `.cargo/config.toml` file alongside any other flags your project | ||
uses (likely linker related ones): | ||
|
||
```toml | ||
rustflags = [ | ||
# Usual Arm bare-metal linker setup | ||
"-Clink-arg=-Tlink.x", | ||
"-Clink-arg=--nmagic", | ||
# tell Rust we have a Cortex-A72 | ||
"-Ctarget-cpu=cortex-a72", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally not a fan of having such very general compiler flags documented or explained in target-specific documentation. It makes a lot of sense to show an example of using a linker script, since this is a bare-metal target, but target-cpu
/target-feature
really isn't specific to this family of targets and I'm not a fan of encouraging duplicating this across all the target documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it documented anywhere else? If so, we can do a PR to remove it from all the target pages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed surplus text from aarch64-unknown-none.md.
All AArch64 processors include an FPU. The difference between the `-none` and | ||
`-none-softfloat` targets is whether the FPU is used for passing function arguments. | ||
You may prefer the `-softfloat` target when writing a kernel or interfacing with | ||
pre-compiled binaries that use the soft-float ABI. | ||
|
||
When using the hardfloat targets, the minimum floating-point features assumed | ||
are those of the `fp-armv8`, which excludes NEON SIMD support. If your | ||
processor supports a different set of floating-point features than the default | ||
expectations of `fp-armv8`, then these should also be enabled or disabled as | ||
needed with `-C target-feature=(+/-)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling convention explanation (i.e. difference between -softfloat and the other target and ideally a link to AAPCS64) should probably go in a separate section rather than "Requirements".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this text to the section above.
## Testing | ||
|
||
This is a cross-compiled target that you will need to emulate during testing. | ||
|
||
The exact emulator that you'll need depends on the specific device you want to | ||
run your code on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK the testing section in the target support documentation is usually about running the tests for the compiler itself, which isn't supported for these targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the section. It wasn't useful.
## Start-up and Low-Level Code | ||
|
||
The [Rust Embedded Devices Working Group Arm Team] maintain the | ||
[`aarch64-cpu`] crate, which may be useful for writing bare-metal code using | ||
this target. | ||
|
||
The *TrustedFirmware* group also maintain [Rust crates for this | ||
target](https://github.com/ArmFirmwareCrates). | ||
|
||
[`aarch64-cpu`]: https://docs.rs/aarch64-cpu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure how the maintainers feel about endorsing third-party crates like this. I think this section could just be dropped and, if you really want to have some start-up code, replaced with a tiny linker script + assembly + Rust entrypoint example when e.g. booting with the Linux boot protocol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For many targets the code required is more than can fit into a target doc, and often involves multiple files that would be tedious and error prone to copy-paste into a new project. ArmFirmwareCrates is from Arm themselves, so it seemed legit to refer to it. But I can take it out.
I personally find it pretty hard to get started with many of these targets so I think giving people links to code that works and runs is very useful. I’m happy to not have it here, but I don’t know where else it would go.
|
||
## Target maintainers | ||
|
||
* [@chrisnc](https://github.com/chrisnc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format for these was updated a while ago to drop the bullet points for ease of copy-pasting the usernames in GitHub issues and PRs. Please drop those, no matter who's being listed here (and in all the other files) :)
It seems the existing target docs were not updated when this rule came in. I'm removed the bullets for all the targets maintained by the Rust Embedded Devices Working Group's Arm Team as requested. |
Removes a bunch of information that isn't, strictly speaking, target specific.
This PR updates some of the arm*-unknown-none target docs, and adds some missing target pages.
aarch64-none-elf and aarch64-none-elf-softfloat
The Rust Embedded Devices Working Group's Arm Team is added as a maintainer, and a target page is added. Links are added to the EDWG's support crates for this target.
armv7a-none-eabi and armv7a-none-eabihf
The Rust Embedded Devices Working Group's Arm Team is added as a maintainer, and a target page is added. Links are added to the EDWG's support crates for this target.
armv7r-none-eabi and armv7r-none-eabihf
The Rust Embedded Devices Working Group's Arm Team is added as a maintainer, and the target page is split from the Big Endian versions. Links are added to the EDWG's support crates for this target.
armebv7r-none-eabi and armveb7r-none-eabihf
The target page is split from the Little Endian versions. No change in maintainers.
I have agreement to add EDWG/T-Arm as maintainers, which was voted upon in their repo.