Skip to content

Commit

Permalink
Added a custom Debug Adapter (VSC-250) (#45)
Browse files Browse the repository at this point in the history
* Added a custom Debug Adapter

* fix old configs remove build before debug

* fix debug adapter unit test

* DA python pkgs check (#3)

* read Cmakelists file for project name (VSC-248) (#43)

read build project_description json file for project name

* Feature/localization kv val (VSC-226) (VSC-246) (#41)

* add gulp i18n validation and src missing key log

* rm unused i18n field, add unknown field (#48)

* v0.1.4

* Added a custom Debug Adapter

* fix old configs remove build before debug

* removed outdated extension.test.ts

* fix debug adapter unit test

* removed repeated options

* removed redundant requirements.txt

* made `Upload testing.results.log` always executable

* add adapter python reqs checking

Co-authored-by: Soumesh Banerjee <soumeshbanerjee@live.com>
Co-authored-by: Andrey Gramakov <mail@agramakov.me>

* Fix/da merge (#4)

* read Cmakelists file for project name (VSC-248) (#43)

read build project_description json file for project name

* Feature/localization kv val (VSC-226) (VSC-246) (#41)

* add gulp i18n validation and src missing key log

* rm unused i18n field, add unknown field (#48)

* v0.1.4

* Added a custom Debug Adapter

* fix old configs remove build before debug

* fix debug adapter unit test

* DA python pkgs check (#3)

* read Cmakelists file for project name (VSC-248) (#43)

read build project_description json file for project name

* Feature/localization kv val (VSC-226) (VSC-246) (#41)

* add gulp i18n validation and src missing key log

* rm unused i18n field, add unknown field (#48)

* v0.1.4

* Added a custom Debug Adapter

* fix old configs remove build before debug

* removed outdated extension.test.ts

* fix debug adapter unit test

* removed repeated options

* removed redundant requirements.txt

* made `Upload testing.results.log` always executable

* add adapter python reqs checking

Co-authored-by: Soumesh Banerjee <soumeshbanerjee@live.com>
Co-authored-by: Andrey Gramakov <mail@agramakov.me>

* fix merge issues

* log adapter output

Co-authored-by: Soumesh Banerjee <soumeshbanerjee@live.com>
Co-authored-by: Andrey Gramakov <mail@agramakov.me>

* An dr/feature/debug adapter (#5)

Fix Espressif master merge conflicts

* debug_backend package: removed everything but pygdbmi from the Pipfile

* Fix/da conflict (#6)

* read Cmakelists file for project name (VSC-248) (#43)

read build project_description json file for project name

* Feature/localization kv val (VSC-226) (VSC-246) (#41)

* add gulp i18n validation and src missing key log

* rm unused i18n field, add unknown field (#48)

* v0.1.4

Co-authored-by: Soumesh Banerjee <soumeshbanerjee@live.com>

* Run prettier

* yarn audit fix

Co-authored-by: brian@espressif.com <brian@espressif.com>
Co-authored-by: Brian A. Ignacio <brianignacio5@gmail.com>
Co-authored-by: Soumesh Banerjee <soumeshbanerjee@live.com>
  • Loading branch information
4 people authored Mar 26, 2020
1 parent d1f5fd1 commit 7178fc8
Show file tree
Hide file tree
Showing 98 changed files with 24,933 additions and 589 deletions.
2 changes: 1 addition & 1 deletion .bandit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[bandit]
exclude: ./node_modules/*,./.git/*
exclude: ./node_modules/*,./.git/*,./esp_debug_adapter/*
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,6 @@ statistics = True
exclude =
.git,
__pycache__
node_modules
node_modules
./node_modules
esp_debug_adapter
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.5

- name: Install Node Dependencies
run: yarn

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r esp_debug_adapter/requirements.txt
- name: Prettier Check
run: yarn prettier --check "**/*.*"

Expand All @@ -43,6 +53,7 @@ jobs:
CODE_VERSION: "1.41.1"
DISPLAY: ":99.0"
- name: Upload testing.results.log
if: always()
uses: actions/upload-artifact@v1
with:
name: testing.results.log
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ dist/
node_modules/
templates/
testFiles/
media/
media/
esp_debug_adapter/
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ There are a few dependencies which needs to be downloaded and installed before y

## Coming Soon 🔜

- Debugging support.
- Heap Tracing with complete GUI
- VSCode Remote

Expand All @@ -40,7 +39,7 @@ There are several ways to install this extension to your VSCode, easiest one is

### Marketplace Installation

##### _[Link to the marketplace](https://marketplace.visualstudio.com/items?itemName=espressif.esp-idf-extension)_
#### _[Link to the marketplace](https://marketplace.visualstudio.com/items?itemName=espressif.esp-idf-extension)_

Launch VSCode Quick Open (<kbd>⌘</kbd>+<kbd>P</kbd> on Mac or <kbd>Ctrl</kbd>+<kbd>P</kbd> on Windows) and then paste the following command and press enter

Expand Down Expand Up @@ -186,11 +185,13 @@ There is also some tasks defined in Tasks.json, which can be executed by running
the following:

1. `Build` - Build Project
2. `Clean` - Clean the project
3. `Flash` - Flash the device
4. `Monitor` - Start a monitor terminal
5. `OpenOCD` - Start the openOCD server
6. `BuildFlash` - Execute a build followed by a flash command.
2. `Set Target to esp32`
3. `Set Target to esp32s2`
4. `Clean` - Clean the project
5. `Flash` - Flash the device
6. `Monitor` - Start a monitor terminal
7. `OpenOCD` - Start the openOCD server
8. `BuildFlash` - Execute a build followed by a flash command.

Note that for OpenOCD tasks you need to define OPENOCD_SCRIPTS in your system environment variables with openocd scripts folder path.

Expand All @@ -206,7 +207,7 @@ The search functionality allows to find a parameter by description, i.e the name

An IDF GUI Menuconfig log in Output is created to print all communications with `${idf.espIdfPath}\tools\confserver.py`. It can be be used to track any errors.

## Working with multiple projects.
## Working with multiple projects

For big projects, a user will typically have one or more projects to build, flash or monitor. The ESP-IDF uses the [Visual Studio Code Workspace file schema](https://code.visualstudio.com/docs/editor/multi-root-workspaces#_workspace-file-schema) to identify all projects folders inside the current workspace (which would be the root folder).

Expand Down Expand Up @@ -237,6 +238,12 @@ If you want to open a project with multiple subprojects in Visual Studio Code, c

**NOTE:** You still need to manually select the debug configuration in the Debug tab that correspond to your current workspace folder. There is a project folder suffix on each debug configuration.

## Debugging

Click <kbd>F5</kbd> to start debugging. For correct debug experience, first `build`, `flash` your device and define the correct `idf.customExtraPaths` paths and `idf.customExtraVars` using [ONBOARDING](./docs/ONBOARDING.md).

When you start debug, an OpenOCD process starts in the background. OpenOCD Output log window is created in Visual Studio Code lower panel. To configure your project's launch.json to debug, please review [DEBUGGING](./docs/DEBUGGING.md).

## Kconfig files editor

When you open a `Kconfig`, `Kconfig.projbuild` or `Kconfig.in` file we provide syntax highlighting. If `idf.useIDFKconfigStyle` is enabled, we also provide ESP-IDF Kconfig style syntax validation such as indent validation and not closing blocks found (Example: menu-endmenu). Please review [Kconfig Formatting Rules](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/kconfig.html) and [Kconfig Language](https://github.com/espressif/esp-idf/blob/master/tools/kconfig/kconfig-language.txt) for further details about the ESP-IDF Kconfig formatting rules and Kconfig language in general.
Expand All @@ -245,10 +252,10 @@ When you open a `Kconfig`, `Kconfig.projbuild` or `Kconfig.in` file we provide s

If you are lost at any point you can always ask question, help and suggestion in the [forum](https://spectrum.chat/espidf-vsc?tab=posts), apart from creating Github Issues. For all the [ESP-IDF](https://github.com/espressif/esp-idf) related concerns please follow [their suggested channel](https://esp32.com) of communications.

# Code of Conduct
## Code of Conduct

This project and everyone participating in it is governed by the [Code of Conduct](./docs/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [vscode@espressif.com](mailto:vscode@espressif.com).

# License
## License

This extension is licensed under the Apache License 2.0. Please see the [LICENSE](./LICENSE) file for additional copyright notices and terms.
59 changes: 59 additions & 0 deletions docs/DEBUGGING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Use our ESP-IDF Debug Adapter

```
{
"version": "0.2.0",
"configurations": [
{
"type": "espidf",
"name": "Launch",
"request": "launch",
"env": {
"PYTHONPATH": "${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter"
},
}
]
}
```

Configuration settings of the ESP-IDF Debug Adapter for launch.json are:

- `debugPort`: Port for ESP-IDF Debug Adapter. Default: 43474.
- `logLevel`: Specify log level for Debug Adapter. Default: 2.
- `mode`: Can be either `auto`, to start the debug adapter server within the extension or `manual`, to connect to existing debug adapter session.
- `env`: Environment variables to apply to the ESP-IDF Debug Adapter.

# Use Microsoft C/C++ extension to debug

If you prefer using Microsoft C/C++ Extension to debug, the user community have found this launch.json configuration to be working.

```
{
"version": "0.2.0",
"configurations": [
{
"name": "GDB",
"type": "cppdbg",
"request": "launch",
"MIMode": "gdb",
"miDebuggerPath": "xtensa-esp32-elf-gdb",
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"windows": {
"program": "${workspaceFolder}\\build\\${command:espIdf.getProjectName}.elf"
},
"cwd": "${workspaceFolder}",
"environment": [{ name: "PATH", value: "${config:idf.customExtraPaths}" }],
"setupCommands": [
{ "text": "target remote :3333" },
{ "text": "mon reset halt" },
{ "text": "thb app_main" },
{ "text": "flushregs" }
],
"externalConsole": false,
"logging": {
"engineLogging": true
}
}
]
}
```
12 changes: 12 additions & 0 deletions esp_debug_adapter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.pyc
/.idea
/.venv
/.vscode
/venv
/temp*
/*.ps1
/.environment/
/main.exe
/tests/temp_sc_tests/gdbinit
TEST*.xml
*.log
Loading

0 comments on commit 7178fc8

Please sign in to comment.