-
Notifications
You must be signed in to change notification settings - Fork 69
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
Create an avr-unknown-none target #800
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. Concerns or objections to the proposal should be discussed on Zulip and formally registered here by adding a comment with the following syntax:
Concerns can be lifted with:
See documentation at https://forge.rust-lang.org cc @rust-lang/compiler @rust-lang/compiler-contributors |
Target option to require explicit cpu Some targets have many different CPUs and no generic CPU that can be used as a default. For these targets, the user needs to explicitly specify a CPU through `-C target-cpu=`. Add an option for targets and an error message if no CPU is set. This affects the proposed amdgpu and avr targets. amdgpu tracking issue: rust-lang#135024 AVR MCP: rust-lang/compiler-team#800
@rustbot second With a note that |
Target option to require explicit cpu Some targets have many different CPUs and no generic CPU that can be used as a default. For these targets, the user needs to explicitly specify a CPU through `-C target-cpu=`. Add an option for targets and an error message if no CPU is set. This affects the proposed amdgpu and avr targets. amdgpu tracking issue: #135024 AVR MCP: rust-lang/compiler-team#800
Target option to require explicit cpu Some targets have many different CPUs and no generic CPU that can be used as a default. For these targets, the user needs to explicitly specify a CPU through `-C target-cpu=`. Add an option for targets and an error message if no CPU is set. This affects the proposed amdgpu and avr targets. amdgpu tracking issue: #135024 AVR MCP: rust-lang/compiler-team#800
Proposal
I'm proposing to remove the existing
avr-unknown-gnu-atmega328
target and replace it with a genericavr-unknown-none
variant. This variant can be then specialized for a specific CPU (well, microcontroller) using the-C target-cpu
flag, like so:In my opinion using the generic variant is the better approach here, since it matches how LLVM implements the target internally, making it easier for rustc and LLVM to cooperate; it's also better for end users, considering that the current approach with target.jsons is just awkward.
Having a generic variant does have a downside, though -
avr-unknown-none
would have to remain a tier 3 target as we won't be able to provide prebuilt standard library for it - especially considering that there's like three hundred possible values for-C target-cpu
.Fortunately, all those three hundred CPUs map down into about ~30 different AVR architecture combinations, so in the future we can think about providing dedicated
avr25-unknown-none
etc. targets that could be moved into tier 2 and even tier 1 one day. This remains outside the scope of this proposal, though.To avoid confusing people, I'm proposing to remove the current
avr-unknown-gnu-atmega328
target - it shouldn't be widely used in practice, because virtually all tutorials and examples rely on target.jsons (see e.g. examples in avr-hal). If backwards compatibility for tier 3 targets is important though, we can think about providing a dedicated error message for people trying to use the older target.Bikeshedding
Name
LLVM calls this target
avr-unknown-unknown
, but discussion on Zulip proposedavr-unknown-none
to match rustc's convention better.Implementation
See: rust-lang/rust#131651.
The text was updated successfully, but these errors were encountered: