-
Notifications
You must be signed in to change notification settings - Fork 223
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
Linker errors when compiling for ATmega2560 with recent rust compiler (>2022-10-22) #388
Comments
It looks like something on the way (rustc, llvm or avr-gcc?) doesn't like AVR6 as an architecture - which is weird, since in principle everything should be compatible with it. I've checked avr-binutils (as a fellow NixOS user) and it seems that AVR6's standard library is present there, and the (I haven't checked other systems, though - maybe it's a NixOS specific thing related to how it packages avr-gcc, for instance.) |
Hello, I am struggling with the same error. I tried a bunch of nightly versions and it seems something broke in So, you should try to change your channel field in |
@PaulRaUnite fixed it! My repository now has a working nix-powered development environment. https://github.com/arnemileswinter/rust-atmega2560-cross-compile-nix-blinking-led I am unsure whether we should close this issue now until the upstream error in |
Let's keep it open for visibility. Is there an upstream issue we can link to? |
I am having the same issue with attiny404 when trying to compile #357 on latest nightly. Can also confirm that something happened between 2022-10-22 and 2022-10-23 nightlies |
Bisecting leads to rust-lang/rust@5642a75 as the first commit with this issue. |
Prior to this commit, The function We still need to figure out why the generated object file's architecture is incompatible and how to correct it, but the My guess is that there is some field in the ELF file that is conventionally used to specify the AVR MCU, and the linker is checking that field but rustc doesn't set it correctly. |
I was close - the low 7 bits of #define EF_AVR_MACH 0x7F
#define E_AVR_MACH_AVR1 1
#define E_AVR_MACH_AVR2 2
#define E_AVR_MACH_AVR25 25
#define E_AVR_MACH_AVR3 3
#define E_AVR_MACH_AVR31 31
#define E_AVR_MACH_AVR35 35
#define E_AVR_MACH_AVR4 4
#define E_AVR_MACH_AVR5 5
#define E_AVR_MACH_AVR51 51
#define E_AVR_MACH_AVR6 6
#define E_AVR_MACH_AVRTINY 100
#define E_AVR_MACH_XMEGA1 101
#define E_AVR_MACH_XMEGA2 102
#define E_AVR_MACH_XMEGA3 103
#define E_AVR_MACH_XMEGA4 104
#define E_AVR_MACH_XMEGA5 105
#define E_AVR_MACH_XMEGA6 106
#define E_AVR_MACH_XMEGA7 107 (Copied from The |
this still seems to be an issue more than 6 months later, my uno is totally bricked and my mega is apparently a glitch in the matrix so i guess i will not be playing with avr today, unless i want to use a version of rust that is nearly a year old |
Fortunately, https://reviews.llvm.org/D154785 (that solves this issue) was merged just two days ago - I'll try to bump the rustc's llvm over the weekend :-) |
epic :3 |
Status: over rust-lang/llvm-project#149 I've got an information that the team will be bumping-up LLVM soon ™️ -- so after they do it, all the recent fixes to the AVR backend will be brought as well 🙂 |
Hello!
I'm pretty new to cross-compiling.
I created a nix environment in which i can compile the .ELF file for some targets.
For example, the target avr-atmega328p.json works:
And i get
target/avr-atmega328p/debug/helloworld.elf
.But the arduino that i have at my disposal is the atmega2560, i get the following output:
I don't understand why it doesn't work for the latter target.
The repository is here: https://github.com/arnemileswinter/rust-arduino-cross-compile-nix-blinking-led
and is based on the cargo template.
Thanks in advance!
The text was updated successfully, but these errors were encountered: