Skip to content

Conversation

thejpster
Copy link
Contributor

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.

@rustbot
Copy link
Collaborator

rustbot commented Sep 10, 2025

Some changes occurred in src/doc/rustc/src/platform-support

cc @Noratrieb

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 10, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

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.
@thejpster thejpster force-pushed the update-arm-target-docs branch from 8a54175 to faf0e14 Compare September 10, 2025 18:51
@thejpster
Copy link
Contributor Author

Force-pushed with fixed markdown formatting.

@rustbot

This comment has been minimized.

@thejpster thejpster force-pushed the update-arm-target-docs branch from 827e2cd to f1abb70 Compare September 10, 2025 19:31
@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Sep 11, 2025

r? @workingjubilee maybe?

@rustbot rustbot assigned workingjubilee and unassigned lcnr Sep 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 11, 2025

workingjubilee is currently at their maximum review capacity.
They may take a while to respond.

Copy link
Member

@workingjubilee workingjubilee left a 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.

View changes since this review

## 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
Copy link
Member

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.

Copy link
Contributor Author

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"
Copy link
Member

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?

Copy link
Contributor Author

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`.
Copy link
Member

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?

Suggested change
`-Ctarget-feature=+neon-fp-armv8`.
`-Ctarget-feature=+neon,-fp-armv8`.

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor

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) :)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2025
Copy link
Contributor

@Gelbpunkt Gelbpunkt left a 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.

View changes since this review

Comment on lines 22 to 55
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",
]
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Comment on lines 86 to 95
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=(+/-)`.
Copy link
Contributor

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".

Copy link
Contributor Author

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.

Comment on lines 99 to 104
## 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines +106 to +115
## 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
Copy link
Contributor

@Gelbpunkt Gelbpunkt Sep 12, 2025

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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) :)

@thejpster
Copy link
Contributor Author

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants