[Armadillo:05120] ライブラリのコンパイル方法

佐原拓也 email@hidden
2010年 4月 27日 (火) 16:09:49 JST


佐原と言います。Linux初心者です。

Armadillo-500FXにて、FTDI USBドライバ(ライブラリ)を動作させようと
奮闘中です。
接続環境
Armadillo-500FX <--- USB cable ---> FTDI FT2232H(USB) <---> CPU

Out of Tree コンパイルにて、FTDI USBプログラムを動作させよう試みてます。

FTDI USB D2xxドライバー
http://www.ftdichip.com/Drivers/D2XX.htm

ディレクトリにCソースコード(souce.c)とヘッダファイル(ftd2xx.h)をいれ、
makeすると以下のエラーが出ます。
arm-linux-gcc   -L../atmark-dist-20100310/lib -o test test.o -lc -lgcc
test.o: In function `ae2_write_ana':
test.c:(.text+0x40): undefined reference to `FT_Write'
test.c:(.text+0x6c): undefined reference to `FT_Write'
 :
 中略 上記同様のエラー内容がずらっとでます。
 :
collect2: ld returned 1 exit status
make: *** [test] エラー 1

と出ます。

1)ライブラリがリンクされていないからだと思うのですが、クロスコンパイルする場合、
 ライブラリをどのようにリンクするか教えて頂きたいです。
 具体的には本文の最後にあります、Debian Linuxでライブラリをインストールしたことを
 クロスコンパイルでもする必要があると思いますが方法がよくわかりません。

2)合わせて、Makefile のgccオプションを追加する必要があると思いますが、
 オプションの書き方がよくわかりません。

組込でなく、Debian Linuxではプログラムが動作していることは確認しました。
以下、FTDI USBのMakefile、Rules.make、Readme.dat です。

〇Makefile

TOPDIR  := $(shell cd ..; pwd)
include $(TOPDIR)/Rules.make
APP = test
all: $(APP)
$(APP): main.c
 $(CC) -o $(APP) $(CFLAGS) main.c
 clean:
 rm -f *.o ; rm $(APP)
 〇Rules.make

CC=gcc
CFLAGS=-L. -lftd2xx -Wl,-rpath /usr/local/lib
〇FTDI USBドライバー(ライブラリ)のインストール(Readme.dat)

Instructions for installing the d2xx shared lib
As Linux distributions vary these instructions are a guide to installation
and use.
This setup works with Mandrake 9.2 but may require some investigation on
other distributions.
This library has been tested using kernel 2.4.25.
D2XX documentation is available for the Windows dll - some variations may
occur between linux and
windows implementation. We have endevoured to make the APIs appear the same
on both platforms however some
issues may slip and we would appreciate that you contact support if you
observe this.
D2XX for linux was primarily developed to aid porting windows applications
written with D2XX to linux.
Unfortunately the source code for D2XX is not freely available - however if
you prefer to have the
source and are starting a project from scratch you can try libftdi from
Thomas Jarosch.
Details of this library are on the ftdi web site.

libftd2xx uses an unmodified version of libusb (
http://libusb.wiki.sourceforge.net/).
Source code for libusb is included in the driver distribution in the
libusb-0.1.12 directory.

Installation:
1. unzip and untar the file given to a suitable directory
gunzip libftd2xx0.4.12.tar.gz
tar -xvf libftd2xx0.4.12.tar
2. As root user copy the following files to /usr/local/lib
cp libftd2xx.so.0.4.12 /usr/local/lib
3. Change directory to /usr/local/lib
cd /usr/local/lib
4. make symbolic links to these files using the following commands:
ln -s libftd2xx.so.0.4.12 libftd2xx.so
5. Change directory to /usr/lib
cd /usr/lib
6. make symbolic links to these files using the following commands:
ln -s /usr/local/lib/libftd2xx.so.0.4.12 libftd2xx.so
7. Add the following line to /etc/fstab:
none /proc/bus/usb usbdevfs defaults,devmode=0666 0 0
There have been reports that you may need to use the following command for
some distros
none /proc/bus/usb usbdevfs defaults,mode=0666 0 0 (use usbfs in 2.6
kernels)
8. Remount all in the fstab file
mount -a
If you have problems with this check with usbview (search on the internet
for application
or it can be sent to you by ftdi) to check the usb file system is mounted
properly.
Other problems will be related to the ftdi_sio driver loading -
1.you must unload this driver (and usbserial) if it is attached to your
device ("rmmod ftdi_sio" and "rmmod usbserial"as root user).
2.Your PID/VID has not been included in the distribution.A PID of 0x6006 and
VID of
0x0403 should work as a temporary workaround.
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://lists.atmark-techno.com/pipermail/armadillo/attachments/20100427/4619c15e/attachment.html>


armadillo メーリングリストの案内