你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【MCU 实战经验】使用FPU时,不要用微库

[复制链接]
stm32f103vc 发布时间:2014-4-21 16:48
在使用M4的FPU的时候,需要注意不要用mdk的微库。这是因为M4的FPU是符合IEEE754标准的浮点运算单元。微库是不兼容IEEE754浮点表示的标准的。微库是MDK提供的一个库,对C标准库进行了深度优化,用微库得到的代码会更小,并且也会带来一些问题,下面是微库和标准库之间的主要差异:
4 _+ Q: Q3 H2 i4 s' QMicrolib is not compliant with the ISO C library standard. Some ISO features are not supported and others have less functionality.
0 o% r8 T0 F7 @( H. @ 
: O# j- C" B1 \6 z' [4 Q. v" bMicrolib is not compliant with the IEEE 754 standard for binary floating-point arithmetic.
6 O+ Z# O. t) A& u1 \ 2 m4 g0 m; _9 j8 v9 U( O
Microlib is highly optimized for small code size.
% O3 A2 R# R* F3 v9 w 
: b8 ?2 ?; E/ ~- F. K8 d7 vLocales are not configurable. The default C locale is the only one available.
7 h& k# a+ `1 a6 I 1 L+ p% D& P6 k' k- S: p; e4 |
main() must not be declared to take arguments and must not return.
# a. r) M2 f% K) P$ D) ]0 M2 V ; ^# o" }& C) A: @  `+ R3 X" S
Microlib provides limited support for C99 functions.
" T+ ~( D  R* c. W" g 
* V1 |; R4 b( c* HMicrolib does not support C++.
# }6 Z/ L( l1 ]/ w. h" u6 [* ~  B * v; I; f3 v9 c9 v9 P
Microlib does not support operating system functions.- ?5 D8 k( D2 W3 H1 e1 i. Z
 
5 `% |$ X$ t3 hMicrolib does not support position-independent code.
: d$ m3 G# d9 R$ Y- |1 c$ u, i 
  [9 b  Q: `$ K0 e3 {Microlib does not provide mutex locks to guard against code that is not thread safe.
, I' h/ B* m9 A7 l8 r% e 
. Z& b% |1 m* c. |+ d+ U. @Microlib does not support wide characters or multibyte strings.$ m: _, b; B' B* ?- C6 r
 ( ^7 a6 D- E' Z7 S! Q9 I! ]
Microlib does not support selectable one or two region memory models as the standard library (stdlib) does. Microlib provides only the two region memory model with separate stack and heap regions.
0 s7 @6 A3 o/ c 
* F9 o4 }+ _, m7 u5 h1 aMicrolib does not support the bit-aligned memory functions _membitcpy[b|h|w][b|l]() and membitmove[b|h|w][b|l]().& Z* {1 a6 z7 }
 
6 ^8 j# f8 c5 u( @6 H2 k! aMicrolib can be used with either --fpmode=std or --fpmode=fast.
; {" Y, c+ Z9 p$ y' N) y( N 2 S. T2 `. S" I0 a
The level of ANSI C stdio support that is provided can be controlled with #pragma import(__use_full_stdio).
! Y+ y# t" e, N2 \$ s , x  @5 [% d( ~! e9 n
#pragma import(__use_smaller_memcpy) selects a smaller, but slower, version of memcpy().
7 u; O, u+ |. h) T0 _ + U2 r+ U: I% {; [
setvbuf() and setbuf() always fail because all streams are unbuffered.3 j- n* X2 G5 B4 p$ P# U0 m
 8 r  p6 d0 d. ^
feof() and ferror() always return 0 because the error and EOF indicators are not supported.
7 z* S6 A* j. q- e4 _$ E* S 
8 ~. N+ f: u9 I9 X' G* R) c2 Y差异中需要注意的有,微库不兼容IEEE754,不支持c++,不支持流缓冲,不支持操作系统函数(移植的操作系统还是支持的,不过我还是不推荐),不提供互斥锁来防止非线程安全的代码,memcpy函数会变慢,不支持宽字符。所以再有以上应用的时候,尽量不要用微库。
( r; R" ]5 p- G' M% w/ Q( I# {7 ] 
赞 收藏 评论0 发布时间:2014-4-21 16:48

举报

0个回答
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版