chakokuのブログ(rev4)

テック・コミック・ごくまれにチャリ

RaspberryPiをJTAGアダプタに仕立てる

手持ちの古いJTAGアダプタ(乗ってるチップはFT2232R)がどうもうまく制御できない*1ので、、RaspberryPiをJTAGアダプタに仕立ててみる。

以下が手順解説資料
Using a Raspberry Pi as a JTAG Dongle · synthetos/PiOCD Wiki · GitHub

段々と泥沼化だ。。

bootstrap コマンドを実行した後、configureを行う(作業はラズパイ上)。

 ./configure --enable-sysfsgpio  --enable-maintainer-mode   --disable-werror   --enable-ft2232_libftdi   --enable-ep93xx   --enable-at91rm9200   --enable-usbprog   --enable-presto_libftdi   --enable-jlink   --enable-vsllink   --enable-rlink   --enable-arm-jtag-ew   --enable-dummy   --enable-buspirate   --enable-ulink   --enable-presto_libftdi   --enable-usb_blaster_libftdi   --enable-ft2232_libftdi  --prefix=/usr/local

*略*

checking for LIBUSB1... no
configure: WARNING: libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead
checking for LIBUSB0... yes
checking for HIDAPI... no
checking for HIDAPI... no
checking for HIDAPI... no
checking for LIBFTDI... no
checking for LIBFTDI... yes
checking for LIBGPIOD... no
checking for LIBJAYLINK... no
configure: error: libusb-1.x is required for the Keil ULINK JTAG Programmer
root@raspberrypi:/usr/local/openocd-git#

Keil ULINK JTAG Programmerが、libusb-1.xを必要としているとのエラー
GitHubのReadmeによると、libusb-1.0はlibftdi-devに同梱されているからエラー出てもOK!ですと?

Note: usbprog and rlink require the older libusb-0.1 (libftdi-dev contains libusb-1.0)

make自体できないので、素直にlibusb-1.0-0-devを入れてみる*2

# apt-get install libusb-1.0-0-dev

configureでESP32のデバイスを有効化していないので、ターゲットとしてESP32を指定するとエラーになるのでは?と想像される。。*3

configureコマンドが正常に終了したのでmakeを行う。。 
makeが通ったのでmake installして、raspberry自体をinterfaceとして使用するための設定を入手する

# pwd
/usr/local/share/openocd/scripts/board

# wget https://gist.github.com/giseburt/e832ed40e3c77fcf7533/raw/e8c71233970e4d42eed7c3bf4b13390cdcf2a1fd/raspberrypi-due.tcl

ターゲット(ESP32)と接続していない状態だけど、起動してみる。DAPって何か分からんが、応答がないと怒られる。その前にもJTAG関連のチェックで異常を検知して、Bypassing JTAG setup となっているのだが。。

root@raspberrypi:/usr/local/share/openocd/scripts/board# /usr/local/bin/openocd -f raspberrypi-due.tcl
Open On-Chip Debugger 0.10.0+dev-01383-gd46f28c2e-dirty (2020-08-28-21:26)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : SysfsGPIO JTAG/SWD bitbang driver
Info : This adapter doesn't support configurable speed
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: sam3.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (0) in DAP response
Error: Invalid ACK (0) in DAP response
Error: Invalid ACK (0) in DAP response

OpenOCDが動く状態のRaspberryPiZeroとESP32を接続

ESP32と接続して通信させてみると、 sam3.cpu を期待したのに、0x120034e5が返ってきたと怒られた。ボードとは通信できているようである。

sumi@raspberrypi:/usr/local/share/openocd/scripts/board$ sudo /usr/local/bin/ope
nocd  -f raspberrypi-due.tcl
Open On-Chip Debugger 0.10.0+dev-01383-gd46f28c2e-dirty (2020-08-28-21:26)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : SysfsGPIO JTAG/SWD bitbang driver
Info : This adapter doesn't support configurable speed
Info : JTAG tap: sam3.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Warn : JTAG tap: sam3.cpu       UNEXPECTED: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: JTAG tap: sam3.cpu  expected 1 of 1: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: auto0.tap tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: Trying to use configured scan chain anyway...
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0x120034e5"
Error: auto0.tap: IR capture error; saw 0x0002 not 0x0001
Warn : Bypassing JTAG setup events due to errors

解説記事のままに読み込ませているファイル(raspberrypi-due.tcl)がtargetとしてsam3を指定している。これをESP32に変えてみる。

source [find interface/sysfsgpio-raspberrypi.cfg]
set _CHIPNAME sam3

source [find target/at91sam3ax_8x.cfg]
$_TARGETNAME configure -event gdb-attach { reset init }

ESP32版OpenOCDからESP32用のConfigを取ってきて指定する。。予想通りESP32は知らんと怒られる。

$ /usr/local/bin/openocd -f board/esp-wroom-32.cfg
Open On-Chip Debugger 0.10.0+dev-01383-gd46f28c2e-dirty (2020-08-28-21:26)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter speed' not 'adapter_khz'
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
target/esp32.cfg:82: Error: Unknown target type esp32, try one of arm7tdmi, arm9tdmi, arm920t, arm720t, arm966e, arm946e, arm926ejs, fa526, feroceon, dragonite, xscale, cortex_m, cortex_a, cortex_r4, arm11, ls1_sap, mips_m4k, avr, dsp563xx, dsp5680xx, testee, avr32_ap7k, hla_target, nds32_v2, nds32_v3, nds32_v3m, or1k, quark_x10xx, quark_d20xx, stm8, riscv, mem_ap, esirisc, arcv2, aarch64,  or mips_mips64
in procedure 'script'
at file "embedded:startup.tcl", line 26
at file "board/esp-wroom-32.cfg", line 63
at file "target/esp32.cfg", line 82

素でビルドしただけではESP32は対象外なのであった。
OpenOCD User’s Guide: CPU Configuration
となると、、espressifが提供しているESP32ポーティング版OpenOCDをビルドする必要がある。以下のGitHubにESP32版OpenOCDソースが置かれているので、これを上記手順と同様に取ってきてビルドすることになると思われる
GitHub - espressif/openocd-esp32: OpenOCD branch with ESP32 JTAG support

ESP32用ブランチのOpenOCDを取ってきてビルドしてみる(作業はラズパイ上)

git clone --recursive https://github.com/espressif/openocd-esp32 openocd-esp32-git
cd openocd-esp32-git
./bootstrap

ESP32の公式サイトでもOpenOCDのビルド手順を説明していて、公式版手順ではconfigureコマンド実行時は何もDefineを追加していない。
Building OpenOCD from Sources for Linux - ESP32 - — ESP-IDF Programming Guide latest documentation

FT2232とか不要だとは思うのだが、、一応前回成功しているオプションを付けてConfigureする。

./configure --enable-sysfsgpio  --enable-maintainer-mode   --disable-werror   --enable-ft2232_libftdi   --enable-ep93xx   --enable-at91rm9200   --enable-usbprog   --enable-presto_libftdi   --enable-jlink   --enable-vsllink   --enable-rlink   --enable-arm-jtag-ew   --enable-dummy   --enable-buspirate   --enable-ulink   --enable-presto_libftdi   --enable-usb_blaster_libftdi   --enable-ft2232_libftdi  --prefix=/usr/local

前回の普通版OpenOCDに上書きされてしまうが、、まぁmake installもしてしまう。

make
make install

再度、raspberrypi-due.tclをGitから落としてきて、ESP32ブランチ版OpenOCDで繋いでみる。ターゲットをesp32に変更していないので、以下のエラーとなる。

# /usr/local/bin/openocd -f raspberrypi-due.tcl
Open On-Chip Debugger  v0.10.0-esp32-20200526-14-g18fd8ac8 (2020-08-29-12:32)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : SysfsGPIO JTAG/SWD bitbang driver
Info : JTAG and SWD modes enabled
Warn : gpio 11 is already exported
Warn : gpio 25 is already exported
Info : This adapter doesn't support configurable speed
Info : JTAG tap: sam3.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Warn : JTAG tap: sam3.cpu       UNEXPECTED: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: JTAG tap: sam3.cpu  expected 1 of 1: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: auto0.tap tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: Trying to use configured scan chain anyway...
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0x120034e5"
Error: auto0.tap: IR capture error; saw 0x0002 not 0x0001
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (4) in DAP response
Error: Invalid ACK (4) in DAP response

ターゲットをesp32に修正して再度OpenOCDを起動、ESP32と接続できたようだ。

# /usr/local/bin/openocd -f raspberrypi-esp32.tcl
Open On-Chip Debugger  v0.10.0-esp32-20200526-14-g18fd8ac8 (2020-08-29-12:32)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : FreeRTOS creation
Info : FreeRTOS creation
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : SysfsGPIO JTAG/SWD bitbang driver
Info : JTAG and SWD modes enabled
Warn : gpio 11 is already exported
Warn : gpio 25 is already exported
Info : This adapter doesn't support configurable speed
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : Listening on port 3333 for gdb connections
Info : esp32.cpu0: Target halted, PC=0x400DB545, debug_reason=00000001
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x4011DE22, debug_reason=00000000

接続前はPrint文を繰り返していたが、接続された時点でESP32の動きが止まった

