Skip to content
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-unknown target #800

Open
Patryk27 opened this issue Oct 20, 2024 · 1 comment
Open

Create an avr-unknown-unknown target #800

Patryk27 opened this issue Oct 20, 2024 · 1 comment
Labels
major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team to-announce Announce this issue on triage meeting

Comments

@Patryk27
Copy link

Patryk27 commented Oct 20, 2024

Proposal

I'm proposing to remove the existing avr-unknown-gnu-atmega328 target and replace it with a generic avr-unknown-unknown variant. This variant can be then specialized for a specific CPU (well, microcontroller) using the -C target-cpu flag, like so:

# .cargo/config.toml

[build]
target = "avr-unknown-unknown"
rustflags = ["-C", "target-cpu=atmega328p"]

[unstable]
build-std = ["core"]

Using the generic variant is the better approach in my opinion, because that's how LLVM already works.

In particular, at the moment rustc exposes only the atmega328 target, but following the current logic we'd have to create ~three hundred targets more - for nothing, since -C target-cpu (aka -mcpu in LLVM) achieves the same thing.

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 Rust+AVR 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.

Implementation

This MCP is mostly implemented: rust-lang/rust#131651; I've created the MCP post factum, following @tgross35's idea.

@Patryk27 Patryk27 added major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team labels Oct 20, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 20, 2024

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:

@rustbot concern reason-for-concern 
<description of the concern> 

Concerns can be lifted with:

@rustbot resolve reason-for-concern 

See documentation at https://forge.rust-lang.org

cc @rust-lang/compiler @rust-lang/compiler-contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team to-announce Announce this issue on triage meeting
Projects
None yet
Development

No branches or pull requests

2 participants