2

我想编写一个程序,使用 ezsdk 6.0 BeagleBoard中的 D2XX 库从 FTDI 设备读取。

我使用Ubuntu 12.04 LTS (Precise Pangolin) 进行编译。

我从http://www.ftdichip.com下载了 libftd2xx1.1.12.tar.gz

  • 解压存档
  • 将 arm926 lib 文件复制到 \usr\local\lib
  • 创建了一个具有适当权限的符号链接,并且
  • 使用 arm-linux-gnueabihf-gcc 工具链交叉编译

我跟着(http://www.ftdichip.com/Drivers/D2XX/Linux/ReadMe-linux.txt)并在交叉编译时显示错误“找不到-lftd2xx”

shihab@shihab:~/Downloads/release/examples$ make -B CC=arm-linux-gnueabihf-gcc
    for n in BitMode EEPROM/erase EEPROM/read EEPROM/write EEPROM/user/read EEPROM/user/size EEPROM/user/write Events LargeRead MultiThread SetVIDPID Simple Timeouts ; do make -C $n || exit 1; done
    make[1]: Entering directory `/home/shihab/Downloads/release/examples/BitMode'
    arm-linux-gnueabihf-gcc main.c -o bitmode -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
    /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lftd2xx
    collect2: ld returned 1 exit status
    make[1]: *** [bitmode] Error 1
    make[1]: Leaving directory `/home/shihab/Downloads/release/examples/BitMode'
    make: *** [subdirs] Error 1
 shihab@shihab:~/Downloads/release/examples$

但是当我为 i386 架构遵循它时,它编译得很好

  • 解压存档
  • 将 i386 lib 文件复制到 \usr\local\lib
  • 创建了一个具有适当权限的符号链接,并且
  • 编译的 gcc

它编译得很好。

shihab@shihab:~/Downloads/release/examples$ make -B
for n in BitMode EEPROM/erase EEPROM/read EEPROM/write EEPROM/user/read EEPROM/user/size EEPROM/user/write Events LargeRead MultiThread SetVIDPID Simple Timeouts ; do make -C $n || exit 1; done
make[1]: Entering directory `/home/shihab/Downloads/release/examples/BitMode'
gcc main.c -o bitmode -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/BitMode'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/erase'
gcc main.c -o erase -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/erase'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/read'
gcc main.c -o read -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/read'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/write'
gcc main.c -o write -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/write'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/user/read'
gcc main.c -o readua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/user/read'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/user/size'
gcc main.c -o sizeua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/user/size'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/user/write'
gcc main.c -o writeua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/user/write'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/Events'
gcc main.c -o events -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/Events'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/LargeRead'
gcc main.c -o largeread -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/LargeRead'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/MultiThread'
gcc main.c -o multi -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/MultiThread'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/SetVIDPID'
gcc main.c -o setVIDPID -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/SetVIDPID'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/Simple'
gcc main.c -o simple -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/Simple'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/Timeouts'
gcc main.c -o timeouts -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/Timeouts'
shihab@shihab:~/Downloads/release/examples$ cd EEPROM/read/
shihab@shihab:~/Downloads/release/examples/EEPROM/read$ ./read
Library version = 0x10112
Opening port 0
FT_Open(0) failed
shihab@shihab:~/Downloads/release/examples/EEPROM/read$

没有“找不到 -lftd2xx”错误,它编译得很好。

我是 Linux 新手;我的步骤有什么问题?

4

2 回答 2

1

您需要卸载ftdi_ser模块(rmmod ftdi_sio在您可以使用该ftd2xx库之前)。由于内核ftdi_sio自动加载模块,您可能需要将其列入黑名单。

FTDI 主页上发布的库不是为 arm-hf 编译的。为 arm_hf 编译的版本可在此处获得

于 2014-09-12T08:44:14.417 回答
1

内核版本不同.. 为内核版本 2.6.32 构建的 arm926 用于 beagleboard XM 的 Ezsdk 6.0 使用内核版本 3.3.7

我认为,需要使用开源库(http://www.intra2net.com/en/developer/libftdi/

于 2013-09-07T05:04:48.960 回答