Atmega328 on Linux: can't find header files.

My recently bought Duemilanove (SparkFun) has an Atmega328, and now my sketches don't compile anymore (they did on the 168).

I found out from some forums that avr-gcc 4.1.3 isn't compatible with the 328, after gettinh a whole bunch of errors. So I upgraded my tool chain.

Still there's a bunch of errors and sketches don't compile. I get the following errors, about missing header files like:

/opt/arduino-0017/hardware/cores/arduino/wiring_private.h:28:20: error: avr/io.h: No such file or directory
/opt/arduino-0017/hardware/cores/arduino/wiring_private.h:29:27: error: avr/interrupt.h: No such file or directory

[...]

And then stuff like this:

from /opt/arduino-0017/hardware/cores/arduino/wiring_analog.c:25:
/opt/arduino-0017/hardware/cores/arduino/wiring.h:101: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'boolean'
/opt/arduino-0017/hardware/cores/arduino/wiring.h:102: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'byte'

I have done the following in the upgrade:

  • upgrade cross-avr-gcc from 4.1.3 to 4.3.3 for 328 compatibility
  • uninstalled avr-lib 1.6.1 due incompatibility with cross-avr-gcc43
  • installed bison (for yacc) and flex
  • installed avr-libc 1.6.7 from source
  • installed avrdude 5.8 from source
  • updated my $PATH with /usr/local/avr/include, that is where avr/io.h etc. actually are
  • logout/login for $PATH to take effect (from .profile)

It seems as if the Arduino IDE somehow does not read my $PATH settings... How to fix this?

Running OpenSUSE 11.1 and arduino-0017, installed in /opt/arduino-0017.

Any ideas?

Edit: apologies if this should have gone in the Software forum.

Looks like avr-gcc can't find avr-libc. They should be in the same base path (e.g. /usr or /usr/local or /opt). I'm guessing since you installed one from a package and the other from source that they're in different places. avr-gcc doesn't use your path to find header files, and there's not a good way to specify an additional include path in the IDE.

Mellis, thanks for your reply. You can be right, since avr-gcc is installed from a standard package, underneath /opt and the rest is in /usr/local.

Do you know where I can download the source for avr-gcc (or gcc-avr or cross-avr-gcc or whatever it's called)? That way I could compile and install it under /usr/local.

I've never built a compiler from source. Let alone a cross compiler. How hard is it?

Hi ,
I suggest you to use the code snippet below at your user initialization script:

PREFIX=/path-to-avr
export PREFIX
PATH=$PATH:$HOME/bin:$PREFIX/bin
export PATH

This comes from an excelent post at AvrFreaks.net about a straightforward method to update AVR-GCC to 4.3.3 with success -
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631

Good Luck !

Hi,
There is always a good chance to find missing (binary) packages here :
http://www.rpmfind.net/

Eberhard

I've got arduino-0017 compiling for Atmega328 and 168 now thanks to all your suggestions and this page (I skipped GDB and avarice).

:slight_smile:

Why don't people read the manual ?

http://www.arduino.cc/playground/Linux/OpenSUSE

Maybe there should be a link to OS specific installation instructions on the main Arduino site ?

Why don't people read the manual ?

I can only answer for myself.

I searched the forum for the problem I had, using some keywords from the error messages and the words opensuse or suse, but the search functionality is so poor and gives so few results that I quickly gave up.

My YaST repos were not configured properly (that is, for the avr stuff), otherwise would have had the updates as soon as they came out. So blissfully unaware I turned to Google simply forgetting to check the Playground.

Also, not everyone has time to keep up with everything that's happening here, or all content that becomes available over time :stuck_out_tongue:

The good thing is I got to compile again from source. Don't have that opportunity often anymore :wink: