linux ide v13 cant compile for '328p

I've purchased a 328 from Adafruit, and have run into a problem trying to use it with a stock Diecimila, and running a plain-vanilla Arduino IDE on a Linux (Ubuntu 8.04) box.

I can get serial communication, but there's something in the IDE that isn't playing nice with the 328. If I go with a board option of Diecimila, and try to upload, I get the message:

avrdude: Expected signature for ATMEGA168 is 1E 94 06
         Double check chip, or use -F to override this check.

If I use the (instructed) Arduino w/atmega328, the error message is more verbose:

unknown MCU 'atmega328p' specified
Known MCU names:
{long list of MCUs not including 328 trimmed}
SoftwareSerial.cpp:1: error: MCU 'atmega328p' supported for assembler only
In file included from /home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring.h:28,
                 from /home/dmerriman/bin/Arduino/hardware/cores/arduino/WConstants.h:1,
                 from SoftwareSerial.cpp:24:
/usr/lib/gcc/avr/4.2.2/../../../../avr/include/avr/io.h:295:6: warning: #warning "device type not defined"

That was with the "original" IDE13; I downloaded and (freshly) installed the second release, and earned the following (still Arduino w/328):

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:1: error: MCU 'atmega328p' supported for assembler only

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c: In function 'turnOffPWM':

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:53: error: 'TCCR1A' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:53: error: (Each undeclared identifier is reported only once

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:53: error: for each function it appears in.)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:53: error: 'COM1A1' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:54: error: 'COM1B1' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:59: error: 'TCCR0A' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:59: error: 'COM0A1' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:60: error: 'COM0B1' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:61: error: 'TCCR2A' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:61: error: 'COM2A1' undeclared (first use in this function)

/home/dmerriman/bin/Arduino/hardware/cores/arduino/wiring_digital.c:62: error: 'COM2B1' undeclared (first use in this function)

Couldn't determine program size: avr-size: '/tmp/build2957838477084186417.tmp/Blink.hex': No such file

I gotta say, this is not what I was looking forward to when I bought a 328 from Adafruit :'(

Anybody got any ideas what's going on? And more importantly, how to fix it so I can start using all that wonderful new RAM and everything? Or is it back to the 168 for me?

The Adafruit 328s have a different (beta) bootloader on them than the official Arduino 0013 expects. Essentially, you should be able to adjust your boards.txt to allow the IDE to use chips with the Adafruit bootloader instead of the official one.

Update: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1209178536/8#8

The major difference is the sketch-upload speed. You can't just choose an old Diecimilia choice in your IDE's board menu and expect that to work, either.

What version avr-gcc is with Ubuntu 8.04? "avr-gcc -v" at the command line will tell you. Also "avr-gcc --target-help" will tell you what controllers are supported by that version.

Im using Ubuntu 8.10 with version 13 ide rev2 and the 328p without any problem. It has avr-gcc version 4.3.0 and lists atmega328p as supported. I think 4.3.0 is the earliest with support for the 328p. I think from your error messages its 4.2.2 "/usr/lib/gcc/avr/4.2.2/../../../"

You have 3 choices. 1, Upgrade the toolchain: I tried upgrading avr-gcc on an earlier Ubuntu version and found it a long and frustrating process getting it working. and in the end gave up due to the number of dependencies.

2, Upgrade fully to Ubuntu 8.10 or another distro with avr-gcc 4.3.0 or above. A bit of a pain if youve got a full working system you want to keep

3, Install VMware or VirtualBox and run 8.10 as a virtual machine Ive now got 8.10 running as a virtual machine under virtualbox as my dev environemt and it just works. If I ever change my laptop or upgrade the os I can always just copy over the virtual machine and carry on. One thing to remember is download the full version with USB support from there site. Dont use the version in the Ubuntu repositories as it does not have usb support.

Gordon

Yes, it's gcc-avr 4.2.2.

I've tried 8.10, but am not real happy with KDE4; too many things I like/use aren't supported in it. The eye-candy is nice, but I'd rather have the stability and reliability of KDE3.5...

That's one of the few things I don't like about Ubuntu -- their failure to backport stuff like that.

I'll see if I can't hunt something down, and see if that fixes the problem.

Gee, this sure has been fun...

After following the instructions over at http://tuxgraphics.org/electronics/200901/avr-gcc-linux.shtml, I've gotten things reduced to ONE single error:

avr-gcc: error trying to exec 'cc1': execvp: No such file or directory

Could some kind AVR/GCC/Arduino guru kindly tell me what that translates into?

(Geez, I love computers, sometimes...) :o

Oh, as an FYI, the 19200/57600 issue has been resolved by LadyAda; it was (apparently) just chips shipped before a certain date that had that problem; I luckily ordered mine after the cut-off date :smiley:

