Alternate compiler?

Since the Linux Arduino build seems to use the system's avr-gcc, is it possible to get Arduino to use a different compiler? I'm trying to get support for the ATmega328, but the Ubuntu gcc-avr 4.2.2 doesn't support the chip. I have a patched compiler instance, but can't seem to get the software to use it. Hints and pointers appreciated.

Arduino on Linux should, I think, use whichever avr-gcc is first in your path.

Unfortunately, that doesn't seem to be the case. I made sure that my patched toolchain bin directory appears first in the path, but the output window in Arduino indicates it is still using the version in /usr/bin instead of the version in /home/roy/avr/bin. By example, this error message

In file included from /usr/lib/gcc/avr/4.2.2/../../../../avr/include/avr/eeprom.h:60,

clearly shows the compiler is using the system include path. I can't find any hardcoded strings with grep, so I'm really at a loss here. :cry:

One additional strange point is that I tried removing the executable bit from /usr/bin/avr-gcc, but Arduino gave the exact same error output. I would have expected an error message indicating the compiler could not be found.

Have you tried removing the system's avr-gcc?

apt-get remove avr-gcc

should remove it

:slight_smile:

Well, that was instructive! And a bit embarrassing. I hadn't built avr-g++.

I went back and built gcc 4.3.2 and avr-libc 1.4.7, enabling c and c++. I applied the ATmega328P.diff from http://idisk.mac.com/ghulands-Public?view=web to Arduino 12. BTW, that patch is missing one #define in Servo.cpp. I added the 328P definition from http://spiffie.org/know/arduino_328/ide.shtml to avrdude.conf. And et voila! I'm now compiling and downloading to my ATmega328P successfully!

Thanks for the pointers.