Helix移植中的交叉编译的浮点问题

来源:互联网 发布:php crm客户管理系统 编辑:程序博客网 时间:2024/05/27 21:12

 转载时请注明出处和作者联系方式

文章出处:http://blog.csdn.com/keensword007
作者联系方式:琴剑 <keensword007 at sina dot com>    

 

交叉编译工具链建立后,接下来就是安装Helix构建系统,可以参考文档Getting Started with Helix Source Code on Linux。按照步骤操作,一般不会有问题。

因为是针对moto E6手机,所以SYSTEM_ID环境变量设为linux-2.2-libc6-armv5te-cross-gcc3.3-iwmmxt-softfloat。还需要修改$BUILD_ROOT/umakecf/linux-2.2-libc6-armv5te-cross-gcc3.3-softfloat.cf文件,将如下几行
    platform.cc.cmd = 'iwmmxt_le-gcc'
    platform.cxx.cmd = 'iwmmxt_le-g++'
    platform.link.xplatform = "iwmmxt_le-"
修改为
    platform.cc.cmd = 'arm-linux-gcc'
    platform.cxx.cmd = 'arm-linux-g++'
    platform.link.xplatform = "arm-linux-"
此外,我选择的分支、目标和profile如下,主要目的是测试helix构建环境是否正确:
    [0] Set BIF branch (hxclient_3_1_0)
    [1] Set Target(s) (common_container_test)
    [2] Set Profile (helix-client-all-defines)
进行build后,出现如下错误:
wmmxt_le-g++  -shared hxxml.exp -o iwmmxt-softfloat-dbg/hxxml.so -u RMACreateInstance -u CanUnload -u CanUnload2 iwmmxt-softfloat-dbg/obj/xmldll/xmlccf.o iwmmxt-softfloat-dbg/obj/xmldll/hxexpat/expatprs.o iwmmxt-softfloat-dbg/obj/xmldll/hxexpat/expatapi.o iwmmxt-softfloat-dbg/obj/xmldll/par2/import/expat/xmlparse/xmlparse.o iwmmxt-softfloat-dbg/obj/xmldll/par2/import/expat/xmltok/xmltok.o iwmmxt-softfloat-dbg/obj/xmldll/par2/import/expat/xmltok/xmlrole.o  iwmmxt-softfloat-dbg/hxxml_libs.a   -lstdc++ -lm -lpthread -ldl
/home/chenzhengyong/ezx-crosstool-0.6/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/lib/gcc-lib/arm-linux/3.3.6/../../../../arm-linux/bin/ld: ERROR: iwmmxt-softfloat-dbg/obj/xmldll/xmlccf.o uses FPA instructions, whereas iwmmxt-softfloat-dbg/hxxml.so does not
/home/chenzhengyong/ezx-crosstool-0.6/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/lib/gcc-lib/arm-linux/3.3.6/../../../../arm-linux/bin/ld: failed to merge target specific data of file iwmmxt-softfloat-dbg/obj/xmldll/xmlccf.o
上网搜索了相关资料,了解到软件浮点FPA和VFP两种格式,出现这种问题一般是库文件和应用程序所选用的格式不同而造成的。但是本编译过程应用程序和库文件都是使用相同的编译选项从源码编译,按道理不会出现格式不同的问题。使用
    arm-linux-objdump -p a.out 
命令查看前面编译的helloworld程序,看到如下信息:
    private flags = 602: [APCS-32] [VFP float format] [software FP] [has entry point]
看来我编译出的工具链缺省采用VFP soft FP浮点格式。使用如下命令编译应用程序又会是什么结果呢?
     arm-linux-gcc -mcpu=iwmmxt -msoft-float hello.c
结果出现如下错误信息:
    ERROR: /tmp/cc2D7i8G.o uses FPA instructions, whereas a.out does not
看来我们的交叉编译工具链只能编译出VFP soft FP浮点格式的应用程序,因此,最终的解决办法是去掉-mcpu=iwmmxt -msoft-float编译选项,即修改$BUILD_ROOT/umakecf/
linux-2.2-libc6-armv5te-cross-gcc3.3-iwmmxt-softfloat.cf文件,将
    platform.cc.args["default"] = /
        "-pipe -W -Wreturn-type -fno-exceptions " /
        "-mcpu=iwmmxt " /
        "-msoft-float"
修改为:
    platform.cc.args["default"] = /
        "-pipe -W -Wreturn-type -fno-exceptions "
再次执行build,成功!
原创粉丝点击