Any reason why Studio Defaults to M7 Single-Precision Library when SAM E/V have SP & DP?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looking through some documentation the Atmel Cortex M7's seem to all have SP & DP hardware as the FPU variant. However, AS 7 projects default to using the Single Precision library - is there any advantage to this? I realize that if you aren't doing DP calculations it probably doesn't matter, but if you are what limitations does that create (other than doing DP in software instead of hardware?)? Is it a power consumption issue? Compacted code? I'm just not sure I understand why they would default to SP when the chip has a hardware DP and what the implications between using library over the other has.

 

It's not like the DP can do SIMD for floating point if you only use SP... although that would be pretty awesome.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Atmel use an open source compiler. I'd suggest the reason might be there are no libraries for the fpu with dp.

Just did a bit of a Google - you might have to specify the fpu to the compiler.
-mfpu = fpv5-d16
At a guess......

Last Edited: Thu. Oct 13, 2016 - 07:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

-mfpu=fpv5-sp-d16 is already a flag. 

-mfloat-abi=softfp ---> This is really another question : According to ARM GCC 

 

What is the difference between soft-float calling (ab-softfp) conventions and FPU-specific calling conventions (abi-hard)? I found this under the obscure atmel-disclaimer file : 

 * The library file thirdparty/CMSIS/Lib/GCC/libarm_cortexM4lf_math_softfp.a was generated by ATMEL, which
 * is support -mfloat-abi=softfp compiler flag, and this is also the default selection for device that
 * have FPU module and enabled.
 * If customer want to use -mfloat-abi=hard compiler flag, the project compile/link flag and link library
 * should be manual modified. The library thirdparty/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a is used for
 * -mfloat-abi=hard configration.

I realize I can change the ABI flag, but I'm not clear on what the advantage of one "configration" is over the other.

 

ARM also has two additional little endian libraries on their site...

  • arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
  • arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)

 

Am I losing out on optimal performance by not using one of these instead? I can't imagine GCC isn't going to support linking with them, there has to be a reason why they exist...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Found an answer on the hard / soft question : essentially if using M4 and M7 with same binary this is the difference on abi-softfp/hard

 

3.1.2 Compiler Configuration

User has to make sure FPU instructions will be used when compiling the application code and configure the compiler accordingly.

For ARM GCC compiler the following flags need to be added:

 -mfloat-abi=hard or softfp

softfp: to be used only if the user intends to use same binary on Cortex-M4F and CortexM7F based product

hard: in any other case

 -mfpu=fpv5-sp-d16 or fpv5-d16

fpv5-sp-d16 is for single precision

fpv5-d16 is for double precision

In Atmel Studio, those flags are added in Project Properties menu > Toolchain tab > ARM/GNU C Compiler menu > Miscellaneous

 

Still curious about the math... and why they put an app note up that doesn't contain any form of download link for the project that goes with it...