LoginSignup
0
0

More than 1 year has passed since last update.

FreeBSDのurjtagでFTDIモジュールを使う

Last updated at Posted at 2021-10-20

普段はMacで使っているurjtagですが、今手元にMacがないのでFreeBSDで試してみました。urjtagはpkgにあるので、installしてみます。

% jtag

UrJTAG 2021.03 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> 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
gpio         GPIO JTAG Chain
bsdgpio      BSD GPIO JTAG Chain
IGLOO        Excelpoint IGLOO JTAG Cable
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
WIGGLER      Macraigor Wiggler JTAG Cable
WIGGLER2     Modified (with CPU Reset) WIGGLER JTAG Cable
error: syntax: cable: #parameters should be >= 2, not 1
jtag> 

なんとびっくりFTDIのサポートが入っていないバイナリです。あちゃくせ(庄内弁)ごとにlibftdiのpkgは依存で入ります。余談ですが私が入れてもらったbsdgpioは入ってます。bsdgpioはMIPS SOCのGPIOで使えるようにしたものです。

しかたないので自力でビルドしてみます。

% setenv CFLAGS "-I/usr/local/include/libftdi1 -I/usr/local/include"
% setenv LDFLAGS "-L/usr/local/lib -lftdi1"
% ./configure --disable-python

...

urjtag is now configured for

  Libraries:
    libusb     : no
    libftdi    : yes (have async mode)
    libftd2xx  : no
    inpout32   : no

  Subsystems:
    SVF        : yes
    BSDL       : yes
    STAPL      : no

  Drivers:
    Bus        : ahbjtag arm9tdmi au1500 avr32 bcm1250 blackfin bscoach ejtag ejtag_dma fjmem ixp425 ixp435 ixp465 jopcyc h7202 lh7a400 mpc5200 mpc824x mpc8313 mpc837x ppc405ep ppc440gx_ebc8 prototype pxa2x0 pxa27x s3c4510 sa1110 sh7727 sh7750r sh7751r sharc_21065L sharc_21369_ezkit slsup3 tx4925 zefant_xs3 
    Cable      : arcom byteblaster dlc5 ea253 ei012 ft2232 gpio bsdgpio igloo keithkoep lattice mpcbdm triton usbblaster wiggler 
    Lowlevel   : ftdi ppi 

  Language bindings:
    python     : no

% make

...

% ./src/apps/jtag/jtag 

UrJTAG 2021.03 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> 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
JTAGv3          XDS100 compatible JTAG/serial (FT2232) Cable
JTAGv5          XDS100v2 compatible JTAG/serial (FT2232H) 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)
DigilentHS1     Digilent HS1 Adapter
FT4232          Generic FTDI FT4232 Cable
gpio            GPIO JTAG Chain
bsdgpio         BSD GPIO JTAG Chain
IGLOO           Excelpoint IGLOO JTAG Cable
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
WIGGLER         Macraigor Wiggler JTAG Cable
WIGGLER2        Modified (with CPU Reset) WIGGLER JTAG Cable
error: syntax: cable: #parameters should be >= 2, not 1

FTDIなしのurjtagはクリープをいれないコーヒーなので、だれかportsにフィードバックしてください。

使うときはsudoでコマンドを上げてvidとpidを指定しないとダメみたいです。

jtag> cable ft2232 vid=0x0403 pid=0x6010
Connected to libftdi driver.

ちなみに実際に使うときは、uftdi.koがロードされると使えなくなるので、devdをkillしてからUSBを接続します。なんかもっとスマートな方法ないのかしら。

デバイスHACKでurjtagと同じくらい重宝しているflashromもpkgがありますが、こちらはFTDIがデフォルトOFFです。flashromでFTDIモジュールを使いたい場合はportsでオプションONでビルドしてインストールしてください。

urjtagはFT2232DなどのMPSSEが使えるすべてのモジュールで使えますが、flashromは232HなどのHi SpeedなMPSSEモジュールでしか使えません。

MAX IIを焼いてみた

BSDLファイルから設定ファイルを作りQuartusで作ったsvfファイルをUsbBlasterで焼いてみました。

% sudo ./src/apps/jtag/jtag

UrJTAG 2021.03 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> cable UsbBlaster
Connected to libftdi driver.
jtag> detect
IR length: 10
Chain length: 1
Device Id: 00000010000010100001000011011101 (0x020A10DD)
  Manufacturer: Altera (0x0DD)
  Part(0):      EPM240 (0x20A1)
  Stepping:     0
  Filename:     /usr/local/share/urjtag/altera/epm240/epm240
jtag> svf test2.svf stop progress
warning: USB-Blaster frequency is fixed to 12000000 Hz
warning: unimplemented mode 'ABSENT' for TRST
detail: Parsing  11640/11645 ( 99%)detail: 
detail: Scanned device output matched expected TDO values.
jtag> quit
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0