"Cannot execute this command without a live selected thread" using OpenOCD via JTAG on the ESP32 WROVER KIT

orcema
Posts: 2
Joined: Wed Sep 07, 2016 8:38 pm

"Cannot execute this command without a live selected thread" using OpenOCD via JTAG on the ESP32 WROVER KIT

Postby orcema » Sat Aug 19, 2017 1:26 am

Did someone succeed using OpenOCD via JTAG on the ESP32 WROVER KIT ? Debugging doesn't work for me and i get
"Cannot execute this command without a live selected thread". What does it mean? what should i do ?

Here below a description launching debug session in console on windows 10

Launching OpenOCD :

Code: Select all

Open On-Chip Debugger 0.10.0-dev-ga859564 (2017-07-24-16:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
force hard breakpoints
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
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 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : accepting 'gdb' connection on tcp/3333
Info : Target halted. PRO_CPU: PC=0x400D9B04 (active)    APP_CPU: PC=0x00000000
esp32: target state: halted
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active)    APP_CPU: PC=0x00000000
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Set current thread to 0x00000000, old= 0x00000000
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around
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 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active)    APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active)    APP_CPU: PC=0x40000400
esp32: target state: halted
Info : Target halted. PRO_CPU: PC=0x400DCA23 (active)    APP_CPU: PC=0x400D9B04
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around

then when i lauch xtensa-esp32-elf-gdb -x gdbinit firmware.elf

Code: Select all

GNU gdb (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 7.10
Copyright (C) 2015 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=i686-host_pc-mingw32 --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 firmware.elf...done.
0x00000000 in ?? ()
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x5000004B (active)    APP_CPU: PC=0x00000000
esp32: target state: halted
esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x40000400 (active)    APP_CPU: PC=0x40000400
esp32: target state: halted
Hardware assisted breakpoint 1 at 0x400dca23: file C:\users\orce\.platformio\packages\framework-arduinoespressif32\cores\esp32\main.cpp, line 24.
0x0:    0x00000000
Target halted. PRO_CPU: PC=0x400DCA23 (active)    APP_CPU: PC=0x400D9B04
[Switching to Thread 1073520888]
(gdb) c
Continuing.
Cannot execute this command without a live selected thread.
(gdb) 
gdbinit file content:

Code: Select all

target remote :3333
mon reset halt
thb app_main
x $a1=0
c
twitter.com/OM_LUXBG

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: "Cannot execute this command without a live selected thread" using OpenOCD via JTAG on the ESP32 WROVER KIT

Postby ESP_krzychb » Sat Aug 19, 2017 6:02 am

The underlying issue seems to be reported much earlier.

Under:
"Launching OpenOCD"
there is
"Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED".

This indicates some problem with USB driver.

Since you are using Windows, I would redo all the steps under http://esp-idf.readthedocs.io/en/latest ... ml#windows

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: "Cannot execute this command without a live selected thread" using OpenOCD via JTAG on the ESP32 WROVER KIT

Postby ESP_igrr » Sat Aug 19, 2017 12:58 pm

Also, openocd / gdb can be instructed to produce logs more useful for debugging... please follow the instructions here:

http://esp-idf.readthedocs.io/en/latest ... penocd-gdb

and ideally raise this issue in openocd-esp32 issue tracker.

Even though you get an error from libusb, subsequent logs indicate that communication with the target is indeed taking place, so the problem is likely in openocd-esp32 or in the way it interacts with GDB.


Edit, ah, i see, .platformio\packages\framework-arduinoespressif32'. You'll have to raise this issue to platformio folks, they need to update the linker flags to match those used in ESP-IDF. Currently they seem to be missing at least '-u uxTopUsedPriority', which is what openocd-esp32 complains about when it says "Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around"

orcema
Posts: 2
Joined: Wed Sep 07, 2016 8:38 pm

Re: "Cannot execute this command without a live selected thread" using OpenOCD via JTAG on the ESP32 WROVER KIT

Postby orcema » Sun Aug 20, 2017 12:36 am

Thanks for all the replies, it's indeed an "Arduino IDE" issue according to the one raised in https://github.com/espressif/openocd-esp32/issues/12
I tried an sample code using the "ESP-IDF" and debugging works like a charm :D

OpenOCD:

Code: Select all

C:\Espressif\debugging\OpenOCD>cd C:\Espressif\debugging\OpenOCD\openocd-esp32

C:\Espressif\debugging\OpenOCD\openocd-esp32>bin\openocd -s share\openocd\scripts -f interface\ftdi\esp32_devkitj_v1.cfg -f board\esp-wroom-32.cfg
Open On-Chip Debugger 0.10.0-dev-ga859564 (2017-07-24-16:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
force hard breakpoints
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
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 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : accepting 'gdb' connection on tcp/3333
Info : Target halted. PRO_CPU: PC=0x400D1A6C (active)    APP_CPU: PC=0x00000000
esp32: target state: halted
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active)    APP_CPU: PC=0x00000000
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Set current thread to 0x00000000, old= 0x00000000
Error: FreeRTOS maximum used priority is unreasonably big, not proceeding: 1061168112
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 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active)    APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active)    APP_CPU: PC=0x40000400
esp32: target state: halted
Error: cpu0: esp32_fetch_all_regs (line 234): DSR (8011CC13) indicates DIR instruction generated an exception!
Info : Target halted. PRO_CPU: PC=0x400D0850 (active)    APP_CPU: PC=0x400D0E3D
GDB:

