AtMega/AvrGccFAQ

Q. How can I decide if I want to compile my own firmware?

Q. I have Windows and I want to build the VEMS firmware. What do I need?

Q. I get "cannot find the file specified" or similar error.

Q. I get some "library" related problems

Q. I am still having problems getting the Gcc Compiler to work correctly. Who will help me?

Q. I have linux. Is there anything for me?

A. Some linux rpm packages are here:

http://savannah.nongnu.org/download/simulavr/binaries/RPMS/i386/

I successfully used them on debian using alien --to-deb conversion.

The above link for linux rpm's is obsolete. I searched on the AVR freaks site and came up with this software under tools, but I'm not sure which we would recommend to use.

http://www.avrfreaks.net/Home/gensearch.php?keyword=linux+rpm&section=0


There was an annoying optimization bug (combine bug) fixed on 2003.jul.11.

in mainstream experimental gcc (not only avr).

If your package contains an older gcc, you must use gcc -O0 for several

files (button.c and lcd.c comes to mind) or get a newer version.

[Building your own C cross-compilers for Atmel AVR under Linux/x86]

Please copy the testprogram (that tests wether a gcc has the bug) here:

....

I think I've run into it (again?). I used this gcc version:

avr-gcc -v 
Reading specs from /usr/lib/gcc-lib/avr/3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --disable-nls --target=avr i386-redhat-linux
Thread model: single
gcc version 3.3 20030512 (prerelease)

There was a serious compilation error likely in table_lookup().

corr.ve_hp was all around the place, so was pulsewidth. The car behaved badly (it's a miracle that it ran at all!) MegaTune showed the incorrect VE as well.

Another compiler that failed with table_lookup():

Reading specs from /usr/lib/gcc/avr/3.4.3/specs
Configured with: ./configure -v --enable-languages=c,c++ --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --build=i386-linux --host=i386-linux --target=avr
Thread model: single
gcc version 3.4.3

Also bad calculated ve (often jumped to 0). Since this was triggered when we were fiddling with new timing code, so we suspected our code, but it was the compiler.