It took hours to compile all of the toolchain for me and I still couldnt get it to work. It didnt seem to be just a matter of downloading and installing all of the latest versions. There seemed to be dependencies onversions that I couldnt work out. Thats why I gave up when I saw that 8.10 had the later version on it. So sorry cant help with that error.

Ive got the earlier version of lady ada's 328p's and its just a matter of changing the boad rate in boards.txt. So I created an alternative 328p section for the earlier lady ada 328p.

Gordon

Okay, I bloody well give up.

I’ve been trying to resolve that "avr-gcc: error trying to exec ‘cc1’: execvp: No such file or directory " problem since my last post, and I’m still getting the bleeping thing.

The absolute star-spangled mother-bear bother of all this is that I apparently have no less that TWO freaking cc1’s for avr-gcc to pick from, and it either can’t find or doesn’t like EITHER of them.

dmerriman@alpha:~$ locate cc1
/usr/lib/gcc/i486-linux-gnu/4.2/cc1
/usr/local/avr/libexec/gcc/avr/4.3.2/cc1

I’ve gone on Google and Cuil with the error message, I’ve tried looking for avr-gcc on both, I’ve tried avr-gcc config on both. I’ve looked for some kind of explanation or detail where avr-gcc THINKS cc1 is supposed to be.

It

Just

Ain’t

Happenin’. >:( >:( >:(

So I guess I go back to my 168 chip in my Diecimila, and save the 328 for use with my AVR500 (assuming I can get it to work in THAT!).

feh.

I was able to get arduino-0013 and ATmega328p builds working under Ubuntu 8.04.

(I had no problems with arduino-0013 and stock Duemilanove board builds.)

What I did is added a new "philj2009" board type to boards.txt:

##############################################################

philj2009.name=CUSTOMIZED Duemilanove (ATmega328, old compiler)

philj2009.upload.protocol=stk500
#philj2009.upload.maximum_size=14336
#philj2009.upload.speed=19200
philj2009.upload.maximum_size=30720
philj2009.upload.speed=57600

philj2009.bootloader.low_fuses=0xff
#philj2009.bootloader.high_fuses=0xdd
philj2009.bootloader.high_fuses=0xDA
#philj2009.bootloader.extended_fuses=0x00
philj2009.bootloader.extended_fuses=0x05
philj2009.bootloader.path=atmega168
#philj2009.bootloader.file=ATmegaBOOT_168_diecimila.hex
philj2009.bootloader.file=ATmegaBOOT_168_atmega328.hex
philj2009.bootloader.unlock_bits=0x3F
philj2009.bootloader.lock_bits=0x0F

philj2009.build.mcu=atmega168
#? philj2009.build.mcu=atmega328p
philj2009.build.f_cpu=16000000L
philj2009.build.core=arduino

##############################################################

This looks enough like ATmega168 options for an older avr-gcc, but otherwise has ATmega328p values (for fuses, memory limits).

Afterwards, I started arduino and selected Tools>Boards>"CUSTOMIZED Duemilanove (ATmega328, old compiler)"

I haven't yet tried swapping chips and loading the code in my Duemilanove yet, but at least I can sidestep issues with the older version of avr-gcc.

I'll try "Blink" this weekend.

Phil Jansen

OK, I swapped in an ATmega328p, tried to download. Even though the build succeeds, the download didn't work -- avrdude detects a signature mismatch.

That could be easy to fake out (change avrdude.conf to describe an ATmega328p in the "ATmega168" section). But if I do that there, it won't be so easy to hop back and forth between '168 and '328p. That's inconvenient, as I have both kinds of chips.

I guess I could fake the description of an ATmega8 instead -- I don't have any of those, but the compiler still recognizes the name. But this is getting hard to to keep straight. Even if I can get it to work, I don't know if I'd want to tell anyone about it (or port it to arduino-0015, or...).

Back to the drawing board...

Phil Jansen

Hi, I had the exact same problem as on the original post (although I'm running straight Debian). After playing around with the "strings" command trying to find the stinkin' executable that was printing the 'Unknown MCU' message, I finally decided that I needed new versions of avr-gcc (and associated binutils). My debian distribution is getting long in the tooth, so getting new official packages for the avr suite wasn't possible. I wound up building from sources. Google "Building_AVR_GCC" (sorry, the forum won't let me post a link) for detailed directions for this (note that you will also need the gcc-c++ sources as well as the gcc-core sources). The new versions of avr-* were placed in /usr/local/.

After getting, building and installing avr-gcc, avr-g++, the avr-* binutils, and avr-libc, it actually took care of the problem. I can't speak to your 'cc1' problem, unfortunately.

edit: I forgot to mention that you must have avr-gcc version 4.3.0 or later to get atmega328 support. This is critical.