Building an ARM cross-toolchain with binutils, gcc, newlib, and gdb from source

Update: Please don't use this script, a fixed and updated version is now maintained in the summon-arm-toolchain git repo. Direct download: summon-arm-toolchain.

I've been planning to write about building custom ARM toolchains for a while (I used stuff from gnuarm.com in the past, but I switched to the lastest and greatest upstream versions at some point). Among other things, recent upstream versions now have ARM Cortex support.

First you will need a few base utilities and libs (this list may not be complete):

  $ apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential

Then you can use my tiny build-arm-toolchain script, which will download, build, and install the whole toolchain:

  $ cat build-arm-toolchain
  #!/bin/sh
  # Written by Uwe Hermann <uwe@hermann-uwe.de>, released as public domain.
  [...]

Update: Please don't use this script, a fixed and updated version is now maintained in the summon-arm-toolchain git repo. Direct download: summon-arm-toolchain.

The final toolchain is located in /tmp/arm-cortex-toolchain per default, and is ca. 170 MB in size. I explicitly created the build script in such a way that it minimizes the amount of disk space used during the build (ca. 1.2 GB or so, compared to more than 3 GB in the "naive" approach).

Using the "-j 2" option for make (see script) you can speed up the build quite a bit on multi-core machines (ca. 30 minutes vs. 60 minutes on an AMD X2 dual-core box). Also, you can change the script to build for other target variants if you want to (arm-elf or arm-none-eabi, for example).

Checkout the blog entry How to build arm gnu gcc toolchain for Mac OS X by Piotr Esden-Tempski for similar instructions for Mac OS X users.

Oh, and while I'm at it — does anybody have any idea why there are no pre-built toolchains for embedded (microcontroller) ARM targets in Debian? There are some toolchains for other microcontroller architectures (avr, m68hc1x, h8300, z80) but not too much other stuff. Is there some specific reason for the missing ARM toolchains (other than "nobody cared enough yet")?

I have heard about Emdebian, but from a quick look that seems to be more intended for toolchains with Linux/libc, not for microcontroller firmware (i.e. no MMU, no Linux, no libc etc.), but maybe I'm wrong?

Update: Please don't use this script, a fixed and updated version is now maintained in the summon-arm-toolchain git repo. Direct download: summon-arm-toolchain.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Something broken in the new script ???

I ran the new script and it goes fine until it broke due to a missing patch...

* Patching gcc to add multilib support
******************************************************************
patch: **** Can't open patch file ../patches/patch-gcc-config-arm-t-arm-elf.diff : No such file or directory

Any idea ?

Thx

Don't download the linked

Don't download the linked script itself, but use git clone to get the full repo. Otherwise the patches will be missing, resulting in this error.

Error

Hm, works fine for me with the latest git version. Did you change any settings? Does the patches/patch-gcc-config-arm-t-arm-elf.diff exist in your git clone?

Thanks!

Just used your toolchain to build a couple of static binaries for my Buffalo Terastation. They work on a variety of other ARM-Linux hosts as well so I've put them up at http://mocko.org.uk/projects/armbinaries/. Muchas gracias!

Downloading newlib fails

First, and most important, thank you for this wonderful work. Awesome!

Now for my first (hopefully only) problem. The script hangs trying to download newlib. Here's the output:

Error in server response, closing control connection.
Retrying.
--2011-03-24 14:22:35-- ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
(try: 9) => `newlib-1.19.0.tar.gz'
Connecting to sources.redhat.com|209.132.180.131|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/newlib ... done.
==> SIZE newlib-1.19.0.tar.gz ... 14323667
==> PORT ... done. ==> RETR newlib-1.19.0.tar.gz ...
Error in server response, closing control connection.
Retrying.
--2011-03-24 14:25:53-- ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
(try:10) => `newlib-1.19.0.tar.gz'

I finally stopped the script after 10 tries and decided to consult an expert (you). Can you give me any idea what might be wrong and how to get beyond it?

I verified that newlib 1.19.0 is still available on the redhat site. I considered downloading it directly, but not sure where to put it.

Thanks.

Downloading newlib fails

jim,

remove this option from the wget command line:
--no-passive-ftp

good luck

uwe,

thanks for the script

floating point problems on Cortex M3

Hi!
Thank you for the post, it has helped me verry much.
Now I am stuck with floating point operations.
I have a Cortex M3 board from Futurlec(http://www.futurlec.com/ET-STM32_Stamp.shtml).
I have tried some tests:

float x;
float y;
y = 12.0f;
x = 123.5f + y;
printf("%d\r\n", (int)x);
This is working and the result is 135, as it should.
The problem is that if I am passing to a function a pointer to a float and set it in the function, the program stops at the assignment point.

This code is not working:
float x;
void func(float *var){
int z=50;
*var = (float)z;
}
func(&x);

This code is working:
float x;
void func(float *var){
int z=50;
*var = (float)50; // modified line
}
func(&x);

Can you please help me if you have any idea..
Regards,
Andrei

Hello mr.Uwe, I have trouble

Hello mr.Uwe,

I have trouble in compiling have this error message

checking whether to enable dummy minidriver... no
checking whether standard drivers can be built... yes
checking Build & Link with libftdi...... configure: error: Cannot build & run test program using libftdi

How repair it and finish compiling??

wbr

Ibro

Install libftdi :) eg port

Install libftdi :)

eg port install libftdi

But will it work for C++?

Uwe:

Thank you so much for the tool chain. I'm using it for C development and it works spot-on. However, I'm trying to get things going with C++, and I'm running into a huge snarl of library, config file, and other dependency issues in the code.

Is there a "hello world" or a blinky-light program or other functioning example of how to get this working for a Cortex-m3 processor, using C++?

Soft Floating Point?

I built the tools under Ubuntu Maverick. Multilibs are created: the base library, 'thumb' library and 'fpu' library. Invoking 'arm-elf-gcc -print-multi-lib' tells me the fpu is for hardware floating point. Building an application for LPC2148 I get link errors which says 'gcclib.a' uses hardware floating point while my application uses software floating point.
Q: How do I get the libraries to build with soft FP?
Is it a matter of adding '--with-float=soft' to GCCFLAGS?
-Scott

#fix, TW #(use soft float in

#fix, TW
#(use soft float in libs)
FLOATING="--with-float=soft"

...

../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls $FLOATING

...

I inserted $FLOATING in all configure calls

RGDS :-)

Script failed due to some reasons

Hallo,
Because i need mcpu=cortex_m0 i was looking to compile a more recent version.
Nice script, but failed in my case initially.
Reasons:
- using Ubuntu 9.10, libmpc in the repository is to old (v0.7.2), i needed to install
mpc-0.8.2 from the given url.

- setting SUDO=sudo and PREFIX=/usr/local/arm_2010_q4 ended in an error-
message during install of newlib: (usr/bin/install '/usr/local/arm_2010_q4/lib' mlibc.a ...):
Programm nicht gefunden (program not found),
but 'arm-none-eabi-ranlib' was already present in /usr/local/arm_2004_q4/bin.

- export PATH=$PATH/usr/local/arm_2004_q4/bin manually did not help

- setting 'alias sudo='sudo env PATH=$PATH' in my ~./bashrc did not help either.
(if you sudo in Ubuntu 9.10 $PATH will change!)

Solution: compile without sudo to a local directory and
sudo mv * /usr/local/arm_2010_q4.

To do a quick test, i took a lm3s811_evalboard-example from Martin Thomas,
changed CPU to cortex-m0 and the example was compiled without errors (but, of course, will
not run).

thanks!

Configuring gcc 4.5.1 error

I've run the script with the only -j 4 modification under a Debian Testing and I have the next error.

******************************************************************
* Configuring gcc-4.5.1-boot
******************************************************************

checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make: *** [configure-zlib] Error 1

