Skip to content

Commit

Permalink
stm32f4: build: add a Dockerfile based on Alpine Linux 3.5
Browse files Browse the repository at this point in the history
Take the relevant parts of the toolchain build script from [1] and put
them into a Dockerfile. Work around Docker issue #9314 [2] by fetching
the newlib archive via `curl` instead of using the ADD instruction.

Add gdb dependencies expat-dev, ncurses-dev, python-dev and xz-dev.

[1] https://github.com/istarc/stm32/blob/master/build-ARM-toolchain/build.sh
[2] moby/moby#9314
  • Loading branch information
obruns committed Mar 7, 2017
1 parent 9c00059 commit 5561c1e
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions stm32/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
FROM alpine:3.5
MAINTAINER Oliver Bruns [email protected]

RUN apk update && \
apk add --update \
alpine-sdk \
expat-dev \
gmp-dev \
mpc1-dev \
mpfr-dev \
ncurses-dev \
python-dev \
texinfo \
zlib-dev \
xz \
xz-dev && \
apk add \
--update-cache \
--repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \
stlink

ENV BINUTILS binutils-2.27
ENV GCC gcc-6.3.0
ENV GDB gdb-7.12.1
ENV NEWLIB newlib-2.5.0
ENV TARGET arm-none-eabi

RUN mkdir /tmp/arm

ADD https://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2 /tmp/arm
ADD https://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.bz2 /tmp/arm
ADD https://ftp.gnu.org/gnu/gdb/${GDB}.tar.xz /tmp/arm
RUN cd /tmp/arm && \
curl --remote-name ftp://sourceware.org/pub/newlib/${NEWLIB}.tar.gz && \
tar -xjf ${BINUTILS}.tar.bz2 && \
tar -xjf ${GCC}.tar.bz2 && \
tar -xJf ${GDB}.tar.xz && \
tar -xzf ${NEWLIB}.tar.gz

RUN cd /tmp/arm/${BINUTILS} && \
./configure \
--target=${TARGET} \
--with-cpu=cortex-m4 \
--with-fpu=fpv4-sp-d16 \
--with-float=hard \
--with-mode=thumb \
--enable-interwork \
--enable-multilib \
--with-gnu-as \
--with-gnu-ld \
--disable-nls && \
make -j4 all && \
make install && \
cd /tmp/arm/${GCC} && \
mkdir build1 && cd build1 && \
../configure \
--target=${TARGET} \
--with-cpu=cortex-m4 \
--with-fpu=fpv4-sp-d16 \
--with-float=hard \
--with-mode=thumb \
--enable-interwork \
--enable-multilib \
--with-system-zlib \
--with-newlib \
--without-headers \
--disable-shared \
--disable-nls \
--with-gnu-as \
--with-gnu-ld \
--enable-languages="c" && \
make -j4 all-gcc && \
make install-gcc && \
cd /tmp/arm/${NEWLIB} && \
./configure \
--target=${TARGET} \
--with-cpu=cortex-m4 \
--with-fpu=fpv4-sp-d16 \
--with-float=hard \
--with-mode=thumb \
--enable-interwork \
--enable-multilib \
--disable-newlib-supplied-syscalls \
--with-gnu-as \
--with-gnu-ld \
--disable-nls \
--disable-newlib-nano-malloc && \
make -j4 all && \
make install && \
cd /tmp/arm/${GCC} && \
mkdir build2 && cd build2 && \
../configure \
--target=$TARGET \
--with-cpu=cortex-m4 \
--with-fpu=fpv4-sp-d16 \
--with-float=hard \
--with-mode=thumb \
--enable-interwork \
--enable-interwork \
--enable-multilib \
--with-system-zlib \
--with-newlib \
--disable-shared \
--disable-nls \
--with-gnu-as \
--with-gnu-ld \
--enable-languages="c,c++" && \
make -j4 all && \
make install && \
cd /tmp/arm/${GDB} && \
./configure --target=${TARGET} && \
make -j4 all && \
make install && \
rm -r /tmp/arm/${GCC} \
/tmp/arm/${BINUTILS} \
/tmp/arm/${GDB} \
/tmp/arm/${NEWLIB} \
/tmp/arm

0 comments on commit 5561c1e

Please sign in to comment.