In setting up my Ubuntu 8.04 (Hardy) system for programming AVRs using avrdude, I ran into problems (even with ladyada's tutorial). So, I jotted down the steps I took to successfully install everything. Here it is in case you are having problems. If it helps you, great!
First, some prelimiaries to make sure the build process goes fine (hopefully):
- Code: Select all
sudo apt-get install build-essential make tar wget patch libusb-dev libusb-0.1-4 libc6-dev
Create and navigate to an applicable source directory:
- Code: Select all
cd ~
mkdir src
cd src
Fetch and build binutils; we have to get the latest snapshot (> v2.18!) so that avr-gcc can later compile correctly without the 'illegal opcode movw for mcu avr3' error (use the password 'anoncvs' when prompted):
- Code: Select all
mkdir binutils-cvs-snapshot
cd binutils-cvs-snapshot
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
cd src/
./configure --target=avr --program-prefix="avr-"
make
sudo make install
cd ../..
Fetch and build avr-gcc (make sure to enable c++ so the Arduino IDE (installed later) doesn't complain). Note: don't use the '-no-cpp-precomp' option when "make"ing as specified in other tutorials; it's deprecated:
- Code: Select all
wget http://gcc.releasenotes.org/releases/gcc-4.3.1/gcc-4.3.1.tar.bz2
tar jxfv gcc-4.3.1.tar.bz2
mkdir avr-gcc-4.3.1
cd avr-gcc-4.3.1/
../gcc-4.3.1/configure --target=avr --enable-languages=c,c++ --disable-libssp
make CC="cc"
sudo make install
cd ..
Fetch and build avr-libc:
- Code: Select all
wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.6.2.tar.bz2
tar jxfv avr-libc-1.6.2.tar.bz2
cd avr-libc-1.6.2/
./configure --host=avr
make
sudo make install
cd ..
Fetch and build avrdude (also applying the Arduino/BoArduino patch which fixes the invalid device signature bug and ensures DTI gets cleared when the port is closed):
- Code: Select all
wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.5.tar.gz
tar xfv avrdude-5.5.tar.gz
wget http://www.artificial-stupidity.com:4352/avrdude-arduino.patch
patch -p0 < avrdude-arduino.patch
cd avrdude-5.5/
./configure
make
sudo make install
cd ..
Edit avrdude's configuration to add the Arduino Diecimila and the BoArduino to its programmer list:
- Code: Select all
sudo vim /usr/local/etc/avrdude.conf
Add the following:
- Code: Select all
programmer
id = "arduino";
desc = "Arduino Serial Bootloader";
type = stk500;
reset = 7;
baudrate = 19200;
;
programmer
id = "boarduino";
desc = "BoArduino Serial Bootloader";
type = stk500;
reset = 7;
baudrate = 19200;
;
Now run avrdude and have fun! For example:
- Code: Select all
avrdude -V -c arduino -p m168 -P /dev/ttyUSB0
Optionally, fetch and run the Arduino IDE:
- Code: Select all
wget http://www.arduino.cc/files/arduino-0011-linux.tgz
tar xfv arduino-0011-linux.tgz
cd arduino-0011
./arduino
You may need to apply a patch here (for the IDE) also for the DTR bug as mentioned above; if you do, see timv's post.
Optionally, remove sources:
- Code: Select all
cd ~/src
rm binutils-cvs-snapshot gcc-4.3.1 gcc-4.3.1.tar.bz2 avr-gcc-4.3.1 avr-libc-1.6.2 avr-libc-1.6.2.tar.bz2 avrdude-5.5 avrdude-5.5.tar.gz arduino-0011-linux.tgz avrdude-arduino.patch
If you have problems; for example:
avrdude: stk500_recv(): programmer is not responding
You may want to reload the Arduino Diecimila (also BoArduino) bootloader using a USBtinyISP as follows (make sure to connect the USBtinyISP to the Arduino Diecimila or the BoArduino and that you have an ATMEGA168 AVR in the socket):
- Code: Select all
cd ~/src
wget http://www.artificial-stupidity.com:4352/ATmegaBOOT_168_diecimila.hex
sudo avrdude -V -c usbtiny -p m168 -U flash:w:ATmegaBOOT_168_diecimila.hex
Then remove the USBtinyISP, connect the Arduino Diecimila or BoArduino and test again:
- Code: Select all
avrdude -V -c arduino -p m168 -P /dev/ttyUSB0
If it works so far, then you can try to upload the "Hello World" of uCs:
- Code: Select all
wget http://www.artificial-stupidity.com:4352/Blink.hex
avrdude -V -c arduino -p m168 -P /dev/ttyUSB0 -U flash:w:Blink.hex
An LED connected to pin 13 and GND should blink on/off every second or so.
Hope it works for you like it did for me!

