2020-11-23 5:48 AM
The __SIZEOF_FLOAT__ and __SIZEOF_DOUBLE__ macros give the same result in both cases.
2020-11-23 1:02 PM
Try to output all preprocessor symbols (macros), see e.g. https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines (which refers to gcc documentation).
Maybe there is some specific __TARGET_FPU_xx or alike.
JW
2020-11-24 3:08 AM
Nice idea. Thank you.
I found a define quite useful:
__SOFTFP__ : is defined if soft FP is selected in configuration
__ARM_FP : is defined and set if hardware FP is selected in configuration
__ARM_FP Set if hardware floating-point is available.
Bits 1-3 indicate the supported floating-point precision levels. The other bits are reserved.
These bits can be bitwise or-ed together. Permitted values include:
On STM32H743:
with FPv5_SP_D16 I get 0x04
with FPv5_D16 I get 0x0E, but the same thing with none...
with softfp __ARM_FP is not defined
Same thing for __GCC_IEC_559 :
0 for FPv5_SP_D16 hard or soft, and soft+none
2 for FPv5_D16 or none hard or soft
But this only means that there is an implementation difference (with regard to the standard) between SP and DP.
2020-11-24 5:51 AM
Well, then the answer to your original question is, "you don't". It *is* an unpleasant but valid answer.
Another, extreme maybe, answer is: gcc is open source, you can make whatever change you wish to it.
That much for academic and impractical answers. I'm sure you know the practical ones already.
JW
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.