Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make use of the GCC fixed-point types extension on ARM Cortex-M?

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?

like image 665
user1069152 Avatar asked Jun 12 '12 21:06

user1069152


2 Answers

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.

like image 148
user1069152 Avatar answered Nov 15 '22 16:11

user1069152


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.

like image 24
Akhil Avatar answered Nov 15 '22 18:11

Akhil