Linux/OpenOCD debugging with ESP-PROG - problem

lafar6502
Posts: 25
Joined: Fri Mar 27, 2020 8:26 pm

Linux/OpenOCD debugging with ESP-PROG - problem

Postby lafar6502 » Fri Mar 27, 2020 8:36 pm

Hi, i'm trying to use ESP-Prog board for JTAG debugging. Working under Linux/Ubuntu, with ESP-IDF latest (4.1) and ESP toolkit.
my board is ESP32 Wrover
So far i managed to connect the board to ESP-Prog via Jtag and set up usb / ftdi drivers so that openocd can connect. ESP Prog seems to be able to communicate with the board but i'm not able to start a debugging session. Could you help me to move forward? Below i'm including output from OpenOCD and also from the Eclipse debugger session
`Open On-Chip Debugger v0.10.0-esp32-20200309 (2020-03-09-11:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Configured 2 cores
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
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: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : Listening on port 3333 for gdb connections
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
...
Info : esp32: Core 1 was reset.
Info : accepting 'gdb' connection on tcp/3333
Error: No symbols for FreeRTOS
Info : Target halted. CPU0: PC=0x4007A4E9 (active)
Info : Target halted. CPU1: PC=0x400076E0
Error: timed out while waiting for target halted / 4 - 2
Info : cpu0: Target halted, PC=0x40090365, debug_reason=00000000
Error: xtensa_wait_algorithm: not halted 0, pc 0x40090365, ps 0x60025
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
Error: Failed to run flasher stub (-302)!
Warn : Failed to get flash mappings (-302)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Algorithm run failed (-4)!
Error: Failed to run flasher stub (-4)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Algorithm run failed (-4)!
Error: Failed to run flasher stub (-4)!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
`


and on the GDB side / Eclipse:
Error in final launch sequence:

Failed to execute MI command:
-target-select remote localhost:3333

Error message from debugger back end:
Remote replied unexpectedly to 'vMustReplyEmpty': timeout
Failed to execute MI command:
-target-select remote localhost:3333

Error message from debugger back end:
Remote replied unexpectedly to 'vMustReplyEmpty': timeout
Remote replied unexpectedly to 'vMustReplyEmpty': timeout
Unfortunately there are many things i dont understand,dont know and are not familiar with. Got stuck, i dont even know what to ask you about - can you please help me get the debug session to run? Will provide more details but you have to tell me what else to add.
Thanks
RG

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: Linux/OpenOCD debugging with ESP-PROG - problem

Postby ESP_Sprite » Sat Mar 28, 2020 1:03 pm

It looks like your board keeps resetting... can you see if you can flash the blink example over serial, and then see if you still have this issue?

lafar6502
Posts: 25
Joined: Fri Mar 27, 2020 8:26 pm

Re: Linux/OpenOCD debugging with ESP-PROG - problem

