Building the arm-linux-gnueabi target
Mike via D.gnu
d.gnu at puremagic.com
Sun Jul 13 05:00:41 PDT 2014
On Sunday, 13 July 2014 at 10:10:34 UTC, Joseph Rushton Wakeling
via D.gnu wrote:
> I decided it was time to start pulling out Adam Ruppe's
> embedded programming guide, and as a decidedly non-embedded
> programmer, the instructions here:
> http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler
>
> ... are not something I'm confident in just following (not
> least because e.g. certain scripts are provided without much
> indication of what they should be called, where they should be
> placed, or how to use them).
Those instructions came from my personal script that I use to
build GDC from time-to-time. It's all one script. I broke it up
in the wiki in an effort to explain the process so one could
adapt it to their needs. Here's the entire script I use. I run
it from within my ~/gdc folder and it installs to my
~/gdc-arm-none-eabi folder.
###########################################
# gcc.gnu.org/install/configure.html
# http://wiki.dlang.org/GDC/Cross_Compiler/Generic
set -e
export TARGET=arm-none-eabi
export PREFIX=/home/mike/gdc-arm-none-eabi
# export PATH=$PATH:$PREFIX/bin
# Delete existing binutils source archive and download a new one
#-------------------------------------------------------------------
export BINUTILS_NAME=binutils-2.24
export BINUTILS_SOURCE_ARCHIVE=$BINUTILS_NAME.tar.bz2
rm -f $BINUTILS_SOURCE_ARCHIVE
rm -rf $BINUTILS_NAME
wget http://ftpmirror.gnu.org/binutils/$BINUTILS_SOURCE_ARCHIVE
# Extract binutils
#-------------------------------------------------------------------
tar xjfv $BINUTILS_SOURCE_ARCHIVE
# Create binutils build directory
#-------------------------------------------------------------------
export BINUTILS_BUILD_DIR=binutils-build
rm -rf $BINUTILS_BUILD_DIR
mkdir $BINUTILS_BUILD_DIR
# Configure and build binutils
#-------------------------------------------------------------------
cd $BINUTILS_BUILD_DIR
../$BINUTILS_NAME/configure \
--target=$TARGET \
--prefix=$PREFIX \
--disable-nls \
--disable-multilib \
--with-gnu-as \
--with-gnu-ld \
--disable-libssp \
--disable-werror \
--enable-lto \
--enable-gold \
--enable-plugins
make -j4 all
make install
cd ..
# Download GDC
#-------------------------------------------------------------------
rm -rf gdc
mkdir gdc
git clone https://github.com/D-Programming-GDC/GDC.git gdc
cd gdc
# cp -r /home/mike/repositories/GDC/* .
git checkout gdc-4.9
cd ..
# Delete existing GCC source archive and download a new one
#-------------------------------------------------------------------
export GCC_NAME=gcc-4.9.0
export GCC_SOURCE_ARCHIVE=$GCC_NAME.tar.bz2
rm -f $GCC_SOURCE_ARCHIVE
rm -rf $GCC_NAME
wget
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/$GCC_NAME/$GCC_SOURCE_ARCHIVE
# Extract GCC
#-------------------------------------------------------------------
tar xjfv $GCC_SOURCE_ARCHIVE
# Turn GCC into GDC
#-------------------------------------------------------------------
cd gdc
./setup-gcc.sh ../$GCC_NAME
cd ..
# Patch GDC
#-------------------------------------------------------------------
# cd $GCC_NAME
# cp ../issue_108.patch .
# patch -p1 -i issue_108.patch
# cp ../issue_114.patch .
# patch -p1 -i issue_114.patch
# cp ../issue_114-2.patch .
# patch -p1 -i issue_114-2.patch
# cd ..
# Create GDC build directory
#-------------------------------------------------------------------
export GCC_BUILD_DIR=gcc-build
rm -rf $GCC_BUILD_DIR
mkdir $GCC_BUILD_DIR
# Configure and build GDC
#-------------------------------------------------------------------
cd $GCC_BUILD_DIR
../$GCC_NAME/configure --target=$TARGET --prefix=$PREFIX \
--enable-languages=d \
--disable-bootstrap \
--disable-libssp \
--disable-libgomp \
--disable-libmudflap \
--disable-multilib \
--disable-libphobos \
--disable-decimal-float \
--disable-libffi \
--disable-libmudflap \
--disable-libquadmath \
--disable-libssp \
--disable-libstdcxx-pch \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-tls \
--with-gnu-as \
--with-gnu-ld \
--with-cpu=cortex-m4 \
--with-tune=cortex-m4 \
--with-mode=thumb \
--without-headers \
--enable-lto \
--enable-gold \
--enable-plugins
make -j4 all-gcc
make -j4 all-target-libgcc
make install-gcc
make install-target-libgcc
cd ..
#####################################
This is for ARM Thumb (ARM Cortex-M), not ARM9, ARM11, ARM
Cortex-A hardware. It is for the barest of bare-metal (no libc,
no D runtime, no phobos, etc...), intended for those who want to
actually create a D runtime.
Mike
More information about the D.gnu
mailing list