码迷,mamicode.com
首页 > 其他好文 > 详细

交叉编译 FT4232 eeprom 开源工具 libftdi 记录

时间:2018-09-08 14:12:15      阅读:376      评论:0      收藏:0      [点我收藏+]

标签:toolchain   header   package   开发板   sudo   system   devkit   ant   ror   

libftdi下载地址https://www.intra2net.com/en/developer/libftdi/download.php

Libftdi 依赖 libusb libconfuse gettext-0.19

首先安装依赖文件

sudo apt-get install libboost-all-dev

一、 交叉编译 libusb

1git clone https://github.com/libusb/libusb.git

2. autogen.sh 

报错 configure: error: udev support requested but libudev header not installed
报错 error: Libtool library used but ‘LIBTOOL‘ is undefined
libusb/Makefile.am:5: The usual way to define ‘LIBTOOL‘ is to add ‘LT_INIT‘
libusb/Makefile.am:5: to ‘configure.ac‘ and run ‘aclocal‘ and ‘autoconf‘ again.
libusb/Makefile.am:5: If ‘LT_INIT‘ is in ‘configure.ac‘, make sure
libusb/Makefile.am:5: its definition is in acloc

3. 安装 sudo apt-get install libtool   

4. 再次执行 autogen.sh

rm: invalid option -- ‘l‘
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm ./-libtoolT‘ to remove the file ‘-libtoolT‘.
Try ‘rm --help‘ for more information.config.status: WARNING: Unable to substitute extended shell functions in -libtool
mv: invalid option -- ‘l‘
Try ‘mv --help‘ for more information.
rm: invalid option -- ‘l‘
Try ‘rm --help‘ for more information.
chmod: invalid option -- ‘l‘
Try ‘chmod --help‘ for more information.

5. 加上 sudo 再次执行 sudo autogen.sh

6sudo chown picohood:picohood libusb/ -R

7. 安装 sudo apt-get install libudev-dev

8. 在配置的时候加上--disable-udev,如下 

./configure --build=i686-linux --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
--prefix=/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++ --disable-udev

9. make

10. make install

–build=i686-linux 表示该软件在 x86 平台被编译
–host=arm-linux 表示该软件编译完成后在 arm 平台上运行
–prefix 后面为软件安装目录。
CC=,CXX 等于指定了交叉编译使用的 C, C++交叉编译器

二、 交叉编译 libconfuse  

1. Git clone https://github.com/martinh/libconfuse.git

2. autogen.sh

3. 在配置的时候加上--disable-udev,如下

./configure --build=i686-linux --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
--prefix=/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++ --disable-udev
报错/home/picohood/gitrepo/tisdk/tools/libconfuse/support/missing: line 81: flex: command not foundWARNING: ‘flex‘ is missing on your system.
You should only need it if you modified a ‘.l‘ file.
You may want to install the Fast Lexical Analyzer package:
<http://flex.sourceforge.net/>

4. sudo apt-get install flex

5.再次 configure 成功

6.Make

7.Make install

–build=i686-linux 表示该软件在 x86 平台被编译
–host=arm-linux 表示该软件编译完成后在 arm 平台上运行
–prefix 后面为软件安装目录。
CC=,CXX 等于指定了交叉编译使用的 C, C++交叉编译器

三、 交叉编译交叉编译 gettext-0.19

1.下载地址 http://ftp.gnu.org/pub/gnu/gettext/

    1.1.sudo tar zxvf gettext-0.19.tar.gz 

      1.2sudo chown picohood:picohood gettext-0.19 -R

2.在配置的时候加上--disable-udev,如下

./configure --build=i686-linux --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
--prefix=/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++ --disable-udev

3.Make

4.Make install 

–build=i686-linux 表示该软件在 x86 平台被编译
–host=arm-linux 表示该软件编译完成后在 arm 平台上运行
–prefix 后面为软件安装目录。
CC=,CXX 等于指定了交叉编译使用的 C, C++交叉编译器

四、 交叉编译交叉编译libftdi

1.安装 cmake 工具 

  Sudo apt-get install cmake

2.进入 libftdi/cmake

3.cp Toolchain-mingw32.cmake Toolchain-am3358.cmake

4.编辑里面为如下代码 

  下面的配置经过解决编译各种问题的最终配置, 为了节省时间可以直接写入该配置

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Linux)
# which compilers to use for C and C++
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
SET(LIBUSB_LIBRARIES
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/lib/libusb-1.0.so.0
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/usr/lib/librt.so)
SET(LIBUSB_INCLUDE_DIR
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/include/libusb-1.0)
SET(CMAKE_C_FLAGS -g -O2 -fPIC)
SET(CMAKE_CXX_FLAGS -g -O2 -fPIC)
SET(CMAKE_INSTALL_PREFIX
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi)
SET(CONFUSE_LIBRARY
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/lib/libconfuse.so.2)
SET(CONFUSE_INCLUDE_DIR/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/include/)
SET(LIBINTL_INCLUDE_DIR
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/lib)
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

 

5.进入 libftdi 目录

6.创建 bulid 目录 mkdir build

7.进入 build 目录 并执行编译命令如下

cmake -DCMAKE_TOOLCHAIN_FILE=/home/picohood/gitrepo/tisdk/tools/libftdi/cmake/Toolchain-am3358.cmake ../

8.Make 

9.成功, 拷贝动态库和执行文件到开发板即可
10.执行ftdi_eeprom

Lsusb -v -d 0x0403:6011
Lsusb -t
ftdi_eeprom --device d:2/4 --erase-eeprom ee_prom.conf
ftdi_eeprom --device d:2/4 --flash-eeprom ee_prom.conf

ftdi_eeprom --device d:1/4 --erase-eeprom ee_prom.conf
ftdi_eeprom --device d:1/4 --flash-eeprom ee_prom.conf

  

 

 

 

 

交叉编译 FT4232 eeprom 开源工具 libftdi 记录

标签:toolchain   header   package   开发板   sudo   system   devkit   ant   ror   

原文地址:https://www.cnblogs.com/liushuhe1990/p/9608898.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!