I am trying to build an ARM-GCC toochain. I followed the instructions from the gcc.gnu.org site but end up with errors during assembly of lib1funcs.asm. Already the first line produces an error caused by the comment character '@'. So I suspect the wrong assembler is called during the build process. Any clues how to solve this?
My native GCC version on the Linux box is 3.4.6 and I'm trying to build a cross compiler from the 3.2.1 sources.
Although cross-compiling is getting more common with all the embedded platforms available these days, building cross compilers is still a hairy task. Consider using crosstool to do the job for you, hiding all the gory details:
formatting link
Crosstool is a collection of makefiles and patches that will do all the necassery work to build the crosscompiler of choice: downloading the original source packages, applying patches and building the toolchain. There's no black magic involved that you couldn't do yourself, but it might save you some headaches.
Because I cannot find a pre-built 3.2.1 toolchain.
Because I "inherited" the sourcecode of this project and added my own extensions. This code was originally compiled with an older version of GCC and it works with 3.2.1. When I compile it with a more recent version (tried
3.4.3), unexpected things occur. Apparently, there are differences between compiler versions that result in this kind of unexpected behaviour but I don't have the time and budget to go over the existing code and make it work with the most recent version of GCC, although I'd like to.
"Adrian" wrote in message news: snipped-for-privacy@k79g2000hse.googlegroups.com...
The following script is used, which I got from someone who uses this to rebuild his toolchain and is known to work:
#!/bin/sh # Tauno Voipio, 16.1.2003, 3.2.2003, 11.3.2003 # Adapted from: # Jean Tabel 02/14/2001 # snipped-for-privacy@videotron.ca # Adapted from the cross gcc FAQ and other sources # in order to get a working script. # See
formatting link
for # credits. # Jean Tabel 2001/04/22 arm-elf version # Jean Tabel 2001/10/01 one-pass script # Jean Tabel 2002/01/07 gcc 3.0.3, gdb + insight # Jean Tabel 2002/03/31 insight 5.1.1 # Jean Tabel 2002/05/16 insight 5.2, gdb 5.2, gcc 3.1 # newlib 1.10 # Jean Tabel 2002/08/15 gcc 3.2, binutils 2.13 # Jean Tabel 2002/12/24 gcc 3.2.1, binutils 2.13.1 # gdb 5.3, insight 5.3
# binutils rm -rf binutils-$BINUTILS_VER binutils tar zxvf binutils-$BINUTILS_VER.tar.gz mkdir binutils cd binutils ../binutils-$BINUTILS_VER/configure --target=$TARGET --prefix=$PREFIX make all checkinstall cd ..
# gcc/g++ rm -rf gcc-$GCC_VER gcc # testing for full gcc archive if [ -f gcc-$GCC_VER.tar.gz ] then tar zxvf gcc-$GCC_VER.tar.gz elif [ -f gcc-$GCC_VER.tar.bz2 then tar xjvf gcc-$GCC_VER.tar.bz2 else tar zxvf gcc-core-$GCC_VER.tar.gz # tar zxvf gcc-g++-$GCC_VER.tar.gz fi
# extracting newlib - needed for gcc rm -rf newlib-$NEWLIB_VER newlib tar zxvf newlib-$NEWLIB_VER.tar.gz
cd gcc-$GCC_VER ln -s ../newlib-$NEWLIB_VER/newlib newlib ln -s ../newlib-$NEWLIB_VER/libgloss libgloss cd ..
mkdir gcc
cd gcc ../gcc-$GCC_VER/configure --target=$TARGET --enable-languages=c --with-newli b --prefix=$PREFIX --with-gnu-as --with-gnu-ld make all checkinstall cd ..
# newlib mkdir newlib cd newlib ../newlib-$NEWLIB_VER/configure --target=$TARGET --prefix=$PREFIX --nfp make all checkinstall cd ..
I have used the exact same versions of the sources, the only possible difference could be the Linux system where I try to run this on, which has a native RetHat 3.4.6-8 version of GCC installed. I keep getting messages like:
../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm: Assembler messages: ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:1: Error: junk at end of line, first unrecognized character is `@' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:2: Error: junk at end of line, first unrecognized character is `@' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:153: Error: no such instruction: `work .req r4@XXXX is this safe?' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:445: Error: no such instruction: `orrhs result,result,curbit,lsr' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:445: Error: expecting operand after ','; got nothing ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:445: Error: no such instruction: `movnes curbit,curbit,lsr' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:445: Error: no such instruction: `movne divisor,divisor,lsr' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:445: Error: no such instruction: `bne Loop3' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:447: Error: too many memory references for `mov' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:448: Error: too many memory references for `mov' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:452: Error: invalid char '[' beginning operand 2 `[sp' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:452: Error: no such instruction: `bl __div0 (PLT)' ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:452: Error: expecting operand after ','; got nothing ../../gcc-3.3.3/gcc/config/arm/lib1funcs.asm:452: Error: no such instruction: `ldmia sp!,{pc}' make[2]: *** [libgcc/./_udivsi3.o] Error 1 make[2]: Leaving directory `/root/gnu-arm/gcc/gcc' make[1]: *** [stmp-multilib] Error 2 make[1]: Leaving directory `/root/gnu-arm/gcc/gcc' make: *** [all-gcc] Error 2 [root@serv-1 gnu-arm]#
This looks like you aren't actually invoking the ARM assembler since the assembler that you are using complains about perfectly valid ARM opcodes. Are you sure that you have installed the assembler that you've just built in binutils?
For binutils: try "make all install" instead of "make all"
------------------------------------------------------------- You should initially build a bootstrap gcc: ../gcc-$GCC_VER/configure --target=$TARGET --enable-languages=c --with- newlib \
-------------------------------------------------------------- I would recommend to comment the current PREFIX and uncomment PREFIX=/usr/local/arm for clarity
I thought about that too. But I am not sure. The specified target directory (/usr/local/arm) remained empty so I just ran "make install" in the binutils directory and now I get some files in /usr/local/asm. I'll try and build the compiler again now.
Great. Now the error messages are gone, but the process stops with an "internal compiler error"... These are the moments I really start hating free software for commercial jobs...This whole excersise has already cost me more time and money that scheduled for this job.
for a very nice script to build arm-elf-gcc. You can also download the particular version and patches for which the script was written from this site. I have used this script to compile gcc 4.2.0 on FC5.
Why don't you use one of the pre-compiled GCC for ARM ? (Or tell whoever made you into this that the commercial compilers produce better (tighter) code for ARM.)
--
42Bastian
Do not email to bastian42@yahoo.com, it's a spam-only account :-)
Because for some obscure reason, when I compile the code with a more recent version of GCC (3.4.3 for instance), the application behaves strange and when it is compiled with 3.2.1, everything runs ok. But I cannot find a precompiled 3.2.1 version.
I'm afraid it is not an option to switch compiler now. Too much work, too little time.
Since you are looking for older versions, you might find a matching binary on the CodeSourcery website - they have been producing ready-to-run binaries for gcc for ARM and ColdFire for years (they are the official maintainers). Their versions don't necessarily match directly with the official FSF gcc tree, however - for any given version the front and middle ends will pretty much match those of the official gcc tree, while the back end will be significantly ahead (since they are the people improving on the back end, and it takes time for those changes to get fully integrated into the FSF tree).
formatting link
Otherwise, make sure your steps are:
0) Unpack and configure the tarballs
1) Build and install binutils (and make sure it is on your path!)
2) Build the bootstrap compiler
3) Build the library
4) Build the main compiler
(The bootstrap step is apparently not needed for newer gcc versions, but it is certainly part of a 3.2 build.)
My guess is that you haven't got binutils installed properly, or it is not on your path.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.