__fp16 type undefined

Asked by Chris

Hello,

I'm building application for ARM Cortex M4F core with FPU. I'm using GNU C++ ARM compiler, and I need to use half precision float type (__fp16). However whenever I try to declare variable of it's type (or pointer of this type) I get "error: '__fp16' was not declared in this scope". I have global defines __FPU_USED -mfpu=fpv4-sp-d16 -mfloat-abi=hard.
I assume that I need some header file, but for last 2 days I was unable to find any information on the internet what would it be.
What am I doing wrong or what shall I include?

Regards
Chris

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Chris
Solved:
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#1

Hi Chris,

You need to use -mfp16-format to specify which format to use for half floating point type. As the manual explains, the default is none which makes __fp16 type not defined.

Best regards.

Revision history for this message
Chris (axell0) said :
#2

Thank You very much. To be honest I feel extremely stupid right now as I've seen format command numerous timer during last 2 days and I've always taken mistakenly assumed that fpu type "mfpu=fpv4-sp-d16" will automaticaly define it to IEEE format.

Again thank You very much.
Regards
Chris

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#3

Hi Chris,

-mfpu tells the compiler what instructions and register are available (ie how to manipulate __fp16) while -mfp16-format specifies how to represent __fp16 (how many bits of significand and exponent).

Best regards