Skip to content

Instantly share code, notes, and snippets.

@Nemo157
Created April 14, 2011 02:04
Show Gist options
  • Save Nemo157/918773 to your computer and use it in GitHub Desktop.
Save Nemo157/918773 to your computer and use it in GitHub Desktop.
Installs avr-gcc on OS X 10.7
gdb := gdb-7.3.1
binutils := binutils-2.20.1
gcc := gcc-4.5.1
gcc_core := gcc-core-4.5.1
gcc_gpp := gcc-g++-4.5.1
avr_libc := avr-libc-1.7.1
target := avr
prefix := /usr/local/${target}
PATH := ${prefix}/bin:${PATH}
binutils_patches := \
30-binutils-2.20.1-avr-size.patch \
31-binutils-2.20.1-avr-coff.patch \
32-binutils-2.20.1-new-sections.patch \
34-binutils-2.20.1-as-dwarf.patch \
35-binutils-2.20.1-dwarf2-AVRStudio-workaround.patch \
50-binutils-2.20.1-xmega.patch \
51-binutils-2.20.1-new-devices.patch \
53-binutils-2.20.1-xmega128a1u-64a1u.patch \
54-binutils-2.20.1-atxmega16x1-32x1.patch \
55-binutils-2.20.1-atxmega128b1.patch \
56-binutils-2.20.1-atxmega256a3bu.patch \
57-binutils-2.20.1-at90pwm161.patch \
58-binutils-2.20.1-atmega16hvb-32hvb.patch \
59-binutils-2.20.1-atmega32_5_50_90_pa.patch \
60-binutils-2.20.1-bug13789.patch \
62-binutils-2.20.1-attiny1634.patch \
64-binutils-2.20.1-atmega48pa.patch
# Removed cause it errors the build:
# 52-binutils-2.20.1-avrtiny10.patch
gcc_patches := \
20-gcc-4.5.1-libiberty-Makefile.in.patch \
30-gcc-4.5.1-fixedpoint-3-4-2010.patch \
31-gcc-4.5.1-xmega-v14.patch \
32-gcc-4.5.1-avrtiny10.patch \
33-gcc-4.5.1-osmain.patch \
34-gcc-4.5.1-builtins-v6.patch \
35-gcc-4.5.1-avrtiny10-non-fixedpoint.patch \
37-gcc-4.5.1-option-list-devices.patch \
38-gcc-4.5.1-bug13473.patch \
39-gcc-4.5.1-bug13579.patch \
40-gcc-4.5.1-bug-18145-v4.patch \
41-gcc-4.5.1-avrtiny10-bug-12510.patch \
42-gcc-4.5.1-bug12915.patch \
43-gcc-4.5.1-bug13932.patch \
44-gcc-4.5.1-bug13789.patch \
50-gcc-4.5.1-new-devices.patch \
51-gcc-4.5.1-atmega32_5_50_90_pa.patch \
54-gcc-4.5.1-attiny1634.patch \
56-gcc-4.5.1-atmega48pa.patch
# Removed cause it errors the build:
avr_libc_patches := \
40-avr-libc-1.7.1-xmega32X1.patch \
41-avr-libc-1.7.1-xmega128b1.patch \
42-avr-libc-1.7.1-bug_11793_fix.patch \
43-avr-libc-1.7.1-bug13804.patch \
50-avr-libc-1.7.1-atxmega256a3bu.patch \
51-avr-libc-1.7.1-at90pwm161.patch \
52-avr-libc-1.7.1-atmega32_5_50_90_pa.patch \
55-avr-libc-1.7.1-attiny1634.patch \
57-avr-libc-1.7.1-atmega48pa.patch
# Removed cause it errors the build:
all: pre-requisites binutils gcc avr-libc gdb
pre-requisites:
brew install libmpc
mkdir -p ${prefix}/bin
binutils:
wget -c http://ftp.gnu.org/gnu/binutils/${binutils}.tar.bz2
tar -xjf ${binutils}.tar.bz2
cd ${binutils} ; for patch in ${binutils_patches}; do \
(echo "Applying patch $${patch}" ; curl http://distribute.atmel.no/tools/opensource/avr-gcc/${binutils}/$${patch} 2>/dev/null | patch -p0); \
done
mkdir -p ${binutils}/build-${target}
cd ${binutils}/build-${target} ; ../configure --target=${target} --prefix=${prefix} \
--disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-as --with-gnu-ld \
--disable-werror
cd ${binutils}/build-${target} ; make && make install
gcc:
wget -c http://ftp.gnu.org/gnu/gcc/${gcc}/${gcc_core}.tar.bz2
wget -c http://ftp.gnu.org/gnu/gcc/${gcc}/${gcc_gpp}.tar.bz2
tar -xjf ${gcc_core}.tar.bz2
tar -xjf ${gcc_gpp}.tar.bz2
cd ${gcc} ; for patch in ${gcc_patches}; do \
(echo "Applying patch $${patch}" ; curl http://distribute.atmel.no/tools/opensource/avr-gcc/${gcc}/$${patch} 2>/dev/null | patch -p0); \
done
mkdir -p ${gcc}/build-${target}
cd ${gcc}/build-${target} ; ../configure --target=${target} --prefix=${prefix} \
--disable-nls --disable-shared --disable-threads \
--with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 \
--enable-languages=c,c++ --disable-libssp -v
cd ${gcc}/build-${target} ; make && make install
avr-libc:
wget -c http://download.savannah.gnu.org/releases/avr-libc/${avr_libc}.tar.bz2
tar -xjf ${avr_libc}.tar.bz2
cd ${avr_libc} ; for patch in ${avr_libc_patches}; do \
(echo "Applying patch $${patch}" ; curl http://distribute.atmel.no/tools/opensource/avr-gcc/${avr_libc}/$${patch} 2>/dev/null | patch -p0); \
done
mkdir -p ${avr_libc}/build-${target}
cd ${avr_libc}/build-${target} ; ../configure --prefix=${prefix} --build=`../config.guess` --host=${target}
cd ${avr_libc}/build-${target} ; make && make install
gdb:
wget -c http://ftp.gnu.org/gnu/gdb/${gdb}.tar.gz
tar -xzf ${gdb}.tar.gz
mkdir -p ${gdb}/build-${target}
cd ${gdb}/build-${target} ; ../configure --target=${target} --prefix=${prefix} --disable-nls
cd ${gdb}/build-${target} ; make && make install
clean:
rm -rf ${gcc} ${gdb} ${binutils} ${avr_libc}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment