Unable to compile and link AVR program in OS X

I am working on a Mac with Yosemite OS X, and I am trying to compile a C program that I could download to Arduino. I follow the tutorial .

I tried to go through and reinstall avr-gcc, but I got the same result. I tried to find the crtatmega328p.o file on my system, but could not be found anywhere and the same goes for the directory.

 $ avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o Program.o Program.c $ avr-gcc -mmcu=atmega328p Program.o -o Program /usr/local/lib/gcc/avr/5.2.0/../../../../avr/bin/ld: cannot find crtatmega328p.o: No such file or directory /usr/local/lib/gcc/avr/5.2.0/../../../../avr/bin/ld: cannot find -latmega328p collect2: error: ld returned 1 exit status 
+5
source share
1 answer

I was struck by this issue on GNU / Linux last week.

Actually, the compiler is working fine. The cause of the problem is an unsuccessful attempt to link to avr-libc .

avr-libc-1.8.1 just too old to work with GCC 5. Although 1.8.1 is the latest version of avr-libc , it was released a year ago ... The developed version of avr-libc updated to catch GCC 5, you can clone subversion repository:

 svn co svn://svn.savannah.nongnu.org/avr-libc/trunk 

and compile it yourself. If you are not familiar with how to compile your own source code from source code, there are a lot of documentation and tutorials on the Internet.

+2
source

All Articles