Build U-Boot with soft floating point - help!

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

Reply to
Dennis C
Loading thread data ...

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

formatting link

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

Reply to
Dan Kegel

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

formatting link

Reply to
Dennis C

Does this help?

formatting link

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

- Dan

Reply to
Dan Kegel

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

Reply to
Dennis C

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 (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
     USE worldnet address!
Reply to
CBFalconer

Try adding

--with-float=soft to the configure line instead of

--nfp, which is only for m68k (according to the gcc manual and

formatting link

- Dan

Reply to
Dan Kegel

TARGET is an arm, not an x86

- Dan

Reply to
Dan Kegel

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

Reply to
Dennis C

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.