最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]uses FPA instructions, whereas u-boot does not

工作和技术 crifan 2569浏览 0评论

用buildroot中编译出来的,OABI的arm-linux-gcc去编译u-boot-1.1.6,结果最后出错:

cd /home/crifan/develop/uboot/uboot_withUSB/opt/EmbedSky/u-boot-1.1.6 && /home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld -Bstatic -T /home/crifan/develop/uboot/uboot_withUSB/opt/EmbedSky/u-boot-1.1.6/board/EmbedSky/u-boot.lds -Ttext 0x33E00000  $UNDEF_SYM cpu/arm920t/start.o
–start-group lib_generic/libgeneric.a board/EmbedSky/libEmbedSky.a cpu/arm920t/libarm920t.a cpu/arm920t/s3c24x0/libs3c24x0.a lib_arm/libarm.a fs/cramfs/libcramfs.a fs/jffs2/libjffs2.a net/libnet.a rtc/librtc.a drivers/libdrivers.a drivers/nand/libnand.a drivers/nand_legacy/libnand_legacy.a drivers/lcd/liblcd.a modules/usb.module modules/wince.module common/libcommon.a –end-group -L /home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/../lib/gcc/arm-linux-uclibcgnueabi/4.3.3 -lgcc
-Map u-boot.map -o u-boot
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/usb.module(usbmain.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/usb.module(usbmain.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/usb.module(usbout.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/usb.module(usbout.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/usb.module(usbsetup.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/usb.module(usbsetup.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/usb.module(usbinit.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/usb.module(usbinit.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/usb.module(usbin.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/usb.module(usbin.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/usb.module(usblib.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/usb.module(usblib.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/wince.module(wince_cmds.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/wince.module(wince_cmds.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/wince.module(ebootloader.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/wince.module(ebootloader.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: modules/wince.module(extract_wince_image.o) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file modules/wince.module(extract_wince_image.o)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: ERROR: common/libcommon.a(bmp2rgb.module) uses FPA instructions, whereas u-boot does not
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/arm-linux-ld: failed to merge target specific data of file common/libcommon.a(bmp2rgb.module)
/home/crifan/develop/buildroot/buildroot-2009.05/build_arm/staging_dir/usr/bin/../lib/gcc/arm-linux-uclibcgnueabi/4.3.3/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0′
make: *** [u-boot] 错误 1

[解决过程]
1。 http://ks20602.kimsufi.com/samphpbb/viewtopic.php?f=9&t=3545&p=10685

Hi,
I had a similar problem with AT91Rm9200.
I’ve solved the problem by adding to arm_config.mk
following lines:

PLATFORM_CPPFLAGS += -march=armv4t -mtune=arm920t
PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__

You could try it with your specific mtune option.

去在config.mk中加了:
PLATFORM_CPPFLAGS = -march=armv4t -mtune=arm920t
后,先
make distclean
再 make EmbedSky_config
再make
但是还是出错。。。

2。看起来,FPA,好像是浮点相关的事情。。

http://linux.zipitwireless.com/irclogs/2008/08/03

[23:18:24]<crazymonkeypants>ERROR: src/arch-arm/lib/lib.a(div64.o) uses FPA instructions, whereas apex does not
[23:19:28]<crazymonkeypants>Ah, that’s a consequence of building xscale but no -msoft-float

所以,加上 -msoft-float:
PLATFORM_CPPFLAGS = -march=armv4t -mtune=arm920t -msoft-float
但是,重新编译,还是不行。。。。

3。
http://hi.baidu.com/_%C5%CE%C8%FD%C4%EA_/blog/item/a2527a174fd7cf084b90a76a.html
“GCC view
New ABI is not only a new ABI field, it is also a new GCC target.
Legacy ABI
* ABI flags passed to binutils: -mabi=apcs-gnu -mfpu=fpa
* gcc -dumpmachine: arm-unknown-linux
* objdump -x for compiled binary:
private flags = 2: [APCS-32] [FPA float format] [has entry point]* "file" on compiled Debian binary:
ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), for GNU/Linux 2.2.0, stripped* "readelf -h | grep Flags""
Flags: 0x0

Arm EABI:
* ABI flags passed by gcc to binutils: -mabi=aapcs-linux -mfloat-abi=soft -meabi=4
* gcc -dumpmachine: arm-unknown-linux-gnueabi

加上-mfpu=fpa:
PLATFORM_CPPFLAGS = -march=armv4t -mtune=arm920t -msoft-float -mfpu=fpa
也还是不行。
不过看起来,不仅和浮点有关,看来也是ABI的事情,影响到浮点的问题了。。。

另外,之前用EABI的交叉编译器去编译uboot,最后也是ld出错,此处,感觉,如果在编译的时候,给上上面的
-mabi=aapcs-linux -mfloat-abi=soft -meabi=4
,估计,就可以正常编译链接通过了呢, 有机会试试,呵呵。

4。发现一个很诡异的事情,或者说很不正常的事情
buildroot的menuconfig里面,明明是有对应的OABI 还是EABI的设置
但是,把原先设置成的EABI 改成OABI后,对应的默认的文件名,还是没自动变过来,而要手动去改变,
而且,最主要的是,在menuconfig里面,也是有对应的浮点支持选项的,而且我已经是选上的:
Toolchain  —> 
[*] Use software floating point by default
而且其help里面说的也很清楚:
│ If your target CPU does not have a Floating Point Unit (FPU) or a                                     │ 
│ kernel FPU emulator, but you still wish to support floating point                                     │ 
│ functions, then everything will need to be compiled with soft                                         │ 
│ floating point support (-msoft-float).     
也就是,我的tq2440的CPU 是arm920t,没有FPU,但是还想支持浮点运算,因此我选中此支持,
但是,编译出来的交叉工具链,却在ld uboot的时候,说是FPA的,而不是软件浮点的,很是无语。。。

不知道到底哪里没设置好,还是本身支持有问题??? 异或是别人说的,gcc版本的问题???
注:buildroot中:
GCC compiler Version (gcc 4.3.3)
uClibc C library Version (uClibc 0.9.30.1)
Binutils Version (binutils 2.19.1)
无解ing。。。。。

5.PXA255平台U-Boot编译问题的解决
http://blog.csdn.net/gueter/archive/2008/01/10/2034146.aspx
中说的办法是“修改arm-linux-gcc配置文件,或者在uboot的cpu目录下找相应架构的配置文件,去除软浮点运算”,但是偶很菜,不知道具体如何做。。。

6。不过,网上找到,这位兄弟,算是基本搞定了:
在cygwin下调试uboot-1.1.6 碰到的问题
http://blog.vckbase.com/liu090/archive/2008/10/09/31375.html
我去看了下,cpu/arm920t/config.mk中,是有:
PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8
-msoft-float
如果把最后的    -msoft-float去掉,应该可以编译过的,但是意思明显就错了,
就变成了,gcc里面支持硬件浮点,而此处编译cpu相关的文件,也是用硬件浮点,这样,如果实际运行时候,代码运行到和浮点有关的地方,那么就出错了,因为实际底层根本没有FPA硬件浮点单元。
所以,只能用那位兄弟说的,去gcc代码里面,把浮点有关的地方,改成软件浮点,这样是可以,不过貌似忒麻烦了吧。。。。
不知道谁有更有效的办法。。。。

7。突然无意间想到,对于上面gcc等版本,末尾最后一位是奇数,是不是不稳定,互相搭配有问题阿,所以,自己尝试去改了gcc,binutils,uClibc的版本,改成:
GCC compiler Version (gcc 4.3.2)
uClibc C library Version (uClibc 0.9.30)
Binutils Version (binutils 2.19)
然后重新对buildroot进行make,漫长的等待阿。。。。
不知道结果如何。。。。估计也还是不行。。。因为好像不是版本的问题。。。。

不过,make完之后,又一次验证了”一切解有可能“这句话。
因为,
对于buildroot,我在按照上面修改成:gcc是4.3.2,uClibc是0.9.30,binutils是2.19,然后重新对buildroot make之后,生成了新版本的arm-linux-交叉工具链后;
然后对uboot,重新删掉uboot,重新通过源码包解压,重新配置
最后make,而并没有像上面那样,去给PLATFORM_CPPFLAGS加多余的参数,即:
rm opt/ -rf
tar xvjf u-boot-1.1.6_module_20090515.tar.bz2
cd opt/EmbedSky/u-boot-1.1.6/
make EmbedSky_config
make
最后,的确可以make通过。。。

[方法总结]

所以,最后的解决办法很简单,就是保证建立交叉工具链的时候,保证几个版本配匹配
至少此处对于buildrootmenuconfig中,这样的搭配:
GCC compiler Version (gcc 4.3.2)
uClibc C library Version (uClibc 0.9.30)
Binutils Version (binutils 2.19)
加上 Target ABI (OABI)
对于 Target Architecture Variant (arm920t)
编译出来的交叉工具链,去编译u-boot-1.1.6,是可以正常编译的。

另外,突然想起来了,如果是对于buildroot,设成EABI,能否正常编译呢?  有机会可以试一试。。。

转载请注明:在路上 » [已解决]uses FPA instructions, whereas u-boot does not

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
79 queries in 0.154 seconds, using 22.13MB memory