Skip to content

Commit

Permalink
Update to avr-gcc 9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Jul 25, 2019
1 parent 54cccb2 commit 5016dc8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build AVR GNU GCC Toolchain from source

[![CircleCI](https://circleci.com/gh/salkinium/docker-avr-gcc-7.svg?style=svg)](https://circleci.com/gh/salkinium/docker-avr-gcc-7)
[![CircleCI](https://circleci.com/gh/salkinium/docker-avr-gcc.svg?style=svg)](https://circleci.com/gh/salkinium/docker-avr-gcc)

This work is based on the work of
[@strongly-typed](https://github.com/strongly-typed/build-atmel-avr-gnu-toolchain).
Expand All @@ -16,13 +16,13 @@ There is a Docker image with all prerequisites for building. Start it with:
Inside the Docker container get this repository

```sh
git clone https://github.com/salkinium/docker-avr-gcc-7.git
git clone https://github.com/salkinium/docker-avr-gcc.git
```

Run the build.sh script

```sh
cd docker-avr-gcc-7
cd docker-avr-gcc
time bash build.sh
```

Expand All @@ -33,4 +33,4 @@ The toolchain will be in `avr-gcc`.
There is a CircleCI job defined in `.circleci/config.yml` which builds the
toolchain using the Docker container. For tagged commits, a Github release
will be created with the toolchain put into a downloadable `.tar.bz2` at
[Releases](https://github.com/salkinium/docker-avr-gcc-7/releases).
[Releases](https://github.com/salkinium/docker-avr-gcc/releases).
25 changes: 16 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ mkdir ${BUILD}
mkdir ${INSTALL}
root=$(pwd)
cores=4
VERSION_BINUTILS="2.32"
VERSION_GCC="9.1.0"
VERSION_LIBC="2.0.0"

# Get sources
wget -q "https://raw.githubusercontent.com/osx-cross/homebrew-avr/master/avr-binutils-size.patch" &
wget -qO- "https://ftp.gnu.org/gnu/binutils/binutils-2.31.1.tar.bz2" | tar xj --directory ${SRC} &
wget -qO- "https://ftp.gnu.org/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.xz" | tar xJ --directory ${SRC} &
wget -qO- "https://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2" | tar xj --directory ${SRC} &
wget -q "https://dl.bintray.com/osx-cross/avr-patches/avr-binutils-${VERSION_BINUTILS}-size.patch" &
wget -q "https://dl.bintray.com/osx-cross/avr-patches/avr-libc-${VERSION_LIBC}-atmega168pb.patch" &
wget -qO- "https://ftp.gnu.org/gnu/binutils/binutils-${VERSION_BINUTILS}.tar.bz2" | tar xj --directory ${SRC} &
wget -qO- "https://ftp.gnu.org/gnu/gcc/gcc-${VERSION_GCC}/gcc-${VERSION_GCC}.tar.xz" | tar xJ --directory ${SRC} &
wget -qO- "https://download.savannah.gnu.org/releases/avr-libc/avr-libc-${VERSION_LIBC}.tar.bz2" | tar xj --directory ${SRC} &
wait

# Build binutils first
cd ${SRC}/binutils-2.31.1
cd ${SRC}/binutils-${VERSION_BINUTILS}
# patch size file
patch -g 0 -f -p0 -i ../../avr-binutils-size.patch
patch -g 0 -f -p0 -i ../../avr-binutils-${VERSION_BINUTILS}-size.patch
mkdir build && cd build
# configure and make
../configure --prefix=${root}/${INSTALL}/avr-binutils/ --target=avr --disable-nls --disable-werror
Expand All @@ -31,7 +35,7 @@ make install
export PATH=${root}/${INSTALL}/avr-binutils/bin:$PATH

cd ${root}
cd ${SRC}/gcc-8.2.0
cd ${SRC}/gcc-${VERSION_GCC}
mkdir build && cd build
../configure --target=avr --prefix=${root}/${INSTALL}/avr-gcc/ \
--with-ld=${root}/${INSTALL}/avr-binutils/bin/avr-ld \
Expand All @@ -46,10 +50,13 @@ make install
export PATH=${root}/${INSTALL}/avr-gcc/bin:$PATH

cd ${root}
cd ${SRC}/avr-libc-2.0.0
cd ${SRC}/avr-libc-${VERSION_LIBC}
patch -g 0 -f -p0 -i ../../avr-libc-${VERSION_LIBC}-atmega168pb.patch
build=`./config.guess`
./configure --build=${build} --prefix=${root}/${INSTALL}/avr-gcc --host=avr
make install -j${cores}

cd ${root}
rm -r build src avr-binutils-size.patch
rm -r build src
rm avr-binutils-${VERSION_BINUTILS}-size.patch
rm avr-libc-${VERSION_LIBC}-atmega168pb.patch

0 comments on commit 5016dc8

Please sign in to comment.