You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`espIdf.getExtensionPath`: Get the installed location absolute path.
192
192
-`espIdf.getOpenOcdScriptValue`: Return the value of OPENOCD_SCRIPTS from `idf.customExtraVars` or from system OPENOCD_SCRIPTS environment variable.
193
193
-`espIdf.getOpenOcdConfig`: Return the openOCD configuration files as string. Example `-f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg`.
194
194
-`espIdf.getProjectName`: Return the project name from current workspace folder `build/project_description.json`.
195
-
-`espIdf.getXtensaGcc`: Return the absolute path of the toolchain gcc for the ESP-IDF target given by `idf.adapterTargetName` configuration setting and `idf.customExtraPaths`.
196
-
-`espIdf.getXtensaGdb`: Return the absolute path of the toolchain gdb for the ESP-IDF target given by `idf.adapterTargetName` configuration setting and `idf.customExtraPaths`.
195
+
-`espIdf.getToolchainGcc`: Return the absolute path of the toolchain gcc for the ESP-IDF target given by `idf.adapterTargetName` configuration setting and `idf.customExtraPaths`.
196
+
-`espIdf.getToolchainGdb`: Return the absolute path of the toolchain gdb for the ESP-IDF target given by `idf.adapterTargetName` configuration setting and `idf.customExtraPaths`.
197
197
198
198
See an example in the [debugging](./docs/DEBUGGING.md) documentation.
Copy file name to clipboardexpand all lines: docs/DEBUGGING.md
+161-42
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,168 @@
7
7
8
8
The Visual Studio Code uses `.vscode/launch.json` to configure debug as specified in [Visual Studio Code Debugging](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations).
9
9
10
-
We recommend using our ESP-IDF Debug Adapterto debug your ESP-IDF projects, but you can also just configure launch.json for the [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
10
+
We recommend using our `Eclipse CDT GDB Adapter` configuration to debug your ESP-IDF projects, but you can configure launch.json for any GDB debugger extension like [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) and [Native Debug](https://marketplace.visualstudio.com/items?itemName=webfreak.debug). The ESP-IDF Debug adapter will be deprecated and removed in the next major release.
11
11
12
12
Our extension implements a `ESP-IDF: Peripheral View` tree view in the `Run and Debug` view which will use the SVD file defined in the `IDF SVD File Path (idf.svdFilePath)` configuration setting to be defined in the [settings.json](../SETTINGS.md) to populate a set of peripherals registers values for the active debug session target. You could find Espressif SVD files from [Espressif SVD](https://github.com/espressif/svd).
13
13
14
+
If `initCommands`, `gdbinitFile` or `initGdbCommands` are defined in launch.json, make sure to include the following commands for debug session to properly work as shown in [JTAG Debugging with command line](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/using-debugger.html#command-line).
15
+
16
+
## Using the Eclipse CDT GDB Debug Adapter
17
+
18
+
The Eclipse CDT team have published a GDB debug adapter as NPM package which we include in our extension dependencies. For more information about the debug adapter please review [CDT-GDB-Adapter Github Repository](https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter).
19
+
20
+
The default configuration is:
21
+
22
+
```JSON
23
+
{
24
+
"configurations": [
25
+
{
26
+
"type": "gdbtarget",
27
+
"request": "attach",
28
+
"name": "Eclipse CDT GDB Adapter"
29
+
}
30
+
]
31
+
}
32
+
```
33
+
34
+
where required of the arguments are automatically defined and resolved by the extension itself.
35
+
36
+
In case the user wants more customized control, the basic arguments in launch.json are:
-`program`: ELF file of your project build directory to execute the debug session. The command `${command:espIdf.getProjectName}` will query the extension to find the current build directory project name.
65
+
-`initCommands`: GDB Commands to initialize GDB and target.
66
+
-`gdb`: GDB executable to be used. By default `"${command:espIdf.getToolchainGdb}"` will query the extension to find the ESP-IDF toolchain GDB for the current `IDF_TARGET` of your esp-idf project (esp32, esp32c6, etc.).
67
+
68
+
> **NOTE**`{IDF_TARGET_CPU_WATCHPOINT_NUM}` is resolved by the extension according to the current `IDF_TARGET` of your esp-idf project (esp32, esp32c6, etc.).
69
+
70
+
Some additional arguments you might use are:
71
+
72
+
-`runOpenOCD`: (Default: true). Run extension openOCD Server.
73
+
-`verifyAppBinBeforeDebug`: (Default: false) Verify that current ESP-IDF project binary is the same as binary in chip.
74
+
-`logFile`: Absolute path to the file to log interaction with gdb. Example: `${workspaceFolder}/gdb.log`.
75
+
-`verbose`: Produce verbose log output.
76
+
-`environment`: Environment variables to apply to the ESP-IDF Debug Adapter. It will replace global environment variables and environment variables used by the extension.
77
+
78
+
```json
79
+
"environment": {
80
+
"VAR": "Value"
81
+
}
82
+
```
83
+
84
+
-`imageAndSymbols`:
85
+
86
+
```json
87
+
"imageAndSymbols": {
88
+
"symbolFileName": "If specified, a symbol file to load at the given (optional) offset",
89
+
"symbolOffset": "If symbolFileName is specified, the offset used to load",
90
+
"imageFileName": "If specified, an image file to load at the given (optional) offset",
91
+
"imageOffset": "If imageFileName is specified, the offset used to load"
92
+
}
93
+
```
94
+
95
+
-`target`: Configuration for target to be attached. Specifies how to connect to the device to debug. Usually OpenOCD exposes the chip as a remote target on port `3333`.
96
+
97
+
```json
98
+
"target": {
99
+
"type": "The kind of target debugging to do. This is passed to -target-select (defaults to remote)",
100
+
"host": "Target host to connect to (defaults to 'localhost', ignored if parameters is set)",
101
+
"port": "Target port to connect to (defaults to value captured by serverPortRegExp, ignored if parameters is set)",
102
+
"parameters": "Target parameters for the type of target. Normally something like localhost:12345. (defaults to `${host}:${port}`)",
103
+
"connectCommands": "Replace all previous parameters to specify an array of commands to establish connection"
104
+
}
105
+
```
106
+
107
+
Other arguments please review this extension's package.json `gdbtarget` debugger contribution.
108
+
109
+
## Use Microsoft C/C++ Extension to Debug
110
+
111
+
The user can also use [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) to debug, the community recommend this launch.json configuration:
The user can also try using the [Native Debug](https://marketplace.visualstudio.com/items?itemName=webfreak.debug) extension with this example launch.json configuration:
> **NOTE:** Currently the python package `pygdbmi` used by the debug adapter still depends on some Python 2.7 libraries (libpython2.7.so.1.0) so make sure that the Python executable you use in `idf.pythonBinPath` contains these libraries. This will be dropped in later versions of ESP-IDF.
171
+
**DEPRECATED NOTICE**: We are deprecating the use of our ESP-IDF Debug Adapter in favor of using the Eclipse CDT GDB Adapter. It will removed from extension in the future major release.
17
172
18
173
This extension includes the [ESP-IDF Debug Adapter](https://github.com/espressif/esp-debug-adapter) which implement the debug adapter protocol (DAP) to communicate Xtensa's Toolchain and OpenOCD with Visual Studio Code allowing the user to easily debug ESP-IDF applications. Visual Studio Code will:
19
174
@@ -45,7 +200,7 @@ The ESP-IDF Debug Adapter settings for launch.json are:
45
200
-`initGdbCommands`: One or more xtensa-esp32-elf-gdb commands to execute in order to setup the underlying debugger.
46
201
> **NOTE**: If `gdbinitFile` is defined, these commands will be ignored.
47
202
-`logLevel`: Debug Adapter logging level (0-4), 5 - for a full OOCD log. Default: 2.
48
-
-`mode`: Can be either `auto`, to start the Debug Adapter and OpenOCD server within the extension or `manual`, to connect to existing Debug Adapter and OpenOCD session. Default: auto.
203
+
-`mode`: Can be either `auto`, to start the Debug Adapter and OpenOCD server within the extension or `manual`, to connect to an already running Debug Adapter and OpenOCD session. Default: auto.
49
204
> **NOTE:** If set to `manual`, OpenOCD and ESP-IDF Debug Adapter have to be manually executed by the user and the extension will just try to connect to existing servers at configured ports.
50
205
-`name`: The name of the debug launch configuration. This will be shown in the Run view (Menu View -> Run).
51
206
-`type`: Type of debug configuration. It **must** be `espidf`.
@@ -67,7 +222,6 @@ Example launch.json for ESP-IDF Debug Adapter:
67
222
68
223
```JSON
69
224
{
70
-
"version": "0.2.0",
71
225
"configurations": [
72
226
{
73
227
"type": "espidf",
@@ -80,9 +234,10 @@ Example launch.json for ESP-IDF Debug Adapter:
80
234
"tmoScaleFactor": 1,
81
235
"initGdbCommands": [
82
236
"target remote :3333",
237
+
"set remotetimeout 20",
83
238
"symbol-file /path/to/program.elf",
84
239
"mon reset halt",
85
-
"flushregs",
240
+
"maintenance flush register-cache",
86
241
"thb app_main"
87
242
],
88
243
"env": {
@@ -95,40 +250,4 @@ Example launch.json for ESP-IDF Debug Adapter:
95
250
96
251
### Output and Logs from ESP-IDF Debug Adapter and OpenOCD
97
252
98
-
Beside the Visual Studio Code Debug console output. You can find the debug adapter output in `<project_dir>/debug.log` and Menu View -> Output -> `ESP-IDF Debug Adapter` as well as OpenOCD output in Menu View -> Output -> `OpenOCD`.
99
-
100
-
## Use Microsoft C/C++ Extension to Debug
101
-
102
-
The user can also use [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) to debug, the community recommend this launch.json configuration:
Beside the Visual Studio Code Debug console output. You can find OpenOCD and the ESP-IDF debug adapter output in `<project_dir>/debug.log` and Menu View -> Output -> `ESP-IDF`.
0 commit comments