Difference between revisions of "AVR toolchain compilation"

From DiLab
Jump to: navigation, search
m
m
Line 1: Line 1:
Installation process is an adapted version of [http://www.cs.mun.ca/~paul/cs4723/material/atmel/avr-libc-user-manual-1.6.5/install_tools.html AVR libc tutorial] (Accessed 07.nov.2010.):
This document is an adapted version of [http://www.cs.mun.ca/~paul/cs4723/material/atmel/avr-libc-user-manual-1.6.5/install_tools.html AVR libc tutorial].


Create a new directory, where the toolchain source files will be stored temporarily.
Create a new directory, where the toolchain source files will be stored temporarily.
Line 5: Line 5:
Save the GCC patch file in this directory.
Save the GCC patch file in this directory.


Run the following script! You will be asked for password, as sudo command is used. User account with administrator (sudo) rights is required. Wget tool is required to fetch source files from [http://www.gnu.org/software/software.html GNU] sites.
Run the following script! You will be asked for a password, as sudo command is used. User account with administrator (sudo) rights is required. ''wget'' tool is required to fetch source files from [http://www.gnu.org/software/software.html GNU] sites.


<pre>
<pre>
#!/bin/bash
#!/bin/bash


# will be installed under /usr/local . Change here, if other destination is needed
# will be installed under /usr/local. Change here, if other destination is needed
export PREFIX=/usr/local
export PREFIX=/usr/local


PATH="$PREFIX/bin:$PATH"
PATH="$PREFIX/bin:$PATH"
TOPDIR:=`pwd`


# GMP:
# GMP:
Line 19: Line 20:
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
bunzip2 -c gmp-4.3.2.tar.bz2 | tar xf -
bunzip2 -c gmp-4.3.2.tar.bz2 | tar xf -
cd gmp-4.3.2
mkdir gmp-4.3.2/obj
mkdir obj
cd gmp-4.3.2/obj
cd obj
echo "Building GMP..."
echo "Building GMP..."
../configure --prefix=$PREFIX
../configure --prefix=$PREFIX
make
make
sudo make install
sudo make install
cd ../..


# MPFR:
# MPFR:
Line 31: Line 32:
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
bunzip2 -c mpfr-2.4.2.tar.bz2 | tar xf -
bunzip2 -c mpfr-2.4.2.tar.bz2 | tar xf -
cd mpfr-2.4.2
mkdir mpfr-2.4.2/obj
cd mpfr-2.4.2/obj
mkdir obj
cd obj
echo "Building MPFR..."
echo "Building MPFR..."
../configure --prefix=$PREFIX
../configure --prefix=$PREFIX
make
make
sudo make install
sudo make install
cd ../..


# MPC:
# MPC:
Line 43: Line 44:
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
tar -xzf mpc-0.8.1.tar.gz
tar -xzf mpc-0.8.1.tar.gz
cd mpc-0.8.1
mkdir mpc-0.8.1/obj
mkdir obj
cd mpc-0.8.1/obj
cd obj
echo "Building MPC..."
echo "Building MPC..."
../configure --prefix=$PREFIX
../configure --prefix=$PREFIX
make
make
sudo make install
sudo make install
cd ../..
# BINUTILS:
# BINUTILS:
Line 64: Line 65:
make
make
sudo make install
sudo make install
cd ../..


# GCC:
# GCC:

Revision as of 13:58, 18 April 2011

This document is an adapted version of AVR libc tutorial.

Create a new directory, where the toolchain source files will be stored temporarily.

Save the GCC patch file in this directory.

Run the following script! You will be asked for a password, as sudo command is used. User account with administrator (sudo) rights is required. wget tool is required to fetch source files from GNU sites.

#!/bin/bash

# will be installed under /usr/local. Change here, if other destination is needed
export PREFIX=/usr/local

PATH="$PREFIX/bin:$PATH"
TOPDIR:=`pwd`

# GMP: 
echo "Fetching GMP, required by GCC..."
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
bunzip2 -c gmp-4.3.2.tar.bz2 | tar xf -
mkdir gmp-4.3.2/obj
cd gmp-4.3.2/obj
echo "Building GMP..."
../configure --prefix=$PREFIX
make
sudo make install
cd ../..

# MPFR:
echo "Fetching MPFR, required by GCC..."
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
bunzip2 -c mpfr-2.4.2.tar.bz2 | tar xf -
mkdir mpfr-2.4.2/obj
cd mpfr-2.4.2/obj
echo "Building MPFR..."
../configure --prefix=$PREFIX
make
sudo make install
cd ../..

# MPC:
echo "Fetching MPC, required by GCC..."
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
tar -xzf mpc-0.8.1.tar.gz
mkdir mpc-0.8.1/obj
cd mpc-0.8.1/obj
echo "Building MPC..."
../configure --prefix=$PREFIX
make
sudo make install
cd ../..
 
# BINUTILS:
echo "Fetching binutils..."
wget http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.gz
tar -xzf binutils-2.20.tar.gz
cd binutils-2.20
cp ../gas-patch-newdevices.patch ./
echo "Building binutils..."
patch -p0 < gas-patch-newdevices.patch
mkdir obj-avr
cd obj-avr
../configure --prefix=$PREFIX --target=avr --disable-nls
make
sudo make install
cd ../..

# GCC:
echo "Fetching GCC…"
wget http://ftp.gnu.org/gnu/gcc/gcc-4.5.0/gcc-core-4.5.0.tar.gz
tar -xzf gcc-core-4.5.0.tar.gz
cd gcc-4.5.0
cp ../gcc-new-device-support.patch ./
echo "Building GCC..."
patch -p0 < gcc-new-device-support.patch
mkdir obj-avr
../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2