Hi all, 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. Meindert
Building an ARM-GCC toolchain
Started by ●September 4, 2007
Reply by ●September 4, 20072007-09-04
> 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?The syntax of assembler file are dependent of the assembler. For example, in the GNU assembler comments begin by a ';' and not a '@' -- Guillaume Chevillot
Reply by ●September 4, 20072007-09-04
Meindert Sprang <ms@nojunkcustomorspamware.nl> wrote:> Hi all, > > 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: http://kegel.com/crosstool/ 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. -- :wq ^X^Cy^K^X^C^C^C^C
Reply by ●September 4, 20072007-09-04
"Meindert Sprang" <ms@NOJUNKcustomORSPAMware.nl> wrote in message news:46dd5c2f$0$4461$e4fe514c@dreader28.news.xs4all.nl...> Hi all, > > 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. > > MeindertA couple of questions to satisfy my own curiosity: 1) Why not use a pre-build tool chain? 2) Why not use the latest version of GCC (V4.2.1) - I think the V3.2.1 version is not good for ARM. -- Regards, Richard. + http://www.FreeRTOS.org 13 official architecture ports, 1000 downloads per week. + http://www.SafeRTOS.com Certified by T�V as meeting the requirements for safety related systems.
Reply by ●September 5, 20072007-09-05
"FreeRTOS.org" <noemail@address.com> wrote in message news:aXgDi.8369$c_1.2842@text.news.blueyonder.co.uk...> A couple of questions to satisfy my own curiosity: > > 1) Why not use a pre-build tool chain?Because I cannot find a pre-built 3.2.1 toolchain.> 2) Why not use the latest version of GCC (V4.2.1) - I think the V3.2.1 > version is not good for ARM.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. Meindert
Reply by ●September 5, 20072007-09-05
On Sep 4, 9:19 am, "Meindert Sprang" <m...@NOJUNKcustomORSPAMware.nl> wrote:> Hi all, > > 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. > > MeindertCan you summarize what where your steps? It is hard to answer without knowing what you did. I suspect one step is missing
Reply by ●September 6, 20072007-09-06
"Adrian" <adrianbica@yahoo.com> wrote in message news:1189016361.576512.66130@k79g2000hse.googlegroups.com...> Can you summarize what where your steps? It is hard to answer without > knowing what you did. I suspect one step is missingThe 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 # jtabel@videotron.ca # Adapted from the cross gcc FAQ and other sources # in order to get a working script. # See http://pages.infinit.net/jtabel/ 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 # Defining target #TARGET=powerpc-unknown-eabisim TARGET=arm-elf #TARGET=arm-unknown-elf #TARGET=sparc-unknown-coff #TARGET=mips-unknown-elf #TARGET=m68k-unknown-coff #TARGET=i386-unknown-elf #TARGET=mcore-unknown-elf #TARGET=m68hc11-unknown-elf # Defining prefix - final toolchain location PREFIX=/usr/local #PREFIX=/usr/local/powerpc #PREFIX=/usr/local/arm #PREFIX=/usr/local/sparc-coff #PREFIX=/usr/local/mips-unknown-elf #PREFIX=/usr/local/m68k-coff #PREFIX=/usr/local/i386-unknown-elf #PREFIX=/usr/local/mcore #PREFIX=/usr/local/m68hc11 # PATH must updated PATH=$PREFIX/bin:$PATH # Configuring packages versions GCC_VER=3.3.3 BINUTILS_VER=2.14 NEWLIB_VER=1.12.0 GDB_VER=5.3 INSIGHT_VER=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]# Meindert
Reply by ●September 6, 20072007-09-06
"Guillaume Chevillot" <Guillaume.nospam@chevillot.nospam.net> wrote in message news:slrnfdqt0u.oor.Guillaume.nospam@gaia.chevillot.net...> > I am trying to build an ARM-GCC toochain. I followed the instructionsfrom> > 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 duringthe> > build process. > > Any clues how to solve this? > The syntax of assembler file are dependent of the assembler. > For example, in the GNU assembler comments begin by a ';' and not a > '@'According to the binutils docs, an @ means a comment that extends to the end of the current line. Meindert
Reply by ●September 6, 20072007-09-06
Meindert> ../../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}'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? Andrew
Reply by ●September 6, 20072007-09-06
On Sep 6, 7:29 am, "Meindert Sprang" <m...@NOJUNKcustomORSPAMware.nl> wrote:> "Adrian" <adrianb...@yahoo.com> wrote in message > > news:1189016361.576512.66130@k79g2000hse.googlegroups.com... > > > Can you summarize what where your steps? It is hard to answer without > > knowing what you did. I suspect one step is missing > > 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 > # jta...@videotron.ca > # Adapted from the cross gcc FAQ and other sources > # in order to get a working script. > # Seehttp://pages.infinit.net/jtabel/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 > > # Defining target > > #TARGET=powerpc-unknown-eabisim > TARGET=arm-elf > #TARGET=arm-unknown-elf > #TARGET=sparc-unknown-coff > #TARGET=mips-unknown-elf > #TARGET=m68k-unknown-coff > #TARGET=i386-unknown-elf > #TARGET=mcore-unknown-elf > #TARGET=m68hc11-unknown-elf > > # Defining prefix - final toolchain location > > PREFIX=/usr/local > #PREFIX=/usr/local/powerpc > #PREFIX=/usr/local/arm > #PREFIX=/usr/local/sparc-coff > #PREFIX=/usr/local/mips-unknown-elf > #PREFIX=/usr/local/m68k-coff > #PREFIX=/usr/local/i386-unknown-elf > #PREFIX=/usr/local/mcore > #PREFIX=/usr/local/m68hc11 > > # PATH must updated > PATH=$PREFIX/bin:$PATH > > # Configuring packages versions > GCC_VER=3.3.3 > BINUTILS_VER=2.14 > NEWLIB_VER=1.12.0 > GDB_VER=5.3 > INSIGHT_VER=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]# > > MeindertFor 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 \ --prefix=$PREFIX --with-gnu-as --with-gnu-ld --disable-shared -- without-headers \ --with-local-prefix=${PREFIX}/${TARGET} make all-gcc install-gcc ------------------------------------------------------------- Newlib: again "make all install", configure is OK ------------------------------------------------------------- Then build gcc again: ../gcc-$GCC_VER/configure --target=$TARGET --enable-languages=c --with- newlib \ --prefix=$PREFIX --with-gnu-as --with-gnu-ld --disable-shared \ --with-local-prefix=${PREFIX}/${TARGET} make all install -------------------------------------------------------------- I would recommend to comment the current PREFIX and uncomment PREFIX=/usr/local/arm for clarity