I am using a ARM Cortex-M3, and a Cortex-M4. I want to make use of GCC's fixed-point type extension. I am using the summon-arm-toolchain. The following line of code
_Fract f = 0.1;
throws the following compile error:
error: fixed-point types not supported for this target
Does GCC really not support the fixed-point types for Cortex-M3/M4, or am I missing something here?
Just for the record, I will answer my own question.
TL;DR: fixed-point types extension is supported for the ARM Cortex-M/R architecture in the embedded branch of gcc (version 4.6 and later). A toolchain based on that gcc branch is found here.
Long answer:
At the time of writing, the summon-arm-toolchain downloads by default linaro-gcc-4.5-2011.02 (or alternatively gcc-4.5.2). It does not have enabled by default the fixed-point types extension. I tried adding the parameter --enable-fixed-point
to configure
, but I got the compile error described by this bug. I tried using a more recent version of (linaro-)gcc, but the summon-arm-toolchain had problems applying its own provided gcc patch to this newer version. I also tried using the dev branch of this toolchain (which uses linaro-gcc-4.6-2011.10) without success. It looks like, at this point, fixed-point extension is not supported for ARM Cortex-M/R neither by linaro-gcc, nor the main branch of gcc.
I then tried the gcc-arm-embedded toolchain, which is based on the embedded branch of gcc. I was able to compile my fixed-point types sample program without problems, for targets ARM Cortex-M3 and Cortex-M4. Support for this extension for Cortex-M/R was added in late 2011, as can be seen on this thread.
According to GCC Wiki, you can enable the fixed point extensions by passing --enable-fixed-point
as a parameter to GCC while configuring it.
Further, according to a comment on this gcc bug and this one.
fixed point support is only currently supported for the MIPS target.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With