Build U-Boot with soft floating point - help!

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I am building U-Boot for my embedded ARM9 target. The build is done
using Linux Redhat 9 running on a PC.

When I installed my GNU C compiler, I did:
../gcc-$GCC_VER/configure --target=$TARGET --with-newlib
--prefix=$PREFIX --with-gnu-as --with-gnu-ld --nfp
make all
make install

I want the compiler to generate floating point library calls instead
of using the hardware FP.

I get this error at the end of the U-Boot link:

        arm-unknown-elf-ld -Bstatic -T
/home/dchou/atmel/u-boot-1.0.0/board/at91rm9200dk/u-boot.lds -Ttext
0x21f00000  $UNDEF_SYM cpu/at91rm9200/start.o \
                --start-group board/at91rm9200dk/libat91rm9200dk.a
cpu/at91rm9200/libat91rm9200.a lib_arm/libarm.a fs/jffs2/libjffs2.a
fs/fdos/libfdos.a fs/fat/libfat.a net/libnet.a disk/libdisk.a
rtc/librtc.a dtt/libdtt.a drivers/libdrivers.a
drivers/sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a
common/libcommon.a lib_generic/libgeneric.a -L
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2 -lgcc --end-group \
                -Map u-boot.map -o u-boot
arm-unknown-elf-ld: ERROR:
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/libgcc.a(_udivsi3.o)
uses hardware FP, whereas u-boot uses software FP
File in wrong format: failed to merge target specific data of file
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/libgcc.a(_udivsi3.o)
arm-unknown-elf-ld: ERROR:
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/libgcc.a(_umodsi3.o)
uses hardware FP, whereas u-boot uses software FP
File in wrong format: failed to merge target specific data of file
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/libgcc.a(_umodsi3.o)
arm-unknown-elf-ld: ERROR:
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/libgcc.a(_dvmd_tls.o)
uses hardware FP, whereas u-boot uses software FP
File in wrong format: failed to merge target specific data of file
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/libgcc.a(_dvmd_tls.o)
make: *** [u-boot] Error 1

Help!
Dennis

Re: Build U-Boot with soft floating point - help!
Quoted text here. Click to load it

I seem to recall Robert Schwebel ran into this and posted
something about it.  Ah, yes, here it is:

http://kegel.com/crosstool/current/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch

That's the usual softfloat patch for recent gcc
plus a hunk or two Robert added to solve the
problem you're facing, I think.  Let us know whether
that helps.
- Dan

Re: Build U-Boot with soft floating point - help!
Dan:

Thanks for the tip. The patch was what I was looking for.

However I am new to linux, so how do I apply the patch? Can you
provide line by line instruction on how I can apply this patch?

Thanks a mil!
Dennis

Quoted text here. Click to load it
http://kegel.com/crosstool/current/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch
Quoted text here. Click to load it

Re: Build U-Boot with soft floating point - help!
Quoted text here. Click to load it

Does this help?

http://kegel.com/academy/opensource.html#patches.using

If not, post the steps you used to build your gcc, and we'll
show you where to apply the patch.
- Dan

Re: Build U-Boot with soft floating point - help!
Dan:

Thanks for your help. I have successfully patched the GNC GCC and
completely rebuilt it. However I am still getting the linker error
regarding the clash between HW and SW floating point.

This is how I am configuring my GCC and GLIB:

cd gcc
../gcc-$GCC_VER/configure --target=$TARGET --with-newlib
--prefix=$PREFIX --with-gnu-as --with-gnu-ld --nfp
make all
make install
cd ..

# newlib
mkdir newlib
cd newlib
../newlib-$NEWLIB_VER/configure --target=$TARGET --prefix=$PREFIX
--nfp
make all
make install
cd ..

And these are my C flags when I compile the UBoot code:

arm-unknown-elf-gcc -g  -Os   -fno-strict-aliasing  -fno-common
-ffixed-r8 -mshort-load-bytes -msoft-float -D__KERNEL__
-DTEXT_BASE=0x21f00000 -I/home/dchou/atmel/u-boot-1.0.0/include
-fno-builtin -ffreestanding -nostdinc -isystem
/usr/local/arm/lib/gcc-lib/arm-unknown-elf/3.3.2/include -pipe
-DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv4 -mtune=arm7tdmi -Wall
-Wstrict-prototypes -c -o string.o string.c

I think I have done everything to tell it to use soft floating point.
Am I still missing something?

Thanks
Dennis

Quoted text here. Click to load it
>>http://kegel.com/crosstool/current/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch
Quoted text here. Click to load it

Re: Build U-Boot with soft floating point - help!
Quoted text here. Click to load it

I have no real idea of your problem, but it occurs to me that if
the $TARGET specifies a 486 or higher cpu, floating point is
built-in, and there is no reason to link to external fp routines.

--
Chuck F ( snipped-for-privacy@yahoo.com) ( snipped-for-privacy@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
We've slightly trimmed the long signature. Click to see the full one.
Re: Build U-Boot with soft floating point - help!
Quoted text here. Click to load it

TARGET is an arm, not an x86
- Dan


Re: Build U-Boot with soft floating point - help!
Quoted text here. Click to load it

Try adding
--with-float=soft
to the configure line instead of
--nfp, which is only for m68k (according to the gcc manual
and http://gcc.gnu.org/ml/gcc-bugs/2004-01/msg01850.html )

- Dan

Re: Build U-Boot with soft floating point - help!
Dan:

I tried it as you suggested but still I get the same error. I have
worked around the problem by excluding the libgcc.a in the final link.
I was fortunate in that the code that I was building was completely
self contained, including its soft floating point assembly code. So I
was able to exclude the libgcc.a without causing a mess.
Any other ideas?

By the way, I am using newlib 1.12.0 for GCC:

# 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

I built newlib using the -with-float=soft flag as well.

Could this be a problem?

Thanks
Dennis



Quoted text here. Click to load it

Site Timeline