Installing avr gcc 4.8.1 and Arduino IDE 1.6 on Raspberry Pi - NicoHood/NicoHood.github.io GitHub Wiki

Extracted from the old Wordpress blog.

By default the Raspberry comes with packages for Arduino IDE 1.0 and avr-gcc 4.7.2. To make use of the newest avr-gcc 4.8.1 compiler for standalone hex file compilation or the Arduino IDE 1.6 we need to get some repositories from the current Jessie release (Debian 8, next version after Wheezy). Whether you only want to use avr-gcc 4.8.1 or the full Arduino IDE this tutorial covers both needs. Since I had problems with some system settings after a full Jessie upgrade this tutorial shows how to install these features on a running wheezy system without a full upgrade.

Step 1: Updating your current Raspbian

It is recommended to update your current installation before we continue with anything else. This method also works from a clean install. I used the image from 24.12.2014. It is recommended to enter the superuser mode first, so we don't have to use sudo every time.

sudo su
apt-get update
apt-get upgrade
apt-get dist-upgrade

Step 2: Adding Jessie repository to the source list

In order to use some Jessie packages but not upgrade the whole system we have to add some settings to the system to default use Wheezy and only use Jessie if we want to. This information was grabbed from this answer. Add the following two lines into /etc/apt/sources.list

nano /etc/apt/sources.list
 
# add these lines at the bottom (Ctrl + X, Y, Enter):
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi

You then edit the file /etc/apt/preferences (create the file if doesn't exist) to tell apt in which repositories it should look to do an update. We put Jessie on a low priority so that when you use apt-get update it will ignore jessie and use wheezy repo instead. This is important for the step after this one.

# add the following lines at the bottom (Ctrl + X, Y, Enter):
nano /etc/apt/preferences
Package: *
Pin: release n=wheezy
Pin-Priority: 900
 
Package: *
Pin: release n=jessie
Pin-Priority: 300
 
Package: *
Pin: release o=Raspbian
Pin-Priority: -10

You should update your dependencies now:

apt-get update

Step 3: Installing the Arduino IDE 1.6 + avr-gcc 4.8.1

To get the new IDE you normally have to compile it yourself with a Jessie release. I've done this once and share my compiled files with you. All you have to do now is to download it and install it. The current download contains IDE 1.6 rc2. Before we can install the Arduino IDE 1.6 we need to install some new packages from Jessie. We do this by trail and error. We try to install the arduino files as long as no error occurs. Sounds stupid but its the easiest way I found so far. We also need to create a link to the avrdude config which is located somewhere else than expected from the IDE. This linkage also ensure that the HID Project hardware files work correct (in case you want to use it).

# install the newest avr-gcc first
apt-get -t jessie install gcc-avr
 
# install missing packages for the IDE (say yes to the message)
apt-get -t jessie install avrdude avr-libc libjssc-java libastylej-jni libcommons-exec-java libcommons-httpclient-java libcommons-logging-java libjmdns-java libjna-java libjsch-java
# install the arduino IDE
wget https://github.com/NicoHood/Arduino-IDE-for-Raspberry/releases/download/1.6.0-RC-1/arduino_1.6.0_all.deb
wget https://github.com/NicoHood/Arduino-IDE-for-Raspberry/releases/download/1.6.0-RC-1/arduino-core_1.6.0_all.deb
dpkg -i arduino-core_1.6.0_all.deb arduino_1.6.0_all.deb
 
# create fake directory and symbolic link to the new avrdude config
mkdir /usr/share/arduino/hardware/tools/avr/etc/
ln -s /etc/avrdude.conf /usr/share/arduino/hardware/tools/avr/etc/avrdude.conf

You can test your installation with (arduino ide only works under X of course). You also have an icon in the system menu under X. Happy coding :)

avr-gcc -v
startx
arduino

arduino_ide_1_6

avr-gcc

Links:

⚠️ **GitHub.com Fallback** ⚠️