Skip to content

Support AVR as the default target #8

Open
@dylanmckay

Description

@dylanmckay

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.

Activity

alexking

alexking commented on May 13, 2015

@alexking

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

dylanmckay commented on May 13, 2015

@dylanmckay
MemberAuthor

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.

changed the title [-]Set `avr-none` as the default target[/-] [+]Support `avr-atmel-none` as the default target[/+] on Aug 9, 2015
dylanmckay

dylanmckay commented on Aug 9, 2015

@dylanmckay
MemberAuthor

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

dylanmckay commented on Aug 17, 2015

@dylanmckay
MemberAuthor

This is currently blocked by AVR-LLVM issue #149

briansmith

briansmith commented on Oct 23, 2015

@briansmith

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

dylanmckay commented on Oct 23, 2015

@dylanmckay
MemberAuthor

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.

added
A-rustAffects overall Rust compiler architecture
on Apr 25, 2017
changed the title [-]Support `avr-atmel-none` as the default target[/-] [+]Support AVR as the default target[/+] on Aug 21, 2017
mrdeveloperdude

mrdeveloperdude commented on Aug 23, 2018

@mrdeveloperdude

@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

dylanmckay commented on Jan 20, 2019

@dylanmckay
MemberAuthor

libcore now compiles fine.

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

shepmaster

shepmaster commented on Jan 20, 2019

@shepmaster
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

dylanmckay commented on Jan 20, 2019

@dylanmckay
MemberAuthor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustAffects overall Rust compiler architectureenhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @briansmith@alexking@shepmaster@mrdeveloperdude@dylanmckay

        Issue actions

          Support AVR as the default target · Issue #8 · avr-rust/rust-legacy-fork