FPU CFLAGS for ARM1176


4 posts
by cnxsoft » Fri Jan 27, 2012 3:05 pm
I'm compiling some program where I would like to enable the FPU.

I'm now trying the program in qemu with ARM1176. I'm using Emdebian toolchain, but I guess the flags should be the same for all cross-compilers.

In the emulator if I use:

CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=softfp"

The program will exit with "illegal instruction". Even a simple "hello world" type program accessing to float will crash.

if i use CFLAGS="-march=armv6 -mfpu=vfp"

It will work.

Which cflags should I use to make use of the FPU in Broadcom BCM2835 ?
User avatar
Posts: 190
Joined: Sat Oct 15, 2011 2:33 pm
Location: Chiang Mai, Thailand
by jamesh » Fri Jan 27, 2012 3:47 pm
cnxsoft said:


I"m compiling some program where I would like to enable the FPU.

I"m now trying the program in qemu with ARM1176. I"m using Emdebian toolchain, but I guess the flags should be the same for all cross-compilers.

In the emulator if I use:

CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=softfp"

The program will exit with "illegal instruction". Even a simple "hello world" type program accessing to float will crash.

if i use CFLAGS="-march=armv6 -mfpu=vfp"

It will work.

Which cflags should I use to make use of the FPU in Broadcom BCM2835 ?


I think the performance section in the Wiki has the settings I used on the Alpha boards.
Volunteer at the Raspberry Pi Foundation, helper at Picademy September and October 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12154
Joined: Sat Jul 30, 2011 7:41 pm
by cnxsoft » Sat Jan 28, 2012 1:14 am
I could not it in the Wiki (which has changed a lot recently), but I found a forum post.  (floating point search provides better results than fpu...)

http://www.raspberrypi.org/for.....erformance

You used:

gcc -O3 -mfloat-abi=softfp

I'm also interested in hardfloat, because have seen some impressive benchmarks on pandaboard (gzip 5 to 6 times faster with hardfloat vs softfloat).

In the same forum post, it seems Redhat might do a "Fedora armv6hl build" which would be great.
User avatar
Posts: 190
Joined: Sat Oct 15, 2011 2:33 pm
Location: Chiang Mai, Thailand
by Metzelmaennchen » Mon Jul 02, 2012 7:24 pm
has anyone found a solution in the meantime?

Code: Select all
int main()
{
  float f;
  f = 1.0;    // illegal instruction here
  return 0;
}


as soon as I specify float abi to softfp I get the illegal instructions. Something with alignment but I don't get it :(
Using memcpy it works and it also works when using a packed struct to copy to the float. But to be honest, can someone tell me why the float isn't aligned correctly?
Posts: 1
Joined: Sun Jun 24, 2012 11:34 pm