Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: Build crashing on custom OpenOCD build (VSC-532) #276

Closed
3 tasks done
brainstorm opened this issue Jan 6, 2021 · 10 comments · Fixed by #281
Closed
3 tasks done

[Bug Report]: Build crashing on custom OpenOCD build (VSC-532) #276

brainstorm opened this issue Jan 6, 2021 · 10 comments · Fixed by #281
Assignees
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)

Comments

@brainstorm
Copy link

Pre Bug Report Checklist
Before reporting any bug please make sure of these points.

  • Make sure you have searched for existing bugs and features request before you post an issue.
  • This is a bug report for the ESP-IDF Visual Studio Code extension and not an ESP-IDF bug report.
  • I've read the docs and found no information that could have helped solving the issue.

Describe the bug

I'm having similar symptoms as #270, but my case is slightly different, I'll be thorough on this bug report...

After enabling remote_bitbang on OpenOCD (see PR espressif/openocd-esp32#134), I cannot seem to be able to do anything with the extension anymore since the following error appears on any action (i.e Build):

{
  "message": "Open On-Chip Debugger  v0.10.0-esp32-20201202-2-g7e342cad (2021-01-02-23:47)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n",
  "stack": "Error: Open On-Chip Debugger  v0.10.0-esp32-20201202-2-g7e342cad (2021-01-02-23:47)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n    at /Users/romanvg/.vscode-insiders/extensions/espressif.esp-idf-extension-0.6.0/dist/extension.js:1:7720\n    at ChildProcess.exithandler (child_process.js:303:7)\n    at ChildProcess.emit (events.js:315:20)\n    at ChildProcess.EventEmitter.emit (domain.js:483:12)\n    at maybeClose (internal/child_process.js:1021:16)\n    at Socket.<anonymous> (internal/child_process.js:443:11)\n    at Socket.emit (events.js:315:20)\n    at Socket.EventEmitter.emit (domain.js:483:12)\n    at Pipe.<anonymous> (net.js:674:12)",
  "level": "error",
  "timestamp": "2021-01-06T11:34:05.666Z"
}

The error log above occurs as well if having OpenOCD up and running... my best guess is that idf_tools.py version checking logic is interfering with the extension Build task/command?

To Reproduce

Install a slightly tweaked OpenOCD version (different than the one shipped with the extension).

Expected behavior

Everything working fine as it should? :)

Screenshots
On each Build task, the following error block appears in the extension's error log:

Skärmavbild 2021-01-06 kl  22 55 01

Environment (please complete the following information):

  • OS Name & Version: MacOS X 10.15.2 (Catalina)
  • VSCode Version: Insiders, latest
  • ESP-IDF Version: master
  • Python Version: 3.9.1

Logs

As shown above in the description.

Additional context

Please see PR espressif/openocd-esp32#134 for more context. Also providing env vars I'm using:

  "idf.espIdfPath": "/Users/romanvg/dev/esp-idf",
  "idf.openOcdConfigs": [
    "interface/remote_bitbang.cfg",
    "target/esp32s2.cfg"
  ],
  "idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"/Users/romanvg/.espressif/tools/openocd-esp32/v0.10.0-esp32-20201202/openocd-esp32/share/openocd/scripts\"}",
@brainstorm brainstorm added the bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) label Jan 6, 2021
@github-actions github-actions bot changed the title [Bug Report]: Build crashing on custom OpenOCD build [Bug Report]: Build crashing on custom OpenOCD build (VSC-532) Jan 6, 2021
@brainstorm
Copy link
Author

On the other hand, typing idf.py build builds via regular VSCode console without a problem :/

@brainstorm
Copy link
Author

brainstorm commented Jan 8, 2021

@brianignacio5 I have reason to believe that you have closed this issue a bit too fast, could you please reopen?

I've compiled and installed the extension as indicated in the README.md and the error still persists with your changes against master (soon to be release 0.6.1, allegedly fixed on #281):

{"message":"Open On-Chip Debugger  v0.10.0-esp32-20201202-2-g7e342cad (2021-01-02-23:47)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html",
"stack":"Error: Open On-Chip Debugger  v0.10.0-esp32-20201202-2-g7e342cad (2021-01-02-23:47)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html

   at /Users/romanvg/.vscode-insiders/extensions/espressif.esp-idf-extension-0.6.1/dist/extension.js:1:7720
   at ChildProcess.exithandler (child_process.js:303:7)
   at ChildProcess.emit (events.js:315:20)
   at maybeClose (internal/child_process.js:1021:16)
   at Socket.<anonymous> (internal/child_process.js:443:11)
   at Socket.emit (events.js:315:20)
   at Pipe.<anonymous> (net.js:674:12)",
"level":"error",
"timestamp":"2021-01-08T11:29:13.104Z"
}

