Embedded 版 (精华区)
发信人: he (无情的雨), 信区: Embedded_system
标 题: linux for ppc chapter 14
发信站: 哈工大紫丁香 (2001年06月04日11:07:52 星期一), 站内信件
----------------------------------------------------------------------------
----
14. Floating Point
Some of the embedded PowerPC processors do not have a floating point unit, a
nd so must perform all floating point operations in software. Others do have
a hardware floating point unit, and may perform operations in hardware.
14.1 Software
If your application has very intensive floating point requirements, you may
need to switch to fixed point or choose a target processor which does have a
n FPU.
Floating point can be performed either by instruction emulation in the kerne
l, or by compiling everything with -msoft-float. In particular, it's importa
nt that all the libraries, whether dynamically or statically linked are comp
iled with the same options as the binaries that use them. Unless you're usin
g a toolkit where this has already been done for you, this will generally me
an that if you wish to use -msoft-float to gain maximum performance, you nee
d to (re)compile everything, including:
All static and shared libraries
The compiler's internal libraries, such as libgcc.a
All executables
You will almost certainly not get this right first time. The primary symptom
is that printf gives bogus numbers for simple floating point values.
However, if you succeed, you can save space by configuring the kernel withou
t floating point emulation.
See: http://lists.linuxppc.org/listarcs/linuxppc-embedded/199911/msg00056.ht
ml
To add kernel math emulation to the 2.2.13 kernel, see: http://lists.linuxpp
c.org/listarcs/linuxppc-embedded/199912/msg00017.html
The "paranoia" test should give no complaints if everything is working corre
ctly. See: http://www.enseeiht.fr/NetLib/paranoia/index.html
14.2 Hardware
If your CPU has an FPU, you'll want to use it. Make sure that everything is
consistently compiled for hardware floating point, especially if you've asse
mbled your toolkit yourself, or are using an 8xx toolkit to compile for the
8260.
Programs compiled for hardware floating point can still run on a CPU without
an FPU, provided the kernel is built with the floating point instruction em
ulator. This incurs a further performance penalty on CPUs lacking an FPU.
14.3 Mixed
If you are using a single set of shared libraries, you cannot mix the two te
ries, you cannot mix the two te
chniques in the one system. If you link statically or try really hard by cre
ating two sets of shared libraries, the two can co-exist since programs comp
iled with -msoft-float never generate floating point instructions requiring
kernel emulation.
In general, you're better off choosing one or the other; and choosing hardwa
re floating point with kernel instruction emulation is much easier to get wo
rking correctly.
----------------------------------------------------------------------------
----
--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.235.250]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.818毫秒