ATSAME54P20A--Hardwware FPU use?

作者 gavin0130 於 2020年01月15日 10:02:57
在『MPLAB XC32 C/C++ Compiler User’s Guide for PIC32C/SAM MCUs』
For the Cortex-M based devices, such as the MEC17, CEC17, and SAM families, XC32
defaults to using the hardware Floating-Point Unit (FPU) where available. For cases
where want a specific FPU calling convention, you can specify the following
command-line options to the xc32-gcc compilation driver at both compile and link time:
• -mfloat-abi=soft -- Specifying 'soft' causes XC32 to generate output containing
library calls for floating-point operations. This setting is the default for devices that
do not feature a hardware FPU.
• -mfloat-abi=softfp -- Specifying 'softfp' allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions
• -mfloat-abi=hard -- Specifying 'hard' allows generation of floating-point instructions and uses FPU-specific calling conventions. This setting is the default for
devices that feature a hardware FPU.
由這段內容得知ATSAME54P20A已有hardwware FPU ,所以是否就不需要經由設定『XC32-gcc』的『General』,就可以進行單精度福點數運算?

請問使用以下方式是否就可以確定已正在使用ATSAME54P20A的hardwware FPU進行浮點數運算,或者有其他更好的方式可以證明?

float a = 0;
float b = 3;
double x = 0;
double y = 3;

int main(void)
x = 125 / y;
a = 125 / b;
printf("double value X = %10f\r\n",x);
printf("floating value a = %10f\r\n",a);

double value X = 41.666667

floating value a = 41.666668

另外,是否需要include 『float.h』?