This error message shows up in the log every time I click the extension's "Build" button.

@brainstorm
Copy link
Author

brainstorm commented Jan 8, 2021

EDIT: yarn debugPreTask to switch into development mode should be mentioned in the README.md, IMHO... still does not work (asks for that task) after running webpack --mode development script anyway :-S

Also the "Build from source code" in the README.md should be a bit more specific about the following point:

Press F5 to Run with Debugger, this will launch a new VSCode Extension Development Host to debug the extension.

Since I'm getting this prompt to configure the debugPreTask right after pressing F5?:

Skärmavbild 2021-01-08 kl  22 50 09

How does your .vscode/tasks.json look like for this extension?

@brianignacio5
Copy link
Collaborator

oh really ? I removed the tools check from build flash and monitor. Will reopen.

If you executed yarn and then press F5 it should start the extension with debug. This task is defined in package.json. There should be some error in the terminal

@brianignacio5 brianignacio5 reopened this Jan 8, 2021
@brainstorm
Copy link
Author

brainstorm commented Jan 8, 2021

Fixed the extension debugging part by:

diff --git a/.vscode/launch.json b/.vscode/launch.json
index ee48d96..b850207 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -12,7 +12,7 @@
       "runtimeExecutable": "${execPath}",
       "args": ["--extensionDevelopmentPath=${workspaceFolder}"],
       "outFiles": ["${workspaceFolder}/dist/**/*.js"],
-      "preLaunchTask": "npm: debugPreTask",
+      //"preLaunchTask": "npm: debugPreTask",
       "env": {
         "VSCODE_EXTENSION_MODE": "development"
       }

Looking into debugging the actual OpenOCD issue now...

@brianignacio5
Copy link
Collaborator

There is a OpenOCD output tab (next to terminal) which is the openocd server log.
The log you shown in the issue description is just printing openOCD version as an error, not related to the issue.

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Jan 8, 2021

Also how is openOCD related to the build process ? Your log output is not related to the build error, there should be some other information besides this related to CMake, ninja-build or xtensa toolchain.

In the terminal, when you try to build, there should be a Build Task output showing the error.

@brainstorm
Copy link
Author

brainstorm commented Jan 8, 2021

Funnily enough, when debugging the extension in the "Extension Development Host" VSCode it all seems to build and work fine... but when I install the .vsix, the Build fails immediately and that error above shows up.

In the terminal, when you try to build, there should be a Build Task output showing the error.

No there's no task output on the ".vsix"-installed VSCode editor, when clicking Build, the "Building" popup disappears in 1-2 seconds and the .log under the extension dir registers one more json log line as shown above.

@gost-serb
Copy link

@brainstorm

EDIT: yarn debugPreTask to switch into development mode...

Looks like the extension was moved to yarn some time ago but some pieces of code still working with npm though. I would recommend you instead of commenting out "preLaunchTask": "npm: debugPreTask", line in launch.json try to replace it with
"preLaunchTask": "yarn: debugPreTask",

Regarding the issue itself: did you check OpenOCD output on the output tab (Ctrl+Shift+U) when this issue occurs?
image

@brainstorm
Copy link
Author

Looks like the extension was moved to yarn some time ago but some pieces of code still working with npm though. I would recommend you instead of commenting out "preLaunchTask": "npm: debugPreTask", line in launch.json try to replace it with
"preLaunchTask": "yarn: debugPreTask",

None of those variants actually work for me:

  1. npm: debugPreTask
  2. yarn: debugPreTask
  3. npm debugPreTask
  4. yarn debugPreTask

All of the above end up like this:

Skärmavbild 2021-01-09 kl  18 43 49

That's why commenting it out and pressing F5 works well since it spaws the "Extension Development Host" (just an extra VSCode window to test/debug the extension)... I guess that running that yarn debugPreTask at the terminal once suffices if one doesn't change any of the *.ts code?

Regarding the issue itself: did you check OpenOCD output on the output tab (Ctrl+Shift+U) when this issue occurs?
image

I wiped the extension, rebuilt the VSIX from master and reinstalled and now it works! Time to close this and focus on the esp_dap and DEBUGGING.txt next :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants