espressif/esp-usb-bridge

i have no idea what i'm doing (EUB-43)

jschoch opened this issue · 1 comments

I've tried cmsis-dap on a bluepill but while that sort of works the esp32 branch of openocd doesn't support HIDAPI, and while I can recompile it it lives in strange msys2 mingw32 land and does't seem to run anywhere else. I thought maybe this wouldn't matter since openoce 0.12.1 says it supports esp32, but it only supports connecting to it and flash apprently doesn't work.

I also tried to get an MCU-Link working and that could connect to a remote debugging gdb setup but no within platformio.

Finally I tried to get this bridge to work but I have no idea how to configure the "options" or what they do, or what is the minimum configuration required to get something working. After many many hours I can get it to connect but I can't get it to flash and i'm out of ideas as to how to actually debug an esp32 in platformio without manually running CLI outside of the environement.

this is the strange and garbled output i get

<lambda>(["upload"], [".pio\build\az-delivery-devkit-v4\firmware.bin"])
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-bridge
openocd -d2 -s C:/Users/jesse/.platformio/packages/tool-openocd-esp32/share/openocd/scripts -f interface/esp_usb_bridge.cfg -f board/esp-wroom-32.cfg -c "adapter speed 500" -c "program_esp {{.pio\build\az-delivery-devkit-v4\firmware.bin}} 0x10000 verify" -c "program_esp {{C:/Users/jesse/DocumentError: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
s/PlatformIO/Projects/test_usb_bridge/.pio/build/az-delivery-devkit-v4/bootloader.bin}} 0x1000 verify" -c "program_esp {{C:/Users/Info : esp_usb_jtag: serial (84F703C02438)
jesse/Documents/PlatformIO/Projects/test_usb_bridge/.pio/bInfo : esp_usb_jtag: Device found. Base speed 4800KHz, div range 1 to 1
uild/az-delivery-devkit-v4/partitions.bin}} 0x8000 verify" -c "program_esp {Info : clock speed 4800 kHz
{C:/Users/jesse/.platformioInfo : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
/pacInfo : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
kages/framework-arduinoespressif3Info : [esp32.cpu0] Debug controller was reset.
2/toInfo : [esp32.cpu0] Core was reset.
ols/partitions/boot_app0.bin}} 0xe000 verify" -cInfo : [esp32.cpu1] Debug controller was reset.
 "rInfo : [esp32.cpu1] Core was reset.
eset run; shutdown"
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
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] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Target halted, PC=0x400F07D6, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : [esp32.cpu1] Target halted, PC=0x400F07D6, debug_reason=00000000
Info : [esp32.cpu0] Core was reset.
Error: [esp32.cpu0] DSR (8020C413) indicates DIR instruction generated an exception!
Info : [esp32.cpu0] Target halted, PC=0x40007406, debug_reason=00000000
Info : [esp32.cpu1] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Core was reset.
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : [esp32.cpu0] Failed writing 512 bytes at address 0x40090400
Error: Failed to write stub section!
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : [esp32.cpu0] Failed writing 512 bytes at address 0x40091600
Error: Failed to write stub section!
Error: Failed to get flash size!
Info : [esp32.cpu0] Target halted, PC=0x4000C02B, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 0 KB
Info : Using flash bank 'esp32.cpu0.flash' size 0 KB
Info : [esp32.cpu0] Target halted, PC=0x4000C02B, debug_reason=00000001
Error: Failed to get flash maps (5)!
Warn : Failed to get flash mappings (-4)!
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Info : [esp32.cpu0] Target halted, PC=0x4000C02B, debug_reason=00000003
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Info : [esp32.cpu0] Target halted, PC=0x4000C02B, debug_reason=00000000
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 0 KB
Info : Using flash bank 'esp32.cpu1.flash' size 0 KB
** Programming Started **
Error: [esp32.cpu0] DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : [esp32.cpu0] Failed writing 512 bytes at address 0x40090200
Error: Failed to write stub section!
Info : [esp32.cpu0] Target halted, PC=0x4000C02B, debug_reason=00000001
Error: Failed to get flash maps (5)!
Warn : Failed to get flash mappings (-4)!
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : Using flash bank 'esp32.cpu1.irom' size 0 KB
Info : [esp32.cpu0] Target halted, PC=0x4000C02B, debug_reason=00000001
Error: Failed to get flash maps (5)!
Warn : Failed to get flash mappings (-4)!
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Error: Failed to get flash size!
Info : Using flash bank 'esp32.cpu1.drom' size 0 KB
Error: Bank is invalid
embedded:startup.tcl:1184: Error: ** Programming Failed **
in procedure 'program_esp' 
in procedure 'program_error' called at file "C:/Users/jesse/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 171
at file "embedded:startup.tcl", line 1184
*** [upload] Error 1

my sketch

#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

int foo = 0;
int bar = 0;
void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("foo");
  delay(1000);
  foo++;
}

my platformio.ini


[env:az-delivery-devkit-v4]
platform = espressif33
;board = az-delivery-devkit-v4
board = esp32dev
framework = arduino
debug_tool = esp-bridge 
upload_protocol = esp-bridge
debug_speed = 500
;board_openocd_board = "esp32.cfg"
debug_init_cmds =
  show remotetimeout
  target extended-remote $DEBUG_PORT
  set remotetimeout 3000
  $INIT_BREAK
  monitor reset halt
  $LOAD_CMDS
  ;gdb_memory_map disable
  monitor init
  monitor reset halt


[env:env_remote]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
monitor_speed = 115200
debug_server = 
debug_tool = custom
;debug_tool = esp-bridge
debug_port = localhost:3333
build_type = debug
debug_init_break = tbreak setup
debug_init_cmds =
  ;gdb_memory_map disable
  show remotetimeout
  target extended-remote $DEBUG_PORT
  set remotetimeout 3000
  $INIT_BREAK
  monitor reset halt
  $LOAD_CMDS
  monitor init
  monitor reset halt






[env:env2]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
monitor_speed = 115200
;debug_tool = esp-bridge 
;upload_protocol = esp-bridge

it is a shame pyocd doesn't work. that software doesn't make me want to scratch my eyes out like openocd does.

I'm sorry but I haven't seen this error before and also I haven't tried this project with platformio.

You can find how to make it work here: https://github.com/espressif/esp-usb-bridge#jtag-bridge. If you are interested in the content of esp32-bridge.cfg then you can find it under share/openocd/scripts/board/esp32-bridge.cfg in the openocd installation.

With all due respect, I'm closing this because this is unsupported and the reported issue is not with the esp-usb-bridge.