[英]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. 我使用的是ARM Cortex-M3和Cortex-M4。 I want to make use of GCC's fixed-point type extension .
我想利用GCC的定点类型扩展 。 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? GCC真的不支持Cortex-M3 / M4的定点类型,或者我在这里遗漏了什么?
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). TL; DR :gcc 嵌入式分支(版本4.6及更高版本)中的ARM Cortex-M / R架构支持定点类型扩展。 A toolchain based on that gcc branch is found here .
此处可找到基于该gcc分支的工具链。
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). 在撰写本文时,summon -arm-toolchain默认下载linaro-gcc-4.5-2011.02(或者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 . 我尝试添加参数
--enable-fixed-point
来configure
,但是我得到了这个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. 我尝试使用更新版本的(linaro-)gcc,但是summon -arm-toolchain在将这个自己提供的gcc补丁应用到这个新版本时遇到了问题。 I also tried using the dev branch of this toolchain (which uses linaro-gcc-4.6-2011.10) without success.
我也试过使用这个工具链的dev分支(使用linaro-gcc-4.6-2011.10)但没有成功。 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.
看起来,在这一点上,ARM Cortex-M / R既不支持linaro-gcc也不支持gcc的主分支定点扩展。
I then tried the gcc-arm-embedded toolchain , which is based on the embedded branch of gcc. 然后我尝试了gcc-arm嵌入式工具链 ,它基于gcc的嵌入式分支。 I was able to compile my fixed-point types sample program without problems, for targets ARM Cortex-M3 and Cortex-M4.
对于目标ARM Cortex-M3和Cortex-M4,我能够毫无问题地编译我的定点类型示例程序。 Support for this extension for Cortex-M/R was added in late 2011, as can be seen on this thread .
2011年底增加了对Cortex-M / R扩展的支持,可以在这个帖子中看到。
According to GCC Wiki , you can enable the fixed point extensions by passing --enable-fixed-point
as a parameter to GCC while configuring it. 根据GCC Wiki ,您可以通过在配置时将
--enable-fixed-point
作为参数传递给GCC来启用固定点扩展。
Further, according to a comment on this gcc bug and this one. 此外,根据对这个gcc bug和这一个的评论。
fixed point support is only currently supported for the MIPS target.
MIPS目标目前仅支持定点支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.