Linux mobile phone DIY. Library File topic. Floating Point issue of cross-Compilation

Source: Internet
Author: User

Linux mobile phone DIY. Library File topic. Floating Point issue of cross-Compilation

Grass papaya in--9

I. Sequencing

The floating point issue in the Cross-compilation process is daunting. The compatibility of GCC versions varies greatly, and the patch effect varies greatly. This causes a lot of trouble in constructing the e600 compilation environment different from the e680. Here I will describe the process of trying it for your reference. After all, there is little Chinese information.

Ii. Important Notes

To facilitate a better understanding of this article, we provide the following link.
Full range of articles address, mobile phone application development column: http://blog.csdn.net/liwei_cmg
Related important outcome: http://play.younet.com/view.php? Tid = 24045

Iii. Origin of Floating Point Problems

The Moto e680 series, xiaxin e600, Philips 968, and other mobile phones all use inter XScale
The Instruction Set is armv5tel.

E680g version information
Linux (none) 2.4.20 _ mvlcee30-mainstone #1 Jan armv5tel unknown
E600 version information
Linux c8k 2.4.19-rmk7-pxa2 #1 Thu Mar 23 17:56:36 CST 2006 armv5tel unknown
Version 968
Linux c8k 2.4.19-rmk7-pxa2 #1 Fri Dec 9 16:42:58 CST 2005 armv5tel unknown

Inter XScale is compatible with the armv5te ISA instruction set,
However, the floating point instruction set is not supported. This is to save the processor chip size and reduce the power consumption, XScale
The architecture does not implement expensive floating point computation components and division components. These are not commonly used in embedded applications.
. When this type of operation is required, it must be implemented through software.
Floating-point operations are much more complex than integer operations. What is the problem if there are no floating-point operation units?

Let's look at an example:
The e680, e680i, and e680g CPUs are ARM Series Intel XScale pax270. There are two types of MP3 decoding:
One is based on floating-point operations (such as mpg123), and the other is based on integers, that is, libmad (mPEG
Audio decoder library ). Floating Point decoding. The single-precision floating point decimal point can be precise to 45 digits after the decimal point,
However, the CPU must have FPU units. Due to limitations of the e680 series, only soft floating points can be used, while libmad
Fixed-integer, which is calculated using an integer to simulate decimal places. The precision can only be retained to 9th digits after the decimal point (greater
The minimum value of 0 is 0.00000000372529 ). The decoding accuracy and speed are naturally different. Therefore, this type of Mobile Phone Sound Quality
Naturally, it cannot be compared with hardware decoding. There are also very few EQ balancers. Even if they are implemented through software, the results will not work.
Yes.

In addition, popular image processing, 3D operations, video processing, audio processing, and many other multimedia applications will be used.
Floating point operations. Software Support is required without FPU units, which clearly sacrifices both efficiency and quality.
Floating Point computing capability is an important indicator for processing CPU multimedia and 3D graphics.
To build a compilation and development environment, you must add soft floating point support. Otherwise, an error occurs when floating point operations are involved.


Iv. Library File Format

First look at the e680 series library file format. For example, in the libjpeg. So file, use objdump-P to display the relevant content:
Private flags = 602: [APCS-32] [VFP float format] [software FP] [Has entry point]

It is obviously software FP, but it uses the VFP (vector float point) vector floating point format.

Let's look at the format of the e600 and 968 library files:
Private flags = 202: [APCS-32] [FPA float format] [software FP] [Has entry point]

