ESP debug adapter question

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

ESP debug adapter question

Postby ndjurov » Thu Dec 02, 2021 12:58 am

I keep trying to successfully configure and run the debugger.
So far I was trying to use the C/C++ extension in launch.json ("cppdbg"), but after many unsuccessful attempts I would like to try the Debug Adapter approach ("espidf").
I run the "Doctor Command" and got the output attached below. It tells me that the Debug Adapter python requirements are not satisfied and it also points me to a command which is supposed to fix it.
I just want to ask you if running this command may affect other esp-idf modules and prevent them from working correctly (as they do now) and if you can see anything else in this log that may prevent the Debug Adapter from working correctly?

Thanks a lot.

"Doctor Command" output:
---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS win32 x64 10.0.17763
System environment variable IDF_PYTHON_ENV_PATH undefined

System environment variable PATH
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;
C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Windows\System32\OpenSSH\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
J:\Mfgsys\System;
C:\Program Files\PuTTY\;
C:\Program Files\dotnet\;
C:\Program Files\Git\cmd;C:\ProgramFiles(x86)\GitExtensions\;
C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts;
C:\ESP-IDF\TOOLS\.espressif\tools\idf-exe\1.0.1\;
C:\ESP-IDF\TOOLS\.espressif\tools\openocd-esp32\v0.10.0-esp32-20211111\openocd-esp32\bin;
C:\Users\ndjur\AppData\Local\Microsoft\WindowsApps;
C:\Users\ndjur\AppData\Local\Programs\Microsoft VS Code\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\xtensa-esp32s2-elf\esp-2020r2-8.2.0\xtensa-esp32s2-elf\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\cmake\3.13.4\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\ninja\1.9.0\;
C:\ESP-IDF\TOOLS\.espressif\tools\ccache\3.7\;
C:\ESP-IDF\IDF\tools;
C:\Users\ndjur\AppData\Local\GitHubDesktop\bin;

System environment variable PYTHON undefined

Visual Studio Code version 1.62.3

Visual Studio Code language en

Visual Studio Code shell C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

ESP-IDF Extension version 1.2.0
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH}

ESP-IDF Path (idf.espIdfPath) c:\ESP-IDF\IDF

ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}

Custom extra paths (idf.customExtraPaths)
C:\ESP-IDF\TOOLS\.espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\xtensa-esp32s2-elf\esp-2020r2-8.2.0\xtensa-esp32s2-elf\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\cmake\3.13.4\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\openocd-esp32\v0.10.0-esp32-20211111\openocd-esp32\bin;
C:\ESP-IDF\TOOLS\.espressif\tools\ninja\1.9.0\;C:\ESP-IDF\TOOLS\.espressif\tools\idf-exe\1.0.1\;
C:\ESP-IDF\TOOLS\.espressif\tools\ccache\3.7\;C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts;
C:\ESP-IDF\IDF\tools

Custom extra vars (idf.customExtraVars) {"OPENOCD_SCRIPTS":"C:/ESP-IDF/TOOLS/.espressif/tools/openocd-esp32/v0.10.0-esp32-20211111/openocd-esp32/share/openocd/scripts"}

Virtual env Python Path (idf.pythonBinPath) C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe

Serial port (idf.port) COM21

OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,board/esp32-wrover.cfg

ESP-IDF Tools Path (idf.toolsPath) c:\ESP-IDF\TOOLS

Git Path (idf.gitPath) git

-------------------------------------------------------- Configurations access -------------------------------------------------------------
Access to ESP-ADF Path (idf.espAdfPath) false
Access to ESP-IDF Path (idf.espIdfPath) true
Access to ESP-MDF Path (idf.espMdfPath) false
Access to ESP-IDF Custom extra paths
Access to C:\ESP-IDF\TOOLS\.espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\bin: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\xtensa-esp32s2-elf\esp-2020r2-8.2.0\xtensa-esp32s2-elf\bin: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\cmake\3.13.4\bin: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\openocd-esp32\v0.10.0-esp32-20211111\openocd-esp32\bin: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\ninja\1.9.0\: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\idf-exe\1.0.1\: true
Access to C:\ESP-IDF\TOOLS\.espressif\tools\ccache\3.7\: true
Access to C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts: true
Access to C:\ESP-IDF\IDF\tools: true
Access to Virtual env Python Path (idf.pythonBinPath) true

Access to CMake in environment PATH undefined

Access to Ninja in environment PATH undefined

Access to ESP-IDF Tools Path (idf.toolsPath) true
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version 2.21.0.windows.1
ESP-IDF version 4.1
Python version 3.9.0
Python's pip version 20.2.4
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
certifi version: 2020.11.8
cffi version: 1.14.3
chardet version: 3.0.4
click version: 7.1.2
cryptography version: 3.2.1
esp-windows-curses version: 0.1
future version: 0.18.2
idna version: 2.10
pip version: 20.2.4
psutil version: 5.7.3
pycparser version: 2.20
pyelftools version: 0.27
pygdbmi version: 0.9.0.2
pyparsing version: 2.3.1
pyserial version: 3.4
requests version: 2.25.0
setuptools version: 50.3.2
six version: 1.15.0
typing version: 3.7.4.3
urllib3 version: 1.26.2
wheel version: 0.35.1
windows-curses version: 2.2.0
xmlrunner version: 1.7.7

---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages Python requirements from c:\ESP-IDF\IDF\requirements.txt are satisfied.

---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages Error

---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages Error

---------------------------------------------------- Visual Studio Code launch.json --------------------------------------------------------
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "EIM Debug",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}/build",
"program": "${workspaceFolder}/build/EIMCtrl.elf",
"miDebuggerPath": "C:/ESP-IDF/TOOLS/.espressif/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb.exe",
"externalConsole": true,
"logging": {
"engineLogging": true
},
"setupCommands": [
{ "text": "target remote localhost:3333" },
{ "text": "set remote hardware-watchpoint-limit 2" },
{ "text": "monitor reset halt" },
{ "text": "flushregs" }
]

}
]
}
---------------------------------------------------- Visual Studio Code c_cpp_properties.json ----------------------------------------------
{
"configurations": [
{
"name": "ESP-IDF",
// "compilerPath": "C:\\ESP-IDF\\Tools\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r3-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe",
"compilerPath": "C:\\ESP-IDF\\TOOLS\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r2-8.2.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}/**",
"C:/ESP-IDF/IDF/components/bt/include"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
}
}
],
"version": 4
}

----------------------------------------------------------- Latest error -----------------------------------------------------------------
Latest error at Command failed: C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe c:\ESP-IDF\IDF\tools\check_python_dependencies.py -r "c:\Users\ndjur\.vscode\extensions\espressif.esp-idf-extension-1.2.0\esp_debug_adapter\requirements.txt"

--------------------------------------------------------------------------------------------------------------------------------------------

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: ESP debug adapter question

Postby ESP_bignacio » Thu Dec 02, 2021 8:50 am

The vscode extension debug adapter has its own python packages required to work. These will be installed in your Python virtual environment (idf.pythonBinPath) and should not affect your esp-idf modules.

You can use the extension Install ESP-IDF Python Packages command to install these packages.

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

Re: ESP debug adapter question

Postby ndjurov » Thu Dec 02, 2021 5:14 pm

Thank you very much.
I just tried installing it using Install ESP-IDF Python Packages command and it didn't work. Below is the output log. Is there anything else I may try that would enable me to run the debugger - one way or another?
Thank you.
Creating a new Python environment in c:\ESP-IDF\TOOLS\python_env\idf4.1_py3.9_env
Installing virtualenv
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe -m pip install --upgrade pip' command.
Traceback (most recent call last):
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1182, in action_install_python_env
import virtualenv # noqa: F401
ModuleNotFoundError: No module named 'virtualenv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1387, in <module>
main(sys.argv[1:])
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1383, in main
action_func(args)
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1185, in action_install_python_env
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', 'virtualenv'],
File "C:\Users\ndjur\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\ESP-IDF\\TOOLS\\.espressif\\python_env\\idf4.1_py3.9_env\\Scripts\\python.exe', '-m', 'pip', 'install', '--user', 'virtualenv']' returned non-zero exit status 1.
Command failed: C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe c:\ESP-IDF\IDF\tools\idf_tools.py install-python-env
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe -m pip install --upgrade pip' command.
Traceback (most recent call last):
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1182, in action_install_python_env
import virtualenv # noqa: F401
ModuleNotFoundError: No module named 'virtualenv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1387, in <module>
main(sys.argv[1:])
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1383, in main
action_func(args)
File "c:\ESP-IDF\IDF\tools\idf_tools.py", line 1185, in action_install_python_env
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', 'virtualenv'],
File "C:\Users\ndjur\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\ESP-IDF\\TOOLS\\.espressif\\python_env\\idf4.1_py3.9_env\\Scripts\\python.exe', '-m', 'pip', 'install', '--user', 'virtualenv']' returned non-zero exit status 1.

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: ESP debug adapter question

Postby ESP_bignacio » Tue Dec 07, 2021 12:20 pm

You can also open a terminal and try these commands:

C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe -m pip install --upgrade -r c:\Users\ndjur\.vscode\extensions\espressif.esp-idf-extension-1.2.0/requirements.txt

C:\ESP-IDF\TOOLS\.espressif\python_env\idf4.1_py3.9_env\Scripts\python.exe -m pip install --upgrade -r c:\Users\ndjur\.vscode\extensions\espressif.esp-idf-extension-1.2.0/esp_debug_adapter/requirements.txt

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

Re: ESP debug adapter question

Postby ndjurov » Wed Dec 08, 2021 9:13 pm

Thanks a lot. I'll let you know if it helped.

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

Re: ESP debug adapter question

Postby ndjurov » Mon Dec 20, 2021 11:50 pm

Hoping to get the debugger working I tried to configure everything on a clean computer, doing the following steps:

1. Installed ESP-IDF 4.3 using the offline ESP-IDF Install Tool. Everything worked well and I was able to build my project from ESP-IDF 4.3 command prompt.

2. Installed VS Code and Espressif extension.

3. Connected ESP-PROG to a ESP-WROVER-E 8M based development board. Connected both serial and JTAG interface to the board. Installed FTDI drivers for ESP-PROG and replaced interface 0 to WinUSB using Zadig. (Getting one COM port and one USB device - Dual RS232-HS).

4. Used Espressif extension to load hello-world example. Didn't change anything in the example (including launch.json).

5. Built and flashed the executable to the dev board via ESP-PROG. Run monitor to confirm and got proper output from the application.

6. Set a breakpoint and tried to debug, only to get a dialog telling me that:
"Couldn't find a debug adapter descriptor for debug type 'espidf' (extension might have failed to activate)"

I also got two notification telling me that:
" 'PathToProject'\hello_world\build\project-name.elf doesn't exists. Build first."
and another one saying that:
"Cannot read property 'message' of undefined.
Source: Espressif IDF (Extension)"

7. Based on a post in this forum, I added "skipVerifyAppBinBeforeDebug": true line in the launch.json that helped avoiding the described dialog, just to give me another one:
"Failed to init Debug Adapter"

8. Doctor command tells me that all requirements are satisfied:
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages Python requirements from C:\ESP-IDF\requirements.txt are satisfied.
---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages Python requirements from c:\Users\ndjuricic\.vscode\extensions\espressif.esp-idf-extension-1.2.0\requirements.txt are satisfied.
---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages Python requirements from c:\Users\ndjuricic\.vscode\extensions\espressif.esp-idf-extension-1.2.0\esp_debug_adapter\requirements.txt are satisfied.
---------------------------------------------------- Visual Studio Code launch.json --------------------------------------------------------
{
"version": "0.2.0",
"configurations": [
{
"type": "espidf",
"name": "Launch",
"request": "launch",
"skipVerifyAppBinBeforeDebug": true
}
]
}
Can you please tell me where to go from here?
Thanks a lot.

Who is online

Users browsing this forum: No registered users and 26 guests