ARM v5 shared library (ftd2xx) on ARM v7 platform - hard vs soft float issue

二次信任 提交于 2019-12-18 04:19:11

问题


I need to run a program that uses ftd2xx on my BeagleBoard xM rev C running Ubuntu 12.04. I am trying to use the ARM library libftd2xx.so provided here. libFTDI is not an option.

The difference that I noticed comes from running readelf -hA on libftd2xx.so vs other libraries on the BeagleBoard that work. The arch-specific section gives OS name as "ARM926EF-S" for ftd2xx instead of "7-A" for other libraries and CPU_arch as "v5TEJ" instead of "v7".

I'm assuming this means that the library is meant for the ARM v5 instruction set, and the BeagleBoard is running ARM v7. Is there some way to get ftd2xx to work?

Edit: I've been told ARM7 is backward compatible with ARM5, but that does not solve my problem.

Another thing to note is that running ldd libftd2xx.so on the BeagleBoard does not list the dependencies, but prints out not a dynamic executable, whereas it works on other libraries.

EDIT 2:

The issue seems to be with a soft vs hard float ABI. I have a gnueabihf image on the BeagleBoard xM. When I try to compile an example program with the static libftd2xx.a, I get many of these:

/usr/bin/ld: error: static_link_uses VFP register arguments, libftd2xx.a(file.o) does not
/usr/bin/ld: failed to merge target specific data of file libftd2xx.a(file.o)

If I try to compile with mfloat-abi=soft or mfloatabi=softfp, I get

In file included from /usr/include/stdio.h:28:0,
from main.c:12:
/usr/include/features.h:324:26 fatal error: bits/predef.h: No such file or directory
compilation terminated

I also tried to cross compile with arm-linux-gnueabi instead of arm-linux-gnueabihf, but the resulting program does not execute on the BeagleBoard. Is there anything I can do or is it impossible?

--------- SOLUTION ----------------

After some trouble, FTDI provided me with a hard float version of their library which works. I am providing it here after many people have individually requested it:

https://s3.amazonaws.com/hayk-public/arm926-hf.zip


回答1:


v5TEJ is a subset of the v7-A instruction set.

The code may run a bit slower and may be a bit larger than required, but it should nonetheless work without crashing due to illegal instructions or so. With very few exceptions ARM code is backward compatible to previous instruction sets.

If the code does not work on your platform it is very likely something else like missing access rights to the USB subsystem or so.




回答2:


Please see my pastebin output for strace and ldd on an ARM926 processor. The binaries inside libftd2xx1.1.12 have multiple processors. Ensure you are using release/build/arm926. I can run the statictest binary on an ARM926 CPU, with eglibc and Linux 2.6.36.

From the ldd output, the following libraries are required.

  • libdl.so.2 - dynamic loading.
  • librt.so.1 - real-time library
  • libpthread.so.0 - pthreads
  • libgcc_s.so.1 - gcc helpers.
  • libc.so.6 - eglibc library
  • ld-linux.so.3 - the Linux shared library loader.

A functional ldd is not needed and the following command should display libraries,

LD_TRACE_LOADED_OBJECTS=1 LD_WARN=yes LD_BIND_NOW=yes LD_VERBOSE=yes \
 /lib/ld-linux.so.3 ./libftd2xx.so.1.1.12 

Verify that the statictest binary work. If so, try to set LD_LIBRARY_PATH to the release/build/arm926/libftd2xx.so.1.1.12 location. From the strace output, the paths /lib/tls/v5l and /lib/tls are preferred over /lib. All of the libraries listed above should be in /lib. You can try to ln (hard link) them to that location. Also, from the strace output, the /proc/bus/usb filesystem should be mounted. This is a kernel config option. /sys/bus/usb/devices is used extensively to find devices; it is unlikely that this is missing on your Ubuntu 12.04 ARM Linux. There is also a libd2xx_table.so which is most likely used to find non-standard USB descriptors.

Finally, it would be helpful to be more descriptive of the problem. You try to run some program and there is no output? Or you run the program and it has an exception? If the statictest ARM binary fails to run, then your original assumption might be correct. It is possible that the older 2.6.32 kernel (or ld-linux.so) finds ARM926EJ-S compatible but your newer Ubuntu 12.04 does not find it compatible. In this case, use man ld-linux on a PC host to see the ld-linux.so environment variables. Specifically, LD_DEBUG and LD_ASSUME_KERNEL may be helpful to coax the loader to load the binaries.



来源:https://stackoverflow.com/questions/15306447/arm-v5-shared-library-ftd2xx-on-arm-v7-platform-hard-vs-soft-float-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!