Enable NEON on Cortex A8 with fpu set to either SoftVFP or none

1.1k views Asked by At

I am trying to build an executable for Cortex A8 using RVDS 4.0. My code uses NEON but I want to set fpu option to either none or SoftVFP. The ARM website mentions that NEON is disabled when fpu is set to SoftVFP. Is this because VFP and NEON share registers?

Can some one please explain why I can not use NEON when fpu is set to SoftVFP or if there is any option through which I can enable NEON even when fpu is set to SOftVFP?

Thanks

2

There are 2 answers

0
rsaxvc On

Yes, the NEON and VFP registers are shared. This simplifies operating system context-switching support, since any OS aware of VFP will handle NEON correctly too.

It is unsafe to link code built for softVFP with code built for hardware VFP, because they place function arguments/results in different registers - using NEON is a lot like using hardware VFP where this is concerned.

There is a special case though, when you have to link against SoftVFP libraries, but you happen to know your SoC supports it(Do you know this? There are plenty of A8's without NEON). The special case is called softvfp+. The way this works is that function arguments are passed in integer registers, but inside of functions the compiler can use the FPU, or you can use NEON. For ARM's compiler targeting a CortexA8 with NEON, you'd want to use "--fpu=softvfp+vfpv3"

See this for some options for ARM's compiler related to this. Many other compilers have similar switches.

For ARM's RVCT3.x and above compilers, you'll want(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/CIHCJIFE.html):

softvfp+vfpv3

Selects a hardware vector floating-point unit conforming to VFPv3, with software floating-point linkage. Select this option if you are interworking Thumb code with ARM code on a system that implements a VFPv3 unit.

For GCC, you'll want "-mfloat-abi=softfp", and I think "-mfpu=‘neon’". From the GCC manual(http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html):

-mfloat-abi=name

Specifies which floating-point ABI to use. Permissible values are: ‘soft’, ‘softfp’ and ‘hard’. Specifying ‘soft’ causes GCC to generate output containing library calls for floating-point operations. ‘softfp’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions. ‘hard’ allows generation of floating-point instructions and uses FPU-specific calling conventions.

The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries.

1
pmeerw On

why not just use --cpu=7-A ? that should imply the currect --fpu option

softvfp is an emulation library, I guess NEON is simply not implemented