arduino / toolchain-avr

The AVR toolchain used by the Arduino IDE
142 stars 48 forks source link

ATTiny10 and Toolchain 7.3.0 #65

Open wholder opened 4 years ago

wholder commented 4 years ago

Arduino recently upgraded the AVR toolchain in the macOS version from 32 bit 5.4.0 to 64 bit 7.3.0 in order to support macOs Catalina, which is 64 bit only. However, the 7.3.0 toolchain has an odd problem when trying to link code compiled for the attiny10 series of microcontrollers. To investigate this, I downloaded the Mac version of the toolchain from:

http://downloads.arduino.cc/tools/avr-gcc-7.3.0-atmel3.6.1-arduino5-x86_64-apple-darwin14.tar.bz2

And used it to compile this simple test program:

#include <avr/io.h>
int main () {
    DDRB |= (1 << PB0);
  while (true) {
        PORTB |= (1 << PB0);
        PORTB &= ~(1 << PB0);
    }
}

I can use the 7.3.0 toolchain to compile and link this code for the attiny85, like this:

  ./avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -mmcu=attiny85 -I ./ test.cpp -o test.cpp.o
  ./avr/bin/avr-gcc -w -Os -g -mmcu=attiny85 -o test.elf test.cpp.o -L ./ -lm 

and it works just fine. But, if i change the -mmcu switch from attiny85 to attiny10, the compile seems to work fine, but the command to link the code (2nd line) spews out the following errors:

/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: cannot find crtattiny10.o: No such file or directory
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: skipping incompatible /Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/libm.a when searching for -lm
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: cannot find -lm
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: skipping incompatible /Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/libgcc.a when searching for -lgcc
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: cannot find -lgcc
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: skipping incompatible /Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/libm.a when searching for -lm
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: cannot find -lm
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: skipping incompatible /Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/libc.a when searching for -lc
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: cannot find -lc
/Users/wholder/Desktop/temp/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: cannot find -lattiny10
collect2: error: ld returned 1 exit status

Curiously, the file crtattiny10.o is available in the toolchain at path: ./avr/lib/avrtiny/crtattiny10.o

Can anyone help me figure out what's going on here?

Wayne

facchinm commented 4 years ago

Following up from the mailing list, better to keep these things near the code

I investigated a bit and the problem is:

Said that, there isn't much we can do except waiting for the devices to be upstreamed. As @WestfW correctly noted, Microchip only provides GCC 5.4.0 as "latest", but we know it has tons of issues with lto so we couldn't really use their infrastructure...

enekochan commented 4 years ago

I was having the same problem using the toolchain (version 7.3.0-atmel3.6.1-arduino7) provided by Arduino 1.9.0 (beta). Then I downloaded the toolchain from Microchip and it worked fine. Hope this helps.

wholder commented 3 years ago

Thanks or the pointer to the Microchip toolchains!

Wayne

On Wed, Jul 22, 2020 at 4:54 PM enekochan notifications@github.com wrote:

I was having the same problem using the toolchain (version 7.3.0-atmel3.6.1-arduino7) provided by Arduino 1.9.0 (beta). Then I downloaded the toolchain from Microchip https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers and it worked fine. Hope this helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arduino/toolchain-avr/issues/65#issuecomment-662754390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIDM4SNLG2JQFOEV6JYJ5TR453Z5ANCNFSM4JNTVESQ .