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

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

[复制链接]
stm32f103vc 发布时间:2014-4-21 16:48
在使用M4的FPU的时候,需要注意不要用mdk的微库。这是因为M4的FPU是符合IEEE754标准的浮点运算单元。微库是不兼容IEEE754浮点表示的标准的。微库是MDK提供的一个库,对C标准库进行了深度优化,用微库得到的代码会更小,并且也会带来一些问题,下面是微库和标准库之间的主要差异:8 {  R1 K& K/ g( Q# b/ Z# ~  ~* k- S
Microlib is not compliant with the ISO C library standard. Some ISO features are not supported and others have less functionality.7 O. g% \3 x# m& X( B1 Z( @
 : m! f; W# t8 ~. A8 E+ |9 T! B2 o& D+ N
Microlib is not compliant with the IEEE 754 standard for binary floating-point arithmetic.! ?6 ^8 w% I: v
 
6 q5 \- }0 z: i$ r) ~Microlib is highly optimized for small code size., H6 u* E/ M, \* H5 W
 4 B; ~3 q/ H' C5 p6 h: W- z$ s
Locales are not configurable. The default C locale is the only one available.. w4 W! T/ b6 v1 ^
 ( t! K0 ]; v, S; e& Q' R0 {$ \
main() must not be declared to take arguments and must not return.
- k# _' D; }2 _8 ^. o 0 \& z$ y" ?. X/ t1 J8 g& _: {
Microlib provides limited support for C99 functions.
" o9 L! F" {2 f 
/ H5 ~; M( z1 K3 ^. yMicrolib does not support C++.
4 `* R) q) e5 K. S, W6 y 8 A% _8 R8 B2 E; x8 m, f% [2 S
Microlib does not support operating system functions.
. i( R4 |, }. R7 k7 l: ]  H8 G5 | 
9 u0 ^0 y3 g* I' I8 w" r. h7 z1 dMicrolib does not support position-independent code.
  h8 s8 S* u5 _+ @! ~ 8 ?. h/ Z1 f: Z+ C0 F
Microlib does not provide mutex locks to guard against code that is not thread safe.
7 |4 x3 _$ ?0 _8 o   Y4 J/ }/ c7 x
Microlib does not support wide characters or multibyte strings.
. u" B# t3 l* _ 
3 W. |7 F( k! I: o% G" ^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., R# g. A# c" ?( F
 
# I: `& W2 X3 I0 p  d) c: }* _Microlib does not support the bit-aligned memory functions _membitcpy[b|h|w][b|l]() and membitmove[b|h|w][b|l]().; A/ Z. T: y' A6 `% A
 
  Y2 \* p" f& d+ ^" T* ~8 i1 D; AMicrolib can be used with either --fpmode=std or --fpmode=fast.1 Q% y$ d4 \9 t7 q. ~5 B3 K4 R; D# j
 
" ]& y; W1 k: O8 DThe level of ANSI C stdio support that is provided can be controlled with #pragma import(__use_full_stdio).8 x* W) P  s$ b5 t! ]
 
) y$ K0 y& e* H( H#pragma import(__use_smaller_memcpy) selects a smaller, but slower, version of memcpy().
$ l9 R: u+ K+ b( x& c+ R7 p4 M , I( E5 k6 o5 J+ y+ \' X. K
setvbuf() and setbuf() always fail because all streams are unbuffered.7 p/ k1 Y3 X# h+ j# q5 f: _5 k, O
 ; b  Z  W" d( K
feof() and ferror() always return 0 because the error and EOF indicators are not supported.
  ?) o' S/ i9 Y0 Y, f7 {% e& W : h/ e- b/ U/ ~& R7 e) e) Z) [
差异中需要注意的有,微库不兼容IEEE754,不支持c++,不支持流缓冲,不支持操作系统函数(移植的操作系统还是支持的,不过我还是不推荐),不提供互斥锁来防止非线程安全的代码,memcpy函数会变慢,不支持宽字符。所以再有以上应用的时候,尽量不要用微库。
" }7 {: Z: n4 |# b1 ]1 h- B 
收藏 评论0 发布时间:2014-4-21 16:48

举报

0个回答

所属标签

相似分享

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版