Datasheet
17 | Page
7 How to start
Before you can program the devices you need to have a cross compiler. A cross compiler is a
compiler which runs on one type of processor, but generates code for a different type. In this
case the compiler runs on the Raspberry-Pi (ARM11 device) but makes code for the Atmel
devices.
7.1 On the Raspberry-Pi:
When programming the Atmel devices on the Raspberry-Pi you have two choices:
• Use the Arduino GUI
• Use the GCC Atmel compiler
For both you need to have a cross compiler for the Atmega devices. Easiest is to install the
Arduino package:
sudo apt-get install arduino
avrdude
You need to use a program called "avrdude" to program the devices BUT you need a special
version of "avrdude" which can program the devices using the GPIO of the Raspberry-Pi. Thanks
for Gordon Henderson (projects.drogon.net) who has provided these:
Standard Debian Squeeze:
cd /tmp
wget http://project-downloads.drogon.net/gertboard/avrdude_5.10-4_armel.deb
sudo dpkg -i avrdude_5.10-4_armel.deb
sudo chmod 4755 /usr/bin/avrdude
Debian Raspbian:
cd /tmp
wget http://project-downloads.drogon.net/gertboard/avrdude_5.10-4_armhf.deb
sudo dpkg -i avrdude_5.10-4_armhf.deb
sudo chmod 4755 /usr/bin/avrdude
You can now compile programs for the Atmega devices and upload the program into the chip on
the GertDuino. Example source code, Makefile and how to upload the program can all be found
in section 8 Example programs.
If you want to use the Arduino development environment you have to adapt it. See
projects.drogon.net/raspberry-pi/gertboard/arduino-ide-installation-isp/ how to do that.
7.2 On a PC
Atmel have a free C-compiler. You can get information about the latest version here:
http://www.atmel.com/tools/ATMELSTUDIO.aspx
You can compile on the PC but you need to transfer the final .hex file to the Raspberry-Pi before
you can program the Atmega devices.