I (445) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (479) BTDM_INIT: BT controller compile version [270f54d]
I (489) system_api: Base MAC address is not set
I (489) system_api: read default base MAC address from EFUSE
I (589) phy: phy_version: 4370, 4e803b3, Aug 11 2020, 14:18:07, 0, 0
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
Setting breakpoint at 0x400db545 and returning...

gdbからOpenOCDに接続してみる。OpenOCD側で少しメッセージが出るのだが、gdb側ではRemote 'g' packet reply is too longとエラーになる。gdb側でターゲット(CPU種別)を指定しないといけないようである。

$ gdb
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) set debug remote 1
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+#df...Ack
Packet received: PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read-;qXfer:threads:read+;QStartNoAckMode+;vContSupported+
Packet qSupported (supported-packets) is supported
Sending packet: $vMustReplyEmpty#3a...Ack
Packet received:
Sending packet: $QStartNoAckMode#b0...Ack
Packet received: OK
Sending packet: $Hg0#df...Packet received: OK
Sending packet: $qTStatus#49...Packet received:
Packet qTStatus (trace-status) is NOT supported
Sending packet: $?#3f...Packet received: S05
Sending packet: $qXfer:threads:read::0,1000#92...Packet received: l<?xml version="1.0"?>\n<threads>\n</threads>\n
Sending packet: $Hc-1#09...Packet received: OK
Sending packet: $qC#b4...Packet received: QC0000000000000000
Sending packet: $qAttached#8f...Packet received: 1
Packet qAttached (query-attached) is supported
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
Sending packet: $g#67...Packet received: 45b50d4045b50d40b0b8fb3f5831fc3f3063fb3fc2d9088030b7fb3f0000000045b50d4003000000140000000300000023060600010000000100000000000000e8d9fb3f90b9fb3f70b9fb3f000000000100000064d80880d0b6fb3f0a00000000b7fb3f01000000f0b6fb3f3463fb3f640000000100000001000000000010200000006050b9fb3f20b9fb3f04100000640000000100000000000000d85f0d403463fb3ff1c00d80f0b8fb3f041000009080f43fe0630d4004100000a440403f0000000000000000f0b8fb3f5831fc3f00180000a4d5fb3f00000000000000001448403f1700000045b50500ffff0100230606009ddc088050b7fb3fc0b7fb3f[328 bytes omitted]
Remote 'g' packet reply is too long (expected 168 bytes, got 420 bytes): 45b50d4045b50d40b0b8fb3f5831fc3f3063fb3fc2d9088030b7fb3f0000000045b50d4003000000140000000300000023060600010000000100000000000000e8d9fb3f90b9fb3f70b9fb3f000000000100000064d80880d0b6fb3f0a00000000b7fb3f01000000f0b6fb3f3463fb3f640000000100000001000000000010200000006050b9fb3f20b9fb3f04100000640000000100000000000000d85f0d403463fb3ff1c00d80f0b8fb3f041000009080f43fe0630d4004100000a440403f0000000000000000f0b8fb3f5831fc3f00180000a4d5fb3f00000000000000001448403f1700000045b50500ffff0100230606009ddc088050b7fb3fc0b7fb3f94dcfb3fe0c20040f6c20040ffffffff200000000a0000000004000045b50d4096fec51c20060600a803fb3f00000000ffff3fb300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000

OpenOCD側のメッセージ

Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 314 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 314 KB
Info : Using flash bank 'esp32.cpu0.irom' size 316 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 314 KB
Info : Using flash bank 'esp32.cpu0.drom' size 48 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Info : dropped 'gdb' connection

OpenOCDはtelnetでも操作できるので、コマンドを叩いてみる

$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger

> reg
===== Xtensa registers
(0) pc (/32): 0x4011DE22
(1) ar0 (/32): 0x800F8F0E
(2) ar1 (/32): 0x3FFBC510
(3) ar2 (/32): 0x3FFC3158
(4) ar3 (/32): 0x3FFBC530
(5) ar4 (/32): 0x00000014
(6) ar5 (/32): 0x000000A5
(7) ar6 (/32): 0x000000A5
(8) ar7 (/32): 0x00060023
(9) ar8 (/32): 0x8008E358
(10) ar9 (/32): 0x3FFBC500

OpenOCDとESP32間は接続できているようだ。なぜかgdbから繋ぐとおかしい

esp32用にポーティングされたgdbもあるのでそれを使ってみる

$ export IDF_TOOLS_PATH=/usr/local/esp/esp-idf/
$  . /usr/local/esp/esp-idf/export.sh
$ idf.py gdb

するとpython2.7のライブラリが無いと怒られる。gdbPythonのライブラリが必要なのか??というのはさておき

xtensa-esp32-elf-gdb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

libpython2.7を入れろという記事があってそれに従う。

 apt-get install libpython2.7

以下はWSLでインストールしたUbuntuで実行

$ cat build/gdbinit
target remote 192.168.11.8:3333
symbol-file /home/<user_name>/lang/c/esp32/sample/ble_midi/build/blemidi.elf
mon reset halt
flushregs
thb app_main
c

$ xtensa-esp32-elf-gdb -x build/gdbinit build/blemidi.elf              

ターゲットと接続できたものの、実行させるとSIGTRAPを受けて停止する。

(gdb) c
Continuing.
Sending packet: $Z1,400d63d4,2#0e...Packet received: OK
Packet Z1 (hardware-breakpoint) is supported
Sending packet: $vCont?#49...Packet received: vCont;c;C;s;S
Packet vCont (verbose-resume) is supported
Sending packet: $vCont;c#a8...Packet received: O65737033322e637075303a205461726765742068616c7465642c2050433d307834303044423534352c2064656275675f726561736f6e3d30303030303030310a
esp32.cpu0: Target halted, PC=0x400DB545, debug_reason=00000001
Packet received: O536574204744422074617267657420746f202765737033322e63707530270a
Set GDB target to 'esp32.cpu0'
Packet received: O65737033322e637075313a205461726765742068616c7465642c2050433d307834303131444532322c2064656275675f726561736f6e3d30303030303030300a
esp32.cpu1: Target halted, PC=0x4011DE22, debug_reason=00000000
Packet received: T05thread:0;
Sending packet: $g#67...Packet received: 45b50d400100000000000000d85f0d403463fb3ff1c00d80f0b8fb3f0410000020b9fb3fe0630d4004100000a440403f0000000000000000f0b8fb3f5831fc3f00180000a4d5fb3f00000000000000001448403f1700000045b50500ffff0100230d06009ddc088050b7fb3fc0b7fb3f94dcfb3f45b50d40b0b8fb3f5831fc3f3063fb3fc2d9088030b7fb3f0000000045b50d40030000001400000003000000230d0600010000000100000000000000e8d9fb3f90b9fb3f70b9fb3f000000000100000064d80880d0b6fb3f0a00000000b7fb3f01000000f0b6fb3f3463fb3f640000000100000001000000000010200000006050b9fb3f20b9fb3f04100000
Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<?xml version="1.0"?>\n<threads>\n</threads>\n

Program received signal SIGTRAP, Trace/breakpoint trap.
Sending packet: $z1,400d63d4,2#2e...Packet received: OK
0x400db545 in ble_gap_preempt_no_lock ()
    at /usr/local/esp/esp-idf/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:5585
5585            ble_gap_master.preempted_op = BLE_GAP_OP_M_DISC;
(gdb)

OpenOCDの表示は以下
デバッグ対象はcpu0ではないのか?? なぜに?

Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400DB545, debug_reason=00000001
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x4011DE22, debug_reason=00000000
Error: Too large number of threads 1073492728!

HelloWoldのような簡単なテストプログラムでも同様にSIGTRAPを発行して止まってしまう。なぜだろうか。

Program received signal SIGTRAP, Trace/breakpoint trap.
0x400db545 in _vfiprintf_r (data=<optimized out>, fp=<optimized out>, fmt0=<optimized out>, ap=...)
    at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:1584
1584    /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c: No such file or directory.
(gdb) backtrace
#0  0x400db545 in _vfiprintf_r (data=<optimized out>, fp=<optimized out>, fmt0=<optimized out>, ap=...)
    at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:1584
#1  0x400dc0f1 in _vfprintf_r (data=0x0, fp=0x0, fmt0=0x1 "", ap=...)
    at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:853
#2  0x400d61dd in get_arg (n=1074618328, fmt=0x1004 "", ap=0x1, numargs_p=0x3ffb6334, args=0x400d5fd8 <cleanup_glue>,
    arg_type=0x3f403fdc <soc_memory_types+120>, last_fmt=0x1, data=<optimized out>)
    at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:2105
#3  0x400d619b in snprintf (str=<optimized out>, size=<optimized out>, fmt=0x1 "")
    at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/snprintf.c:90
#4  0x4008e10b in ?? ()
#5  0x4008e078 in ?? ()

*1:パラメータ設定の問題と分かって使えるようになった

*2:JTAGの信号出力はGPIOを使うのでUSBドライバ不要と思うのだが、、なぜに? FT2232使ってないのに、--enable-ft2232_libftdi とか必要なのか??

*3:ESP32の解説サイトでは、ソースからビルドしたかったら、 git clone --recursive https://github.com/espressif/openocd-esp32.git しろとある。ESP32用にブランチというのか、ポーティングされたOpenOCDがあるようだ