Compared with e680, the difference is that it uses the Floating Point Arithmetic floating point format,
Another example is the fixed point floating point operation (Fixed Point Arithmetic. Due to this blank knowledge
Not carefully verified.

Of course, there is also a format
Private flags = 2: [APCS-32] [FPA float format] [Has entry point]
This is a hard floating point format, but if you add the arm-nolibfloat patch during compilation
-Msoft-float is added to the GCC parameter. It is estimated that soft floating point code can also be generated, but no tests are conducted.

In theory, no matter which format, it can be used when the application is running a link, and there is no compatibility.
But to compile, the library files must be completely consistent.

Take the cross-compilation tool in my hands as an example. It was originally built in the e680g VFP format, and I used Xia Xin
The QTE Library (FPA soft FP) of the e600 is used to compile a simple QTE program. The following error occurs:

/Home/GCC/toolchains/soft-arm-Linux/gcc-3.3.2-glibc-2.3.2/bin/../lib/
Gcc-lib/ARM-Linux/3.3.2/.../../ARM-Linux/bin/ld: Error:/home/GCC/
Toolchain/QT/lib/libqte-mt.so uses FPA instructions, whereas helloqt does not
/Home/GCC/toolchains/soft-arm-Linux/gcc-3.3.2-glibc-2.3.2/bin/../lib/
Gcc-lib/ARM-Linux/3.3.2/.../ARM-Linux/bin/ld: failed to merge
Target Specific data of file/home/GCC/toolchain/QT/lib/libqte-mt.so
Collect2: LD returned 1 exit status

This compilation environment is compiled with cross-tool-0.28, and the soft-
Float patch, but according to the patch, it should be able to generate the compilation environment in the format of FPA soft FP, and
The result is VFP soft FP, which is applicable to the e680 series, but not xiaxin e600 and Philips 968.

Later, I removed the -- with-float = soft option of gcc_extra_config in the Cross-compilation environment.
The soft-float patch is also removed, and the compilation environment of FPA hard FP is obtained. Use this environment
Compile the QTE Library (FPA soft FP) that comes with xiaxin e600. The following prompt appears:

LD uses hardware FP, whereas libqte-mt.so uses software...

I tried to add-msoft-float to the GCC parameter. The error is as follows:
Arm-Linux/bin/ld: cannot find-lfloat collect2: LD returned 1 exit status

Add the nolibfloat patch when compiling the environment.

How to generate the format of the FPA soft FP has been plagued for several days. I checked the soft-float patch itself and
I searched a lot of materials and thought it was a problem with the patch itself. I downloaded gcc.3.4.0 again and used
3.4.0 soft patch. Remove conflicting patches bigendian and nolibfloat,
The library file in the format of FPA soft FP is generated.

Then use the QTE library that comes with the e600. Compile with only one alarm option:
/Home/GCC/toolchain/gcc-3.4.0-glibc-2.2.5/ARM-Linux/lib/GCC/ARM-Linux/3.4
. 0/.../ARM-Linux/bin/ld: Warning: libstdc ++. so.5, needed by/home/GCC
/Toolchain/qt-2.3.8/lib/libqte-mt.so, not found (try using-rpath or-rpath-link)

Both xiaxin e600 and Philips 968 use the GCC version 3.2.1. After 3.4.0 is compiled, it is libstdc ++. so.6,
You can view the following lib content. Different versions are used.

Libstdc ++. so.6

Version definitions:
1 0x01 0x025f4d66 libstdc ++. so.6
2 0x00 0x08922974 glibcxx_3.4
3 0x00 0x056bafd3 cxxabi_1.3

Version references:
Required from libgcc_s.so.1:
0x0b792653 0x00 10 gcc_3.3
0x0d696910 0x00 08 glibc_2.0
0x0b792650 0x00 07 gcc_3.0
Required from libm. so.6:
0x0d696910 0x00 05 glibc_2.0
Required from libc. so.6:
0x09691f73 0x00 11 glibc_2.1.3
0x0d696911 0x00 09 glibc_2.1
0x0d696912 0x00 06 glibc_2.2
0x0d696910 0x00 04 glibc_2.0

Libstdc ++. so.5

Version definitions:
1 0x01 0x025f4d65 libstdc ++. so.5
2 0x00 0x081a2972 glibcpp_3.2
3 0x00 0x0a297d01 glibcpp_3.2.1
Glibcpp_3.2
4 0x00 0x056bafd2 cxxabi_1.2

Version references:
Required from libm. so.6:
0x0d696910 0x00 07 glibc_2.0
Required from libgcc_s.so.1:
0x0b792650 0x00 06 gcc_3.0
Required from libc. so.6:
0x0d696912 0x00 10 glibc_2.2
0x09691f73 0x00 09 glibc_2.1.3
0x0d696911 0x00 08 glibc_2.1
0x0d696910 0x00 05 glibc_2.0

V. Summary

The compiling environment of e600 and 968 seems to have solved the problem. Otherwise, it only indicates that
To be compatible with the e600, 968 library files, whether or not to run is another thing. The following describes the runtime
.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.