EmbeddedRelated.com
Forums

Crosscompiling for ARM926EJ-s device with hardware float operations support

Started by dannychris37 4 years ago4 replieslatest reply 4 years ago999 views

I need to cross compile c++ code for an embedded device with the specs shown below with hardware float operations support. Cross compiling from Ubuntu 20.04 without hardware float support is easy, i can just run arm-linux-gnueabi-g++ -marm -mcpu=arm926ej-s -mfloat-abi=soft -mfpu=vfp and it will work. When running with -mfloat-abi=hard I get:

/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: error: ArmSimulateStartStop uses VFP register arguments, /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtbegin.o does not
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtbegin.o
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: error: ArmSimulateStartStop uses VFP register arguments, /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtend.o does not
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtend.o
collect2: error: ld returned 1 exit status
make: *** [Makefile:12: CrossCompile] Error 1

I know this processor supports hardware float support, it says in the arm documentation. I downloaded buildroot and crosstool but I don't know how to configure them right for my device hardware. How can I cross compile with VFP support?

Device specs:

~ $ cat /proc/cpuinfo 
Processor       : ARM926EJ-S rev 5 (v5l) 
BogoMIPS        : 197.83 
Features        : swp half thumb fastmult edsp java 
CPU implementer : 0x41 
CPU architecture: 5TEJ 
CPU variant     : 0x0 
CPU part        : 0x926 
CPU revision    : 5

~ $ cat /proc/version 
Linux version 2.6.36 (owzafs@PCOWZAFS) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #464 PREEMPT Thu Apr 19 13:50:56 CEST 2018 

Question on SE: https://unix.stackexchange.com/questions/592905/crosscompiling-for-arm926ej-s-device-with-hardware-float-operations-support

[ - ]
Reply by waydanJune 15, 2020

Could it be related to your target triple? I see you have arm-linux-gnueabi, but I think there’s another version specifically for hardware floating point: arm-linux-gnueabihf. I’m not experience with Ubuntu, but my search did turn up a g++ package that looks promising.

https://packages.ubuntu.com/search?keywords=g%2B%2B-arm-linux-gnueabihf

Cheers,


[ - ]
Reply by dannychris37June 15, 2020

g+-arm-linux-gnueabihf is for armv7 and up. See here and here. The one in the question is armv5(tej).

[ - ]
Reply by BVRameshJune 15, 2020

Looks like the objects crtbegin.o and crtend.o doens not match with the main line build. I feel that the best method is to recompile crtbegin.s and crtend.s need to be recompiled with the same setting -mfloat-abi=hard, create the seperate crtbegin.o and crtend.o and retry.


BV Ramesh.


[ - ]
Reply by VadimBJune 15, 2020
Have a look at gcc-arm-none-eabi.

I've got the following V5TE-related files:


~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/hard/crtn.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/hard/crtfastmath.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/hard/crtend.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/hard/crti.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/hard/crtbegin.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/softfp/crtn.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/softfp/crtfastmath.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/softfp/crtend.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/softfp/crti.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/arm/v5te/softfp/crtbegin.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/arm/v5te/hard/crt0.o
~/bin/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/arm/v5te/softfp/crt0.o


EDIT: The following command worked for me:

arm-none-eabi-gcc -marm -mcpu=arm926ej-s -mfloat-abi=hard -mfpu=vfp -lc -specs=nosys.specs -Wl,-Map=arm926ej.map arm926ej.c


Hope this helps.