Code: Select all

C:\Espressif\debugging\OpenOCD>C:\Users\orce\.platformio\packages\toolchain-xtensa32\bin\xtensa-esp32-elf-gdb -x gdbinit D:\DefaultInstall\UserData\workspace_eclipse\Platformio\arduino-wifiscan-esp32\.pioenvs\esp32dev_idf\firmware.elf
GNU gdb (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 7.10
Copyright (C) 2015 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=i686-host_pc-mingw32 --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 D:\DefaultInstall\UserData\workspace_eclipse\Platformio\arduino-wifiscan-esp32\.pioenvs\esp32dev_idf\firmware.elf...done.
0x00000000 in ?? ()
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x5000004B (active)    APP_CPU: PC=0x00000000
esp32: target state: halted
esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x40000400 (active)    APP_CPU: PC=0x40000400
esp32: target state: halted
Hardware assisted breakpoint 1 at 0x400d0850: file src\main.c, line 220.
0x0:    0x00000000
cpu0: esp32_fetch_all_regs (line 234): DSR (8011CC13) indicates DIR instruction generated an exception!
Target halted. PRO_CPU: PC=0x400D0850 (active)    APP_CPU: PC=0x400D0E3D
[New Thread 1073507816]
[New Thread 1073506424]
[New Thread 1073499348]
[New Thread 1073510476]
[New Thread 1073497872]
[New Thread 1073500484]
[Switching to Thread 1073505032]

Temporary breakpoint 1, app_main () at src\main.c:220
220     {
(gdb)
twitter.com/OM_LUXBG

User avatar
regandgo
Posts: 6
Joined: Sun Jun 18, 2017 7:54 am

Re: "Cannot execute this command without a live selected thread" using OpenOCD via JTAG on the ESP32 WROVER KIT

Postby regandgo » Sun Oct 22, 2017 7:11 pm

Hi!
This solution, and all the others I have managed to find on the NET did not work for me.
After several days of investigation, I have find the way to make the debugger working.
The solution was simple - Reduce the JTAG clock in the esp-wroom-32.cfg file.
In my case 5MHz was fine: "adapter_khz 5000"
(I am using J-Link usb adapter on PC with Windows )

In a hope that it could be useful for someone, I am sharing my 2 pair of logs.
One pair of logs is original configuration with "Cannot execute this command without a live selected thread." Bug
OpenOCD NOK log: https://pastebin.com/WDiewFu3
GDB NOK log: https://pastebin.com/SCuEa4WS

And this one with a modified esp-wroom-32.cfg.
OpenOCD OK log: https://pastebin.com/ymRQiB63
GDB OK log: https://pastebin.com/0q0HsNN0

Regards,
Sasha

Who is online

Users browsing this forum: No registered users and 101 guests