What am I doing wrong?

By the way, I had to run the script several (three times I think) times to reach this step, is it normal?

QEMU + ARM

Can any one give me procedure how to run Debian/Linux in Qemu. And how to develop with this setup.

Any additional information. Please sen it to my email: dwnlds.guru@gmail.com

regards.

toolchain

Your cross-toolchain script is pretty stale. Try this one.


#!/bin/sh
# Builds a arm-eabi cross compiler for use on linux
# host systems. This target has no file system or kernel.
#
TARGET="arm-none-eabi"
SRC="/build-dir/packages" # package directory
PREFIX="/build-dir/arm/toolchain" # final toolchain directory
PARALLEL="-j 2"
BINUTILS=binutils-2.20
GCC=gcc-4.5.1
GMP=gmp-5.0.1
MPFR=mpfr-3.0.0
MPC=mpc-0.8.2
NEWLIB=newlib-1.18.0
# Note: the 7.x series of GDB seem to have issues with psim...
GDB=gdb-6.8
export PATH="$PATH:$PREFIX/bin"
# Before we do anything we need all the source files.
# We keep them in one place and we never need to
# download them twice if this build fails.
mkdir $SRC
cd $SRC
echo "Dounloading source packages. This may take a while."
echo
wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
wget -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2
wget -c ftp://ftp.gmplib.org/pub/$GMP/$GMP.tar.bz2
wget -c http://www.mpfr.org/mpfr-current/$MPFR.tar.bz2
wget -c http://www.multiprecision.org/mpc/download/$MPC.tar.gz
wget -c ftp://sources.redhat.com/pub/newlib/$NEWLIB.tar.gz
wget -c ftp://ftp.gnu.org/gnu/gdb/$GDB.tar.bz2
cd ..
echo "Starting Build..."
echo
mkdir build
echo "Building binutils"
echo
tar xfj $SRC/$BINUTILS.tar.bz2
cd build
../$BINUTILS/configure --target=$TARGET --prefix=$PREFIX \
--enable-interwork --disable-multilib --with-gnu-as \
--with-gnu-ld --disable-nls --disable-werror
make $PARALLEL
make install
cd ..
rm -rf build/* $BINUTILS
echo "Building GCC pass 1"
tar xfj $SRC/$GCC.tar.bz2
# the compiler math prereqs
tar -jxf $SRC/$GMP.tar.bz2
tar -jxf $SRC/$MPFR.tar.bz2
tar -zxf $SRC/$MPC.tar.gz
cd $GCC
mv ../$GMP gmp
mv ../$MPFR mpfr
mv ../$MPC mpc
cd ../build
../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
--disable-multilib --enable-languages="c" --with-newlib \
--with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
--without-headers --disable-shared --disable-nls --with-gnu-as --with-gnu-ld
make $PARALLEL all-gcc
make install-gcc
cd ..
rm -rf build/* # (We retain the GCC directory for pass 2)
echo "Building Newlib"
echo
tar xfz $SRC/$NEWLIB.tar.gz
cd build
../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
--disable-multilib --with-gnu-as --with-gnu-ld --disable-nls
make $PARALLEL
make install
cd ..
rm -rf build/* $NEWLIB
echo " Building GCC pass 2"
echo
cd build
../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
--disable-multilib --enable-languages="c,c++" --with-newlib \
--with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
--without-headers --disable-shared --disable-libssp --disable-nls \
--disable-hardfloat --enable-threads=single --with-gnu-as --with-gnu-ld
make $PARALLEL
make install
cd ..
rm -rf build/* $GCC
echo "Building GDB"
echo
tar xfj $SRC/$GDB.tar.bz2
cd build
../$GDB/configure --target=$TARGET --prefix=$PREFIX \
--enable-interwork --disable-multilib
make all
make install
cd ..
rm -rf build $GDB
echo "Lets see if it compiles without errors..."
echo 'main(){}' > dummy.c
$PREFIX/bin/$TARGET-gcc-4.5.1 dummy.c -o dummy
ls -l dummy
rm dummy dummy.c a.out
echo "cool! that's a start"
echo "Compiler Finished for "$TARGET
# All that should be left now is this script, the new toolchain and the packages.
# Save the packages for other tuned toolchains.

languages option

Hi,
I noticed that the "--enable-languages" option has "c" on one line
and then "c,c++" on a following line. What is the purpose? Typo?

rs

t-arm-elf file

Hi,

The gcc-4.5.1/gcc/config/arm/t-arm-elf file has not been altered.
Should it be changed before the build?

Does anybody use the t-arm-elf file from the GNUARM site?

libmpc-dev

Excellent script, Uwe.

I updated the package versions to match Yagarto, and I also had to install libmpc-dev on my Ubuntu 10.04. Hope this helps someone.

libmpc-dev

Thanks, fixed in the article, will also be mentioned soon in the latest summon-arm-toolchain version from git.

Hi Uwe, Why gcc is compiled

Hi Uwe,
Why gcc is compiled two times?
Thanking You,
Ras

gcc compiled twice

Hi, not sure what exactly the technical low-level reason is, but you definately need to build some parts twice. This site has a short explanation. Let me quote:

There's a bootstrapping problem that requires some of the components to be built twice. Briefly, the problem is that building the C cross-compiler requires having the ARM GNU C Library, but of course, building the ARM GNU C Library requires a C cross-compiler. The solution to this circular dependency is to first install the GNU C library headers, then build the C compiler without the C Library, use it to build the C library, then rebuild the full set of GNU compilers. Lather, rinse, repeat.

GDB support for cortex-m3

Hi,
Is the current gdb support debugging of cortex-m3 processors? The latest codesourcery's gdb doesn't support simulation of cortex-m3. So please let me know.
Thanking You
Ras

cortex-m3 gdb

Hm, don't know, sorry.

Excellent script

Works great on Fedora 12. No problems, and compiles ARM code fine. I tried with gcc 4.4.4

Note, later versions of gcc, e.g. after 4.1 seem to have problems with optimization -O2, and the volatile prefix does not correct the problem.

Optimization issues

That may or may not be a compiler bug, but likely not. There could be various other issues in your code which might lead to stuff being optimized away, a missing "volatile" keyword is not the only situation where stuff may go wrong.

Combination

Hi,
Can anyone tell me how to find out which combination of tools I need to compile. Like which versions of each tool I need to use. Is it that I need to take the latest versions of each tool?

Hi, Why we need to compile

Hi,
Why we need to compile binutils, newlib-1.17.0, gdb-6.8 as they are available in Ubuntu repositories?

Updated Script, tested on Ubuntu 10.04

Hello,

I just updated the script to the latest packages. Quickly tested on Ubuntu Lucid, so far no problems.

The dependency list for GDB is not complete to compile on Ubuntu.
I had to install libncurses-dev

what I changed to the script is:

BINUTILS=binutils-2.20.1
GCC=gcc-4.4.4
NEWLIB=newlib-1.18.0
GDB=gdb-7.1

I didn't manage to compile with GCC 4.5.0, but will try this again soon

Benjamin

Thanks

That helped me out on a recent install

Hi Uwe, I try your script in

Hi Uwe,
I try your script in Ubuntu 9.10 and got some error like follow:
-----------------------------------------------------------------------------------------
Wno-char-subscripts -Werror ../../gdb-6.8/gdb/cli/cli-cmds.c
cc1: warnings being treated as errors
../../gdb-6.8/gdb/cli/cli-cmds.c: In function ‘pwd_command’:
../../gdb-6.8/gdb/cli/cli-cmds.c:323: error: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result
make[2]: *** [cli-cmds.o] Error 1
make[2]: Leaving directory `/home/chris/Downloads/build/gdb'
make[1]: *** [install-gdb] Error 2
make[1]: Leaving directory `/home/chris/Downloads/build'
make: *** [install] Error 2
-----------------------------------------------------------------------------------------
please, help me to fix this problem.
thanks!

Fixed via --disable-werror

This should be fixed in the latest summon-arm-toolchain version from git.

Newlib-1.180.0

Hi Uwe

I am installing ARM toolchain, and this moment I installed binutils-2.20.51 and gcc-4.3.3 and whit newlib I configure it:

./configure --target=arm-elf --prefix=/home/alejandro/bin/arm-elf --enable-interwork --enable-multilib --with-float=soft --disable-werror

but when I install something happens and will not let me and shows me this error:

./make -j 2

/tmp/ccRfX9Qs.s: Assembler messages:
/tmp/ccRfX9Qs.s:173: Error: selected processor does not support `ldrh w2,[wp2]'
make[9]: *** [lib_a-strcmp.o] Error 1
make[9]: *** Se espera a que terminen otras tareas....
/tmp/ccXSKexr.s: Assembler messages:
/tmp/ccXSKexr.s:87: Error: selected processor does not support `ldrh r2,[r1],#2'
/tmp/ccXSKexr.s:90: Error: selected processor does not support `strneh r2,[ip],#2'
make[9]: *** [lib_a-strcpy.o] Error 1
make[9]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/nofmult/newlib/libc/machine/arm'
make[8]: *** [all-recursive] Error 1
make[8]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/nofmult/newlib/libc/machine'
make[7]: *** [all-recursive] Error 1
make[7]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/nofmult/newlib/libc'
make[6]: *** [all-recursive] Error 1
make[6]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/nofmult/newlib'
make[5]: *** [all] Error 2
make[5]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/nofmult/newlib'
make[4]: *** [multi-do] Error 1
make[4]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/newlib'
make[3]: *** [all-multi] Error 2
make[3]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/newlib'
make[2]: *** [all] Error 2
make[2]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0/arm-elf/newlib'
make[1]: *** [all-target-newlib] Error 2
make[1]: se sale del directorio `/home/alejandro/gnu_arm_toolchain/newlib-1.18.0'
make: *** [all] Error 2

please, what do I must do to fix this?
thanks for help me

Assembler error message

Hi,
The error message happens because "ldrh ..." line is a thumb instruction.
I am using newlib-1.19.0 but the same problem happens when I try to
build newlib-1.18.0.

arm-thumb-elf-gcc -B/usr/local/src/newlib/newlib-1.19.0.armbuild/arm-thumb-elf/nofmult/newlib/ -isystem /usr/local/src/newlib/newlib-1.19.0.armbuild/arm-thumb-elf/nofmult/newlib/targ-include -isystem /usr/local/src/newlib/newlib-1.19.0/newlib/libc/include -B/usr/local/src/newlib/newlib-1.19.0.armbuild/arm-thumb-elf/nofmult/libgloss/arm -L/usr/local/src/newlib/newlib-1.19.0.armbuild/arm-thumb-elf/nofmult/libgloss/libnosys -L/usr/local/src/newlib/newlib-1.19.0/libgloss/arm -mcpu=arm7 -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../../newlib-1.19.0/newlib/libc/machine/arm -DARM_RDI_MONITOR -fno-builtin -g -O2 -mcpu=arm7 -c -o lib_a-strcpy.o `test -f 'strcpy.c' || echo '../../../../../../../newlib-1.19.0/newlib/libc/machine/arm/'`strcpy.c
/tmp/ccknQoqi.s: Assembler messages:
/tmp/ccknQoqi.s:89: Error: selected processor does not support ARM mode `ldrh r2,[r1],#2'

The "-mcpu=" flag is set to arm7. When I manually run the same line with "-mcpu=arm7tdmi"
the compile is good. It also works if I use "-mcpu=arm9".

assembler message when compiling strcmp

Hi,
If you look at the code you will see that it is a thumb instruction.
Use "-mcpu=arm7tdmi" as a compile option to arm-elf-gcc.
Using "-mcpu=arm9" fixes this too.

I am using gcc-4.5.2, newlib-1.19.0, etc that are all the latest as of this date.

rs

GCC ARM compile from Source

Hi Uwe,

I got the same error 'selected processor does not support `ldrh w2,[wp2]'' . It seams that the
optimized string-functions, in recent newlib-packages do not match all variants of arm,
(see http://sourceware.org/ml/newlib/2009/msg00040.html).

So i took an rather older newlib ( newlib-1.14.0) and the compilation process was successfull (Ubuntu 7.10)...
But it lacks of the variants i expected to get. I nead -mbig-endian, -mcpu=arm7tdmi and Software
FP-Emulation. I found, that the -eabi-work seams to be in progress, but still lacks of the big-endian variant.

I found at http://www.gnuarm.com/support.html#build (it dates from 2006) the hint, that in the script
't-arm-elf' in the GCC-Tree most variants are commented out. This is true even in the most recent
GCC-Source-packages.

I replaced that script and got the libraries i expected - but when i compile a project - it failed with the
statement that the libraries are compiled for FPU (the libraries in the folder
$PREFIX/arm-elf/lib/be/nofmult/ seamed to be compiled with wrong options).

Because the offered binaries at http://www.gnuarm.com/support.html are compiled for 64-Bit Linux,
i had to recompile the source (and still to replace t-arm-elf). I took the versions of binutils, gcc and , newlib which are
linked there and i got all the variants i expected.

I did it the way they mentioned (the first run for gcc with --with-headers=../../newlib-1.14.0/newlib/libc/include).

After the first GCC-compilation the test 'arm-elf-gcc --print-multi-lib' shows all variants wich will
be produced by the newlib-compilation (newlib checks that this way).

I know, thats not the solution for those which nead -meabi and the optimized string-functions, but for me
it works and i hope that this is usefull for others.

don't compiler binutils and gcc ¿Why?

I'm making the same that you say in your scrip but don't compiler and genera a Error mensage I have Ubuntu 9.10

./configure --target=arm-elf --prefix=/home/alejandro/bin/arm-elf --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls

and

elf32-arm.c:2524: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result
elf32-arm.c: In function 'find_arm_glue':
elf32-arm.c:2557: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result
make[4]: *** [elf32-arm.lo] Error 1
make[4]: se sale del directorio `/home/alejandro/ARM/binutils-2.17.90/bfd'
make[3]: *** [all-recursive] Error 1
make[3]: se sale del directorio `/home/alejandro/ARM/binutils-2.17.90/bfd'
make[2]: *** [all] Error 2
make[2]: se sale del directorio `/home/alejandro/ARM/binutils-2.17.90/bfd'
make[1]: *** [all-bfd] Error 2
make[1]: se sale del directorio `/home/alejandro/ARM/binutils-2.17.90'
make: *** [all] Error 2

what is my error??

Solution

Ok, look you are using Ubuntu 9.10 and you have to write that:

#export PATH=$PATH:/home/alejandro/bin/arm-elf/bin

#cd binutils-2.17.90
#./configure --target=arm-elf --prefix=/home/alejandro/bin/arm-elf --enable-interwork --enable-multilib --with-float=soft --disable-werror
#make all install
#cd..

ever you write --disable-werror when configure arm-toolchain Ok
tell me then what happen

alejandro is my name ok /home/my-name/ in your case /home/your-name/ in prefix

Compilation problem in toolchain use

I built the toolchain on Mandriva 2009 for arm-none-eabi targets. When using the toolchain, I see an error indicating "recognized option `-meabi=4' ". On further research, it appears that new arm-none-eabi-gcc is calling the "stock" assember. I notice that other toolchains (such as sourcery) generate an arm-none-eabi-gcc and arm-none-eabi-as. Have I missed something? Any suggestions? Thanks

Hi, please try the latest

Hi, please try the latest summon-arm-toolchain version from git, should be fixed there.

Ubuntu 9.04 32bit compilation

To successfully compile under Ubuntu 9.04 i386:
- install libncurses5-dev
- use --disable-werror, at least for gdb

Thx

the toolchain cannot be created

Hi Uwe,
Please can you help me?
I've tried your script, but I've got some errors at making GDB. I've got something like:

libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../gdb-6.8/bfd -I. -I. -I../../gdb-6.8/bfd -I../../gdb-6.8/bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../gdb-6.8/bfd/elf32-arm.c -o elf32-arm.o
cc1: warnings being treated as errors
In file included from ../../gdb-6.8/bfd/elf32-arm.c:10432:

and then a lot of errors:


./elf32-target.h:683: error: initialization from incompatible pointer type
./elf32-target.h:686: error: initialization from incompatible pointer type
./elf32-target.h:688: error: initialization from incompatible pointer type
./elf32-target.h:691: error: initialization from incompatible pointer type
./elf32-target.h:692: error: initialization from incompatible pointer type
./elf32-target.h:694: error: initialization from incompatible pointer type
./elf32-target.h:695: error: initialization from incompatible pointer type
./elf32-target.h:696: error: initialization from incompatible pointer type
./elf32-target.h:700: error: initialization from incompatible pointer type
./elf32-target.h:702: error: initialization from incompatible pointer type
./elf32-target.h:703: error: initialization from incompatible pointer type
./elf32-target.h:704: error: initialization from incompatible pointer type
./elf32-target.h:706: error: initialization from incompatible pointer type
./elf32-target.h:707: error: initialization from incompatible pointer type
./elf32-target.h:708: error: initialization from incompatible pointer type
./elf32-target.h:709: error: initialization makes integer from pointer without a cast
./elf32-target.h:712: error: initialization from incompatible pointer type
./elf32-target.h:713: error: initialization makes integer from pointer without a cast
./elf32-target.h:714: error: initialization makes pointer from integer without a cast
./elf32-target.h:716: error: initialization from incompatible pointer type
./elf32-target.h:717: error: initialization makes integer from pointer without a cast
./elf32-target.h:718: error: large integer implicitly truncated to unsigned type
./elf32-target.h:731: error: large integer implicitly truncated to unsigned type
./elf32-target.h:736: error: excess elements in struct initializer
./elf32-target.h:736: error: (near initialization for 'elf32_bed')
./elf32-target.h:738: error: excess elements in struct initializer
./elf32-target.h:738: error: (near initialization for 'elf32_bed')
In file included from ../../gdb-6.8/bfd/elf32-arm.c:10497:
./elf32-target.h:683: error: initialization from incompatible pointer type
./elf32-target.h:686: error: initialization from incompatible pointer type
./elf32-target.h:688: error: initialization from incompatible pointer type
./elf32-target.h:691: error: initialization from incompatible pointer type
./elf32-target.h:692: error: initialization from incompatible pointer type
./elf32-target.h:694: error: initialization from incompatible pointer type
./elf32-target.h:695: error: initialization from incompatible pointer type
./elf32-target.h:696: error: initialization from incompatible pointer type
./elf32-target.h:700: error: initialization from incompatible pointer type
./elf32-target.h:702: error: initialization from incompatible pointer type
./elf32-target.h:703: error: initialization from incompatible pointer type
./elf32-target.h:704: error: initialization from incompatible pointer type
./elf32-target.h:706: error: initialization from incompatible pointer type
./elf32-target.h:707: error: initialization from incompatible pointer type
./elf32-target.h:708: error: initialization from incompatible pointer type
./elf32-target.h:709: error: initialization makes integer from pointer without a cast
./elf32-target.h:712: error: initialization from incompatible pointer type
./elf32-target.h:713: error: initialization makes integer from pointer without a cast
./elf32-target.h:714: error: initialization makes pointer from integer without a cast
./elf32-target.h:716: error: initialization from incompatible pointer type
./elf32-target.h:717: error: initialization makes integer from pointer without a cast
./elf32-target.h:718: error: large integer implicitly truncated to unsigned type
./elf32-target.h:731: error: large integer implicitly truncated to unsigned type
./elf32-target.h:736: error: excess elements in struct initializer
./elf32-target.h:736: error: (near initialization for 'elf32_arm_vxworks_bed')
./elf32-target.h:738: error: excess elements in struct initializer
./elf32-target.h:738: error: (near initialization for 'elf32_arm_vxworks_bed')
In file included from ../../gdb-6.8/bfd/elf32-arm.c:10649:
./elf32-target.h:683: error: initialization from incompatible pointer type
./elf32-target.h:686: error: initialization from incompatible pointer type
./elf32-target.h:688: error: initialization from incompatible pointer type
./elf32-target.h:691: error: initialization from incompatible pointer type
./elf32-target.h:692: error: initialization from incompatible pointer type
./elf32-target.h:694: error: initialization from incompatible pointer type
./elf32-target.h:695: error: initialization from incompatible pointer type
./elf32-target.h:696: error: initialization from incompatible pointer type
./elf32-target.h:700: error: initialization from incompatible pointer type
./elf32-target.h:702: error: initialization from incompatible pointer type
./elf32-target.h:703: error: initialization from incompatible pointer type
./elf32-target.h:704: error: initialization from incompatible pointer type
./elf32-target.h:706: error: initialization from incompatible pointer type
./elf32-target.h:707: error: initialization from incompatible pointer type
./elf32-target.h:708: error: initialization from incompatible pointer type
./elf32-target.h:709: error: initialization makes integer from pointer without a cast
./elf32-target.h:712: error: initialization from incompatible pointer type
./elf32-target.h:713: error: initialization makes integer from pointer without a cast
./elf32-target.h:716: error: initialization from incompatible pointer type
./elf32-target.h:717: error: initialization makes integer from pointer without a cast
./elf32-target.h:718: error: large integer implicitly truncated to unsigned type
./elf32-target.h:731: error: large integer implicitly truncated to unsigned type
./elf32-target.h:736: error: excess elements in struct initializer
./elf32-target.h:736: error: (near initialization for 'elf32_arm_symbian_bed')
./elf32-target.h:738: error: excess elements in struct initializer
./elf32-target.h:738: error: (near initialization for 'elf32_arm_symbian_bed')
make[3]: *** [elf32-arm.lo] Error 1
make[3]: Leaving directory `/home/fabrice/build/bfd'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/fabrice/build/bfd'
make[1]: *** [install-bfd] Error 2
make[1]: Leaving directory `/home/fabrice/build'
make: *** [install] Error 2

How can I fix it?

--disable-werror

You can use --disable-werror for gdb and the other components, or use the latest summon-arm-toolchain version from git.

Lack of prebuild ARM packages for Debian

Hi Uwe,

I totally agree with you that it is a shame that there is no prebuild ARM cross-development packages for debian. Ordinary embedded software developer usually is not fluent in configuration and building compilers. I managed to build it myself, but the struggle with correct dependencies was horrible. I hope someone will add that kind of software package to Debian distribution soon.

Regards,
Adam

Script for glibc

Hi Uwe,

I need to build a version with glibc 2.9 instead of newlib. Do you think that just replacing the NEWLIB environment and tar location will do, or this is totally different.

How do I change the script to creats also libraries and libc header files?

Thanks,
Avi.

libgcc

Hmmm... so I was able to get a working compiler this way, but libgcc was apparently built with hardware floating point, which is unfortunate because it contains all of the soft floating point functions, which ld refuses to link to. Is there some way around this?

--with-float=soft

Untested, but I guess you could use an additional --with-float=soft when building the tools. Please let me know if it works for you.

it doesn't work

it doesn't work

It kind of worked - I can

It kind of worked - I can now link against libgcc.a. On the other hand, it appears to have compiled the floating point functions as ARM functions, with interworking, which probably won't work so well on a cortex-m3.