Rebuilding a Atmel studio 7 solution using -mfloat-abi=hard

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

I am trying to rebuild my solution using the "-mfloat-abi=hard" compile option in an effort to speed my FPU performance on my SAMD51.

 

However, I have linked files that were compiled with the default "-mfloat-abi=softfp" option.  Because of this, I can;t compile using the new =hard FPU option.

 

Is there an easy way to recompile all linked files with "-mfloat-abi=hard"?

 

-Troy

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

To be clear, I am getting, for example:

 

Severity    Code    Description    Project    File    Line    Source
Error        hpl/ramecc/hpl_ramecc.o uses VFP register arguments, metro1.elf does not    metro1    c:/program files (x86)/atmel/studio/7.0/toolchain/arm/arm-gnu-toolchain/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe    0    Build
 

How can I rebuild all of my libraries like hpl_ramecc.o so they use Hard floating point?

 

-troy

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

Have you tried doing a full rebuild?

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

Yes, tried numerous clean and rebuild compiles.

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

I have the same problem. Did you manage to solve it?

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

No, let me try opening a Microchip support ticket to see if they can help us.

 

-troy

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

Dear Troy,

 

any answer from the Microchip support yet how to set the compiler and linker flags to make sure the hardware FPU is used?

 

Best Regards

Markus

Last Edited: Sun. Nov 17, 2019 - 09:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am still working on getting it working, but here are the 2 emails I received from Atmel support.  I am still working on getting arm_math.h added.  Maybe we can both hack away at this?  The first support response had errors, notice the corrections on the second response:

 

FIRST RESPONSE:

--------------------------------------------------------------------------------------------
Comment by : Sathyanarayanan A 11/15/2019 15:33:59 GMT
--------------------------------------------------------------------------------------------

Hi Troy,

 

Thanks for contacting Microchip.

 

Changing from softfp option to hard FP option requires some modifications in toolchain settings. Follow the following steps to resolve the issue:

 

1) Add “-mfloat-abi=hard -mfpu=fpv5-sp-d16” (for single precision) or “-mfloat-abi=hard -mfpu=fpv5-d16” (for double precision) flag in “Project Properties -> Toolchain -> ARM/GNU C Compiler -> Miscellaneous -> Other flags”.

 

2) Add ‘ARM_MATH_CM7=true’ in "Project Properties -> Toolchain -> ARM/GNU C Compiler -> Symbols -> Defined symbols (-D)".

 

3) Remove "__SOFT-FP__" from "Project Properties -> Toolchain -> ARM/GNU C Compiler -> Symbols -> Defined symbols (-D)".

 

4) Include <arm_math.h> file in the main.

 

5) Enable FPU unit in main using "fpu_enable();".

 

6) Change the CMSIS library from "libarm_cortexM7lfsp_math_softfp" to "libarm_cortexM7lfsp_math" from "Project Properties -> Toolchain -> ARM/GNU Linker->Libraries->Libraries(-I).

 

Kindly let us know if this resolves the issue.

 

Warm regards,

Sathyanarayanan.

 

 

 

 

 

SECOND RESPONSE:

 

Hello Troy,

Microchip Technical Support has added a comment on case 00476987.


Case Link: https://microchipsupport.force.com/s/case/5003l00000y11SN


Latest Comment:

Hi Troy,

 

I Apologize for not noticing it's a M4 device.

 

-> In SAMDx/Ex(M4) devices only single precision FPU is available and the flag to be added in GNU compiler is "-mfloat-abi=hard -mfpu=fpv4-sp-d16" not "fpv5".

 

-> Add the same flag in "Project Properties -> Toolchain -> ARM/GNU C Linker -> Miscellaneous -> Other flags".

 

->Add "ARM_MATH_CM4" instead of "ARM_MATH_CM7" in symbols and also add "__FPU_PRESENT=1" in the symbols.

 

->The Atmel start didn't include arm_math.h file by default. So, kindly download standalone ASF4 framework and add arm_math.h header present inside \xdk-asf-3.47.0\thirdparty\CMSIS\Include by right clicking your project name and clicking "add existing item" .

 

-> libarm_cortexM4f_math.a library found in \xdk-asf-3.47.0\thirdparty\CMSIS\lib\GCC should be added by right clicking your project name and clicking "add library".

 

The standalone ASF4 can be downloaded from the following link:

https://www.microchip.com/mplab/avr-support/advanced-software-framework

 

-> Include <arm_math.h> header in your main.c file, Rebuild the project.

 

Hope this resolves your FPU issues.

 

Warm regards,

Sathyanarayanan.

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

The one thing I can't figure out is what #include I need for the "fpu_enable()"