|
i want use a webcam to test AT91RM9200DK USB interface to grab image,
to do so i can familiar with arm linux platform programing.
the usb camera chip is zc301b with a HV7131b sensor,
the driver could be found at zc0302.sourceforge.net and test program use videodog,but they both only for x86,so must port to ARM and recompile.
i want to compile driver standalone but not build in kernel,
the develop environment setup follow this step:
1,download cross toolchain (cross-2.95.3.tar.bz2) packaged in AT91CDROM from 81.80.104.162(at91 technology support ftp site)
2,cd /usr/local/arm
3,tar jxvf cross-2.95.3.tar.bz2
4,cd ~/linux-2.4.27-vrs1-ATMEL
5,cp -rf include/asm-arm /usr/local/arm/2.95.3/arm-linux/include/asm
6,cp -rf include/linux /usr/local/arm/2.95.3/arm-linux/include
then modify Makefile of zc030x driver and videodog for ARM(attached below),the test result as below:
use this option to compile driver can not find correct kernel head files:
-I/usr/local/arm/2.95.3/arm-linux/include
-L/usr/local/arm/2.95.3/arm-linux/lib
but this will work:
-I/root/linux-2.4.27-vrs1-ATMEL/include
-I/root/linux-2.4.27-vrs1-ATMEL/include/linux
why this happen?
the cross toolchain should have correct head files seted by step 5,6.
then compile videodog but always fail.
CFLAGS option use:
-I/usr/local/arm/2.95.3/arm-linux/include
-L/usr/local/arm/2.95.3/arm-linux/lib
the error message complain glibc not linked ok.
like this:
utils.o(.text+0x34c): undefined reference to `memcpy'
utils.o(.text+0x360): undefined reference to `memset'
utils.o(.text+0x39c): undefined reference to `sprintf'
utils.o(.text+0x3a8): undefined reference to `strcpy'
utils.o(.text+0x3c4): undefined reference to `time'
utils.o(.text+0x3d0): undefined reference to `time'
utils.o(.text+0x424): undefined reference to `sprintf'
utils.o(.text+0x444): undefined reference to `memset'
utils.o(.text+0x450): undefined reference to `strlen'
utils.o(.text+0x460): undefined reference to `strncpy'
who have successful compiled user application for 2.4.27-vrs1 kernel with 2.95.3 toolchain?
or compiled a standalone driver successful?
if you have done same work ,Could you give some idea,Thanks!
Makefile for videodog attached:
-------------------------------------------------------------------------------------
# videodog
# general config
NAME = videodog
VERSION =0.23
CONFIG_FILE=/etc/vd.conf
CROSSGCC=/usr/local/arm/2.95.3
CROSSINCLUDE=$(CROSSGCC)/arm-linux/include
CROSSLIB=$(CROSSGCC)/arm-linux/lib
# comment if you want to change it
SPECIAL= -DBENCH # enables benchmark ( frame count / sec count )
JPEG = -DHASJPEG
JPEG_LIB=-ljpeg
#ASM_SWAP = -DBGR2RGB # enables a faster swap routine (bgr24 -> rgb24)
CC = arm-linux-gcc
LD = arm-linux-ld
AR = arm-linux-ar
RANLIB=arm-linux-ranlib
STRIP=arm-linux-strip
CFLAGS = -Wall -O3 $(SPECIAL) -DSTAMP -DCONFIG_FILE=\"$(CONFIG_FILE)\" -DVERSION=\"$(VERSION)\" # -DDEBUG -g3
CFLAGS += -I$(CROSSINCLUDE) -L$(CROSSLIB)
#CFLAGS += -fomit-frame-pointer -Wno-trigraphs -fno-strict-aliasing -fno-common -Wstrict-prototypes
#CFLAGS += -march=armv4 -mtune=arm9tdmi -mshort-load-bytes
LDFLAGS = -L/usr/local/arm/2.95.3/lib/lib.a -L$(CROSSLIB)
TARGETBIN =$(NAME)
# files
OBJS = utils.o \
loadset.o \
effects.o \
video.o \
stamp.o \
main.o
all: $(TARGETBIN)
$(TARGETBIN):$(OBJS)
@echo Linking $(TARGETBIN)
@$(LD) $(LDFLAGS) -o $(TARGETBIN) $(OBJS)
.c.o: Makefile $*.c
@echo Compiling $*.c
@$(CC) -static -s $(CFLAGS) -c $*.c -o $*.o
clean:
rm -rf *.o $(NAME)
------------------------------------------------------------------------------
any suggestion will great appreciation!
|