mazilo wrote:AFAIK, /usr/include is your host system include directory. OpenWRT include directory is under $(STAGING_DIR)/usr/include.
i try put file ftdi.h into $(STAGING_DIR)/usr/include but it does not solve my problem
i do next steps:
1. install debian on virtualbox
2. install libftdi
3. download and unpack http://downloads.openwrt.org/attitude_a … .2.tar.bz2
4. create folder "helloworld" in OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/package
5. create folder "src" in OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/package
6. create file helloworld.c in OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/package/src
#include <stdio.h>
#include <ftdi.h>
int main(void)
{
int ret;
struct ftdi_context ftdic;
if (ftdi_init(&ftdic) < 0)
{
fprintf(stderr, "ftdi_init failed\n");
return EXIT_FAILURE;
}
if ((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0)
{
fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
return EXIT_FAILURE;
}
// Read out FTDIChip-ID of R type chips
if (ftdic.type == TYPE_R)
{
unsigned int chipid;
printf("ftdi_read_chipid: %d\n", ftdi_read_chipid(&ftdic, &chipid));
printf("FTDI chipid: %X\n", chipid);
}
if ((ret = ftdi_usb_close(&ftdic)) < 0)
{
fprintf(stderr, "unable to close ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
return EXIT_FAILURE;
}
ftdi_deinit(&ftdic);
return EXIT_SUCCESS;
}
7. create Makefile in OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/package/src
helloworld: helloworld.o
$(CC) $(LDFLAGS) helloworld.o -o helloworld
helloworld.o: helloworld.c
$(CC) $(CFLAGS) -c helloworld.c
clean:
rm *.o helloworld
8. create Makefile in OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/package
include $(TOPDIR)/rules.mk
PKG_NAME:=helloworld
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Helloworld -- prints a snarky message
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef
$(eval $(call BuildPackage,helloworld))
8. go to OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2 directory (cd /home/tregub/Downloads/OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2)
9. do "make V=s"
10. undefined reference to 'ftdi_usb_close'
undefined reference to 'ftdi_deinit' etc
collect2: ld returned 1 exit status
Whats wrong?