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

Support AVR as the default target #8

Open
dylanmckay opened this issue Apr 1, 2015 · 10 comments
Open

Support AVR as the default target #8

dylanmckay opened this issue Apr 1, 2015 · 10 comments
Labels
A-rust Affects overall Rust compiler architecture enhancement

Comments

@dylanmckay
Copy link
Member

dylanmckay commented Apr 1, 2015

Set the default target to avr-unknown-unknown so that by default we attempt to build for AVR.

Currently this is blocked by not being able to compile compiler-rt and libcore and such.

@alexking
Copy link

So I've been trying to look into how the default target is set (I'm trying to get the core library building – #4). It seems like the default --target comes from host_triple(), which gets it from CFG_COMPILER_HOST_TRIPLE. Any idea if this is what we're looking to change?

@dylanmckay
Copy link
Member Author

dylanmckay commented May 13, 2015

If I recall correctly, if we pass --target=avr-unknown, LLVM also gets configured so that avr-none is the default target.

The problem with this is that compiler-rt does not support AVR, so Makefile generation fails.

@dylanmckay dylanmckay changed the title Set avr-none as the default target Support avr-atmel-none as the default target Aug 9, 2015
@dylanmckay
Copy link
Member Author

We don't want to modify the Makefiles to ignore the host and generate AVR bindings - we want to add support to Rust so that we can call ./configure --target=avr-atmel-none and we get a compiler which targets AVR by default (not passing the target triple to rustc) which has a libcore compiled for AVR as well.

Currently I have a patch which fixes AVR support for compiler-rt, and adds support for 16-bit pointers to libcore. Will push when ready. Now merged, although compiling libcore leads to an LLVM assertion error.

@dylanmckay
Copy link
Member Author

This is currently blocked by AVR-LLVM issue #149

@briansmith
Copy link

we want to add support to Rust so that we can call ./configure --target=avr-atmel-none and we get a compiler which targets AVR by default (not passing the target triple to rustc)

I would prefer that, instead, the default target is the host, and that --target=avr-atmel-none is passed to cargo and rustc to build for AVR. Many crates need the host target in order to run their build.rs build script. Also, I would like to see AVR target support included in all releases of rustc for all platforms, and that can only happen if it is supported as a cross-compiler.

@dylanmckay
Copy link
Member Author

I have good news :)

I am currently in the (long,slow) process of merging AVR-LLVM directly into the official LLVM repository. Once that is completed, Rust will simply have to update LLVM and it will be able to be used.

With regards to this issue, the only reason we can't use avr as the default target is because AVR-LLVM crashes while compiling libcore. This means that there's nothing physically stopping us from using AVR as the default target, except a bug that would've stopped us from compile libcore anyway.

The AVR-LLVM migration process will take a while, and so I plan on working on fixing AVR-LLVM issue 149 once that is completed.

@shepmaster shepmaster added the A-rust Affects overall Rust compiler architecture label Apr 25, 2017
@dylanmckay dylanmckay changed the title Support avr-atmel-none as the default target Support AVR as the default target Aug 21, 2017
@mrdeveloperdude
Copy link

@dylanmckay Hi! I was randomly looking for llvm avr/arduino support when I came here. Taht is awesome! Any status update as of today (2018-08-23)?

@dylanmckay
Copy link
Member Author

dylanmckay commented Jan 20, 2019

libcore now compiles fine.

We need to get compiler-builtins working on AVR (#125) before AVR can be made the default target.

@shepmaster
Copy link
Member

AVR can be made the default target.

@dylanmckay I'm not sure that there's much of a point to this. Rust defaults to the host system, and I'm 99.9999% sure that rustc will never run on AVR. Since our goal is to merge into upstream Rust, we'd never want to have such a behavior.

@dylanmckay
Copy link
Member Author

Good point, I hadn't though of that - changing the default target to AVR could only ever be relevant in a rustc fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Affects overall Rust compiler architecture enhancement
Projects
None yet
Development

No branches or pull requests

5 participants