Postby lafar6502 » Sat Mar 28, 2020 6:56 pm

    Hi, did a fresh test with blink example, just idf.py build/flash, no eclipse
    This time it did not reset, but still i'm not able to progress much. Maybe i'm missing some gdb configureation?
    Trying to follow exactly the instructions there:
    https://docs.espressif.com/projects/esp ... mmand-line
    The problem is there's some error reported and i have no idea what's going on, messages dont say anything useful to me.


    openocd:
    Open On-Chip Debugger v0.10.0-esp32-20200309 (2020-03-09-11:51)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 20000 kHz

    WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
    Info : Configured 2 cores
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
    Info : clock speed 20000 kHz
    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 : Target halted. CPU0: PC=0x40090365 (active)
    Info : Target halted. CPU1: PC=0x400076DD
    Info : Listening on port 3333 for gdb connections
    Info : accepting 'gdb' connection on tcp/3333
    Error: No symbols for FreeRTOS
    Error: timed out while waiting for target halted / 4 - 2
    Info : cpu0: Target halted, PC=0x4009036A, debug_reason=00000000
    Error: xtensa_wait_algorithm: not halted 0, pc 0x4009036a, ps 0x60025
    Error: Failed to wait algorithm (-302)!
    Error: Algorithm run failed (-302)!
    Error: Failed to run flasher stub (-302)!
    Warn : Failed to get flash mappings (-302)!
    Error: Target is already running an algorithm
    Error: Failed to start algorithm (-4)!
    Error: Algorithm run failed (-4)!
    Error: Failed to run flasher stub (-4)!
    Error: Target is already running an algorithm
    Error: Failed to start algorithm (-4)!
    Error: Algorithm run failed (-4)!
    Error: Failed to run flasher stub (-4)!
    Error: Failed to probe flash, size 0 KB
    Error: auto_probe failed
    Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
    Error: attempted 'gdb' connection rejected
    xtensa-esp32-elf-gdb -x gdbinit build/blink.elf
    GNU gdb (crosstool-NG esp-2019r2) 8.1.0.20180627-git
    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 "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
    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"...
    Reading symbols from build/blink.elf...done.
    Ignoring packet error, continuing...
    warning: unrecognized item "timeout" in "qSupported" response
    Ignoring packet error, continuing...
    gdbinit:1: Error in sourced command file:
    Remote replied unexpectedly to 'vMustReplyEmpty': timeout
    (gdb)
    openocd debug output:

    https://www.codepile.net/pile/761lj3gZ

    lafar6502
    Posts: 25
    Joined: Fri Mar 27, 2020 8:26 pm

    Re: Linux/OpenOCD debugging with ESP-PROG - problem

    Postby lafar6502 » Sun Mar 29, 2020 4:05 pm

    So, nobody knows anything? Without debugging support these boards are almost useless to me. At the moment I own 3 of them - one WROVERIB Devkit C (with openocd problem described above - error 'algorithm run failed), and two NodeMCU ESP32S WROOM clones. These two will not debug as well,

    Is it really working for everyone and just I have all kinds of problems? Or wrong hardware? I even tried with Platformio tools / debugger, but no success. Maybe I'm doing something stupid, but how am i supposed to know why the damned thing will not cooperate? Is there a documentation that shows how to run the simplest debug session properly with ESP-Prog?

    BTW there appears to be some problem with GPIO 12 used for jtag TDI - when it's connected the board's uart interface is not working (i cant flash / upload programs). Have to disconnect GPIO12, then flash, then connect again to try JTAG debugging). Is it suposed to behave this way?

    Open On-Chip Debugger v0.10.0-esp32-20200309 (2020-03-09-11:51)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 20000 kHz

    WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
    Info : Configured 2 cores
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
    Info : clock speed 20000 kHz
    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 : Listening on port 3333 for gdb connections
    Info : accepting 'gdb' connection on tcp/3333
    Error: No symbols for FreeRTOS
    Info : Target halted. CPU0: PC=0x400E2AC2 (active)
    Info : Target halted. CPU1: PC=0x00000000
    Info : cpu0: Debug controller 0 was reset.
    Info : cpu0: Core 0 was reset.
    Info : cpu0: Debug controller 0 was reset.
    Info : cpu0: Core 0 was reset.
    Error: timed out while waiting for target halted / 1 - 2
    Info : cpu0: Target halted, PC=0x400E2AC2, debug_reason=00000000
    Error: xtensa_wait_algorithm: not halted 0, pc 0x400e2ac2, ps 0x60920
    Error: Failed to wait algorithm (-302)!
    Error: Algorithm run failed (-302)!
    Error: Failed to run flasher stub (-302)!
    Warn : Failed to get flash mappings (-302)!
    Error: Target is already running an algorithm
    Error: Failed to start algorithm (-4)!
    Error: Algorithm run failed (-4)!
    Error: Failed to run flasher stub (-4)!
    Error: Target is already running an algorithm
    Error: Failed to start algorithm (-4)!
    Error: Algorithm run failed (-4)!
    Error: Failed to run flasher stub (-4)!
    Error: Failed to probe flash, size 0 KB
    Error: auto_probe failed

    lafar6502
    Posts: 25
    Joined: Fri Mar 27, 2020 8:26 pm

    Re: Linux/OpenOCD debugging with ESP-PROG - problem

    Postby lafar6502 » Sun Mar 29, 2020 7:04 pm

    finally, I made some progress on this...
    At first I did everything on Linux, in Virtualbox VM. Without any success.

    Then had some success with Windows system (no VM) and Platformio libraries - finally managed to connect debugger to one of my nodemcu-esp32s clone boards and it properly stopped in the app_main function. And, the board had to be powered both by its own USB port (in addition to JTAG connection) to work properly - without the extra USB power it kept resetting. One thing to remember

    Openocd distributed with Platformio is
    Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
    so it's different than the one with esp tools.
    Ok, so it appears wiring is correct, the problem might be in the Virtualbox or with specific version of openocd delivered with esp-idf. Will keep testing this and will let you know how it goes with esp-idf tools.

    Who is online

    Users browsing this forum: No registered users and 260 guests