Теперь соберем libFTDI. Загружаем последнюю версию со следующей страницы (на момент написания libftdi1-1.2), распаковываем.
Переходим в каталог и запускаем cmake.
$ cd libftdi1-1.2
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX="/usr" ../
Нажмите, чтобы отобразить
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
CMake Warning at /usr/share/cmake-3.1.2/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/usr/share/cmake-3.1.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:2 (project)
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type: RelWithDebInfo
-- Found PkgConfig: /usr/bin/pkg-config.exe (found version "0.28")
-- checking for module 'libusb-1.0'
-- found libusb-1.0, version 1.0.19
-- Found LIBUSB: /usr/lib/libusb-1.0.dll.a
-- Boost version: 1.57.0
-- Found Doxygen: /usr/bin/doxygen.exe (found version "1.8.9.1")
-- Doxygen found.
-- Generating API documentation with Doxygen
fatal: Not a git repository (or any parent up to mount point /cygdrive/d)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
-- Detected git snapshot version: unknown
-- Building libftdi1++
-- Found SWIG: /usr/bin/swig.exe (found version "3.0.5")
-- Found PythonLibs: /usr/lib/libpython3.4m.dll.a (found version "3.4.3")
-- Found PythonInterp: /usr/bin/python3.4 (found version "3.4.3")
-- Building python bindings via swig. Will be installed under /usr/lib/python3.4/site-packages
-- Could NOT find Confuse (missing: CONFUSE_LIBRARY CONFUSE_INCLUDE_DIR)
-- Looking for dgettext
-- Looking for dgettext - not found
-- Found Libintl: /usr/include
-- libConfuse not found, won't build ftdi_eeprom
-- Building example programs.
-- Building libftdi++ examples.
-- Boost version: 1.57.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Building unit test
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/d/urjtag-svn/urjtag/libftdi1-1.2/build
Если возникнет ошибка – стоит проверить наличие всех зависимостей.
Далее собираем.
$ make
Нажмите, чтобы отобразить
Scanning dependencies of target docs
[ 4%] Generating doc/html/index.html
Warning: Tag `SYMBOL_CACHE_SIZE' at line 341 of file `/cygdrive/d/urjtag-svn/urjtag/libftdi1-1.2/build/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `XML_SCHEMA' at line 1418 of file `/cygdrive/d/urjtag-svn/urjtag/libftdi1-1.2/build/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `XML_DTD' at line 1424 of file `/cygdrive/d/urjtag-svn/urjtag/libftdi1-1.2/build/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
[ 4%] Built target docs
Scanning dependencies of target ftdi1
[ 8%] Building C object src/CMakeFiles/ftdi1.dir/ftdi.c.o
[ 12%] Building C object src/CMakeFiles/ftdi1.dir/ftdi_stream.c.o
Linking C shared library cygftdi1-2.dll
[ 12%] Built target ftdi1
Scanning dependencies of target ftdi1-static
[ 16%] Building C object src/CMakeFiles/ftdi1-static.dir/ftdi.c.o
[ 20%] Building C object src/CMakeFiles/ftdi1-static.dir/ftdi_stream.c.o
Linking C static library libftdi1.a
[ 20%] Built target ftdi1-static
Scanning dependencies of target ftdipp1
[ 25%] Building CXX object ftdipp/CMakeFiles/ftdipp1.dir/ftdi.cpp.o
Linking CXX shared library cygftdipp1-2.dll
[ 25%] Built target ftdipp1
Scanning dependencies of target ftdipp1-static
[ 29%] Building CXX object ftdipp/CMakeFiles/ftdipp1-static.dir/ftdi.cpp.o
Linking CXX static library libftdipp1.a
[ 29%] Built target ftdipp1-static
Scanning dependencies of target doc_i
[ 33%] Generating ../doc/xml/ftdi_8c.xml
Warning: Tag `SYMBOL_CACHE_SIZE' at line 345 of file `Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `XML_SCHEMA' at line 1422 of file `Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `XML_DTD' at line 1428 of file `Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
[ 37%] Generating ftdi1_doc.i
[ 37%] Built target doc_i
[ 41%] Swig source
Scanning dependencies of target _ftdi1
[ 45%] Building C object python/CMakeFiles/_ftdi1.dir/ftdi1PYTHON_wrap.c.o
Linking C shared module _ftdi1.dll
[ 45%] Built target _ftdi1
Scanning dependencies of target baud_test
[ 50%] Building C object examples/CMakeFiles/baud_test.dir/baud_test.c.o
Linking C executable baud_test.exe
[ 50%] Built target baud_test
Scanning dependencies of target bitbang
[ 54%] Building C object examples/CMakeFiles/bitbang.dir/bitbang.c.o
Linking C executable bitbang.exe
[ 54%] Built target bitbang
Scanning dependencies of target bitbang2
[ 58%] Building C object examples/CMakeFiles/bitbang2.dir/bitbang2.c.o
Linking C executable bitbang2.exe
[ 58%] Built target bitbang2
Scanning dependencies of target bitbang_cbus
[ 62%] Building C object examples/CMakeFiles/bitbang_cbus.dir/bitbang_cbus.c.o
Linking C executable bitbang_cbus.exe
[ 62%] Built target bitbang_cbus
Scanning dependencies of target bitbang_ft2232
[ 66%] Building C object examples/CMakeFiles/bitbang_ft2232.dir/bitbang_ft2232.c.o
Linking C executable bitbang_ft2232.exe
[ 66%] Built target bitbang_ft2232
Scanning dependencies of target eeprom
[ 70%] Building C object examples/CMakeFiles/eeprom.dir/eeprom.c.o
Linking C executable eeprom.exe
[ 70%] Built target eeprom
Scanning dependencies of target find_all
[ 75%] Building C object examples/CMakeFiles/find_all.dir/find_all.c.o
Linking C executable find_all.exe
[ 75%] Built target find_all
Scanning dependencies of target find_all_pp
[ 79%] Building CXX object examples/CMakeFiles/find_all_pp.dir/find_all_pp.cpp.o
Linking CXX executable find_all_pp.exe
[ 79%] Built target find_all_pp
Scanning dependencies of target serial_test
[ 83%] Building C object examples/CMakeFiles/serial_test.dir/serial_test.c.o
Linking C executable serial_test.exe
[ 83%] Built target serial_test
Scanning dependencies of target simple
[ 87%] Building C object examples/CMakeFiles/simple.dir/simple.c.o
Linking C executable simple.exe
[ 87%] Built target simple
Scanning dependencies of target stream_test
[ 91%] Building C object examples/CMakeFiles/stream_test.dir/stream_test.c.o
Linking C executable stream_test.exe
[ 91%] Built target stream_test
Scanning dependencies of target test_libftdi1
[ 95%] Building CXX object test/CMakeFiles/test_libftdi1.dir/basic.cpp.o
[100%] Building CXX object test/CMakeFiles/test_libftdi1.dir/baudrate.cpp.o
Linking CXX executable test_libftdi1.exe
[100%] Built target test_libftdi1
Теперь устанавливаем.
$ make install
Нажмите, чтобы отобразить
[ 4%] Built target docs
[ 12%] Built target ftdi1
[ 20%] Built target ftdi1-static
[ 25%] Built target ftdipp1
[ 29%] Built target ftdipp1-static
[ 37%] Built target doc_i
[ 45%] Built target _ftdi1
[ 50%] Built target baud_test
[ 54%] Built target bitbang
[ 58%] Built target bitbang2
[ 62%] Built target bitbang_cbus
[ 66%] Built target bitbang_ft2232
[ 70%] Built target eeprom
[ 75%] Built target find_all
[ 79%] Built target find_all_pp
[ 83%] Built target serial_test
[ 87%] Built target simple
[ 91%] Built target stream_test
[100%] Built target test_libftdi1
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/lib/pkgconfig/libftdi1.pc
-- Installing: /usr/lib/pkgconfig/libftdipp1.pc
-- Installing: /usr/bin/libftdi1-config
-- Installing: /usr/lib/cmake/libftdi1/LibFTDI1Config.cmake
-- Installing: /usr/lib/cmake/libftdi1/LibFTDI1ConfigVersion.cmake
-- Up-to-date: /usr/lib/cmake/libftdi1/UseLibFTDI1.cmake
-- Installing: /usr/lib/libftdi1.dll.a
-- Installing: /usr/bin/cygftdi1-2.dll
-- Installing: /usr/lib/libftdi1.a
-- Up-to-date: /usr/include/libftdi1/ftdi.h
-- Installing: /usr/lib/libftdipp1.dll.a
-- Installing: /usr/bin/cygftdipp1-2.dll
-- Installing: /usr/lib/libftdipp1.a
-- Up-to-date: /usr/include/libftdi1/ftdi.hpp
-- Installing: /usr/lib/python3.4/site-packages/ftdi1.py
-- Installing: /usr/lib/python3.4/site-packages/_ftdi1.dll
-- Up-to-date: /usr/share/libftdi/examples/simple.py
-- Up-to-date: /usr/share/libftdi/examples/complete.py
Установка производится в папку с Cygwin, поэтому ее подкаталоги должны быть доступны для записи.
Для libFTDI драйвер от FTDI не подходит, поэтому загружаем последнюю версию zadig zadig (на момент написания zadig_v2.0.1.160), распаковываем, запускаем.
В «Options» выбираем «List all Devices», далее выбираем интересующее нас устройство, драйвер libusbK и нажимаем «Replace Driver».
В Диспетчере устройств появится новый драйвер вместо старого (в этом примере USB Serial Converter A от FT2232H Mini Module заменен на FT2232H MiniModule (Interface 0), но в то же время USB Serial Converter B остался нетронутым).
Переходим в корень диска и загружаем снапшот UrJTAG (на момент написания ревизия 2051).
$ cd d:
$ svn checkout svn://svn.code.sf.net/p/urjtag/svn/trunk urjtag-svn
$ cd urjtag-svn/urjtag
Также я решил добавить поддержку параллельного порта –with-inpout32
. Для этого загружаем последнюю версию библиотеки InpOut32 (на момент написания 1.5.0.0), из архива извлекаем файл inpout32.h
в папку Сygwin \usr\include\
При помощи следующих команд создаем скрипт configure
и выполняем его.
$ ./autogen.sh
$ ./configure --with-libftdi --with-inpout32 --disable-nls --disable-python
Параметры –disable-nls
и –disable-python
необходимы для устранения ошибок вида undefined reference
...
../../src/.libs/liburjtag.a(direct.o):direct.c:(.text+0x46a): undefined reference to `libintl_gettext'
../../src/.libs/liburjtag.a(idcode.o):idcode.c:(.text+0x13e): more undefined references to `libintl_gettext' follow
../../src/.libs/liburjtag.a(libftdi.o):libftdi.c:(.text+0x129): undefined reference to `ftdi_read_data_submit'
...
Проверяем результаты. Должна быть отмечена поддержка libFTDI. На отсутствие поддержки ftd2xx не обращаем внимания.
...
checking for LIBUSB... yes
checking for LIBFTDI... yes
checking for ftdi_usb_open... yes
checking for ftdi_read_data_submit... yes
checking for FT_OpenEx in -lftd2xx... no
configure: WARNING: *** libftd2xx not found. No support for FTDI-based USB JTAG cables via libftd2xx.
checking for inpout32.h... yes
...
urjtag is now configured for
Libraries:
libusb : 1.0
libftdi : yes (have async mode)
libftd2xx : no
inpout32 : yes
...
Lowlevel : direct ftdi
...
В файле sysdep.h
из корня urjtag исправляем ошибку с дублирующимся INPUT.
In file included from vhdl_flex.l:141:0:
vhdl_bison.h:84:5: ошибка: «INPUT» повторно декларирован как символ другого вида
INPUT = 294,
^
In file included from /usr/include/w32api/windows.h:72:0,
from ../../sysdep.h:47,
from vhdl_flex.l:126:
/usr/include/w32api/winuser.h:2673:5: замечание: здесь была предыдущая декларация «INPUT»
} INPUT,*PINPUT,*LPINPUT;
^
Для этого перед и после #include <windows.h>
добавляем следующие строки.
...#endif
#define WINAPI_FAMILY 2
#define NOUSER
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifdef IN
#undef IN
#endif
#ifdef OUT
#undef OUT
#endif
#ifdef __MINGW32__...
Теперь собираем.
$ make -j 8 CFLAGS='-Wno-char-subscripts -Wno-unused-value'
Собранный файл находится в папке \urjtag-svn\urjtag\src\apps\jtag\.libs\
. Для его запуска нужны библиотеки из Сygwin, поэтому создадим следующий командный файл и разместим его рядом с jtag.exe
.
- urjtag.cmd
SET PATH=%PATH%;d:\cygwin\bin
jtag.exe
Путь d:\cygwin\bin
изменяем на свой. Запускаем urjtag.cmd
– появится командная строка UrJTAG.
Готово
Список параметров командной строки приведен ниже.
>jtag --help
UrJTAG 0.10 #2051
Usage: jtag [OPTIONS] [FILE [FILE ... ]]
-h, --help display this help and exit
-v, --version display version information and exit
-n, --norc disable reading ~/.jtag/rc on startup
-i, --interactive enter interactive mode after reading files
-q, --quiet Do not print help on startup
[FILE] file containing commands to execute
Please report bugs at http://www.urjtag.org
А также список команд и перечень поддерживаемых кабелей.
Нажмите, чтобы отобразить
jtag> help
Command list:
frequency setup JTAG frequency
cable select JTAG cable
reset reset JTAG chain
discovery discovery of unknown parts in the JTAG chain
idcode Read IDCODEs of all parts in a JTAG chain
detect detect parts on the JTAG chain
detectflash detect parameters of flash chips attached to a part
help display this help
quit exit and terminate this session
scan read BSR and show changes since last scan
signal define new signal for a part
salias define an alias for a signal
bit define new BSR bit
register define new data register for a part
initbus initialize bus driver for active part
print display JTAG chain list/status
part change active part for current JTAG chain
bus change active bus
instruction change active instruction for a part or declare new instruction
shift shift data/instruction registers through JTAG chain
dr display active data register for a part
get get external signal value
test test external signal value
debug set logging/debugging level
shell run a shell command
set set external signal value
endian set/print endianness
peek read a single word
poke write a single word
pod Set or read state of POD signal(s)
readmem read content of the memory and write it to file
writemem write content of file to the memory
flashmem burn flash memory with data from a file
eraseflash erase flash memory by number of blocks
lockflash lock flash memory by number of blocks
unlockflash unlock flash memory by number of blocks
include include command sequence from external repository
script run command sequence from external file
addpart manually adds parts on the JTAG chain
usleep Sleep some number of microseconds
bfin Blackfin specific commands
pld configure a Programmable Logic Device from file
bsdl manage BSDL files
svf execute svf commands from file
Type "help COMMAND" for details about a particular command.
jtag> help cable
Usage: cable DRIVER [DRIVER_OPTS]
Select JTAG cable type.
DRIVER name of cable
DRIVER_OPTS options for the selected cable
Type "cable DRIVER help" for info about options for cable DRIVER.
You can also use the driver "probe" to attempt autodetection.
List of supported cables:
ARCOM Arcom JTAG Cable
ByteBlaster Altera ByteBlaster/ByteBlaster II/ByteBlasterMV Parallel Port Download Cable
DLC5 Xilinx DLC5 JTAG Parallel Cable III
EA253 ETC EA253 JTAG Cable
EI012 ETC EI012 JTAG Cable
FT2232 Generic FTDI FT2232 Cable
ARM-USB-OCD Olimex ARM-USB-OCD[-TINY] (FT2232) Cable
ARM-USB-OCD-H Olimex ARM-USB-TINY-H (FT2232H) Cable
Flyswatter TinCanTools Flyswatter (FT2232) Cable
gnICE Analog Devices Blackfin gnICE (FT2232) Cable (EXPERIMENTAL)
gnICE+ Analog Devices Blackfin gnICE+ (FT2232H) Cable (EXPERIMENTAL)
JTAGkey Amontec JTAGkey (FT2232) Cable
KT-LINK KrisTech KT-LINK (FT2232H based) Cable
milkymist Milkymist JTAG/serial (FT2232) Cable
OOCDLink-s OOCDLink-s (FT2232) Cable (EXPERIMENTAL)
Signalyzer Xverve DT-USB-ST Signalyzer Tool (FT2232) Cable (EXPERIMENTAL)
Turtelizer2 Turtelizer 2 Rev. B (FT2232) Cable (EXPERIMENTAL)
USB-JTAG-RS232 USB<=>JTAG&RS232 (FT2232) Cable (EXPERIMENTAL)
usbScarab2 KrisTech usbScarabeus2 (FT2232) Cable
USB-to-JTAG-IF USB to JTAG Interface (FT2232) Cable (EXPERIMENTAL)
gpio GPIO JTAG Chain
ICE-100B Analog Devices ICE-X Cable (0x064B)
IGLOO Excelpoint IGLOO JTAG Cable
jlink Segger/IAR J-Link, Atmel SAM-ICE and others.
KeithKoep Keith & Koep JTAG cable
Lattice Lattice Parallel Port JTAG Cable
Minimal Minimal Parallel Port JTAG Cable
MPCBDM Mpcbdm JTAG cable
TRITON Ka-Ro TRITON Starterkit II (PXA255/250) JTAG Cable
UsbBlaster Altera USB-Blaster Cable
vsllink Versaloon Link -- http://www.versaloon.com.
WIGGLER Macraigor Wiggler JTAG Cable
WIGGLER2 Modified (with CPU Reset) WIGGLER JTAG Cable
xpc_ext Xilinx Platform Cable USB external chain
xpc_int Xilinx Platform Cable USB internal chain
UrJTAG поддерживает исполнение команд из файла. Для этого создаем файл с перечнем команд…
- cmd.txt
cable ft2232 vid=0x0403 pid=0x6010
endian big
detect
discovery
…и запускаем UrJTAG с параметром.
- urjtag.cmd
SET PATH=%PATH%;d:\cygwin\bin
jtag.exe cmd.txt
Также полезен вывод результата в файл, например, при поиске инструкций/регистров.
- urjtag.cmd
SET PATH=%PATH%;d:\cygwin\bin
jtag.exe cmd.txt > cmd.log
Резервные копии исходников, библиотек, а также готовые бинарники можно загрузить из файлового архива.