1
\$\begingroup\$

While trying to use Atmel's ASF library, they say

  • __FPU_PRESENT: Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries

So I guess I need to check the datasheet if my uC, ATSAM4S16C AU has a floating-point unit and if so, define the macro before including the header inside my project.

But I can't figure the datasheet. Section 12.4.6 lists entries like

VADD.F32 | {Sd,} Sn, Sm | Floating-point Add

However, no clock cycles indicated. Searching the document for FPU or F32 yields nothing. Checking the instruction, only ADD is documented, no VADD.32. So I do not know if this is computed in hardware or in software (in libm.a).

How do I know if the SAM4 has an FPU?

\$\endgroup\$
4
  • \$\begingroup\$ Not really sure on this but I think all Cortex-M4 cores have it. But you could probably just try enabling and see if some code involving a fair bit of floating point math actually works. \$\endgroup\$
    – PeterJ
    Feb 3, 2014 at 11:44
  • \$\begingroup\$ No, they don't. It's optional in the M4: infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/… \$\endgroup\$
    – Tom L.
    Feb 3, 2014 at 11:47
  • \$\begingroup\$ @TomL. Thanks I didn't realise that and your answer looks correct. \$\endgroup\$
    – PeterJ
    Feb 3, 2014 at 11:53
  • \$\begingroup\$ Unfortunately the Atmel site doesn't specify FPU as a searchable parameter (which would be nice). \$\endgroup\$
    – Tom L.
    Feb 3, 2014 at 12:39

3 Answers 3

2
\$\begingroup\$

According to this graphic no FPU is available on the SAM4 S family. Yet, the SAM4 X family should have it.

\$\endgroup\$
1
  • \$\begingroup\$ So let's see how much is going to speed up my floating point calculations using ASF's arm_math.a instead of the standard libm.a, on a CPU without FPU. \$\endgroup\$
    – Vorac
    Feb 3, 2014 at 11:54
1
\$\begingroup\$

According to the official device webpage from microchip, there is an FPU available.

Also, the __FPU_PRESENT macro on SAM4SD32C is set. To answer your original question, you can check with this snippet:

#ifndef __FPU_PRESENT
#warning "no FPU!"
#endif
\$\endgroup\$
0
\$\begingroup\$

Here is a list of Atmel SAM4 MCUs, some of which have an FPU. You want a Cortex-M4F architecture, not a Cortex-M4. The SAM4S does not have an FPU.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.