cortex-debug: Serial problem

Hi, I am trying to use SWO on BMP.

Running vscode 1.26.1-2 (archlinux AUR)

Whenever I try to start debug with swo, this error pops up: Unable to load Serial Port Module. A recent Visual Studio Code update has likely broken compatibility with the serial module. Please visit https://github.com/Marus/cortex-debug for more information.

I noticed, that binary modules submodule is quite outdated.

Or is there something wrong in my config?

{
	"preLaunchTask": "build",
	"type": "cortex-debug",
	"request": "launch",
	"name": "Debug (BlackMagic)",
	"showDevDebugOutput":false,
	"servertype": "bmp",
	"cwd": "${workspaceRoot}",
	"executable": "${workspaceRoot}/main.elf",
	"device": "STM32F746IG",
	"svdFile": "${workspaceRoot}/STM32F7x6.svd",
	"BMPGDBSerialPort": "/dev/ttyACM0",
	"targetId": 1,
	"swoConfig":{
		"enabled":true,
		"source":"/dev/ttyACM1",
		"swoFrequency":2000000,
		"cpuFrequency":200000000,
		"ports":[
			{
				"number":0,
				"label":"text",
				"format":"console"
			}
		]
	}
}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (10 by maintainers)

Most upvoted comments

I’m actually working on updating all the binary modules for the serial port based ITM support at the moment. Still need to get the Windows versions of the binary modules built. That should hopefully get it working until the next time VSCode updates the runtime. Hopefully can at least get a test version out this weekend.

On Wed., Dec. 11, 2019, 6:27 a.m. Diego Herranz, notifications@github.com wrote:

Many thanks for your help.

I don’t manage to make it work.

I’ve followed all your steps. And here you can see the structure after I copied the node_modules folder obtained in step 4:

~/.vscode/extensions/cortex-debug/binary_modules$ tree -L 5 . ├── v12.4.0 │ └── linux │ └── x64 │ └── node_modules │ ├── ansi-regex │ ├── aproba │ ├── are-we-there-yet │ ├── bindings │ ├── bl │ ├── chownr │ ├── code-point-at │ ├── console-control-strings │ ├── core-util-is │ ├── debug │ ├── decompress-response │ ├── deep-extend │ ├── delegates │ ├── detect-libc │ ├── end-of-stream │ ├── expand-template │ ├── file-uri-to-path │ ├── fs-constants │ ├── gauge │ ├── github-from-package │ ├── has-unicode │ ├── inherits │ ├── ini │ ├── isarray │ ├── is-fullwidth-code-point │ ├── mimic-response │ ├── minimist │ ├── mkdirp │ ├── ms │ ├── nan │ ├── napi-build-utils │ ├── node-abi │ ├── noop-logger │ ├── npmlog │ ├── number-is-nan │ ├── object-assign │ ├── once │ ├── prebuild-install │ ├── process-nextick-args │ ├── pump │ ├── rc │ ├── readable-stream │ ├── safe-buffer │ ├── semver │ ├── serialport │ ├── @serialport │ ├── set-blocking │ ├── signal-exit │ ├── simple-concat │ ├── simple-get │ ├── string_decoder │ ├── string-width │ ├── strip-ansi │ ├── strip-json-comments │ ├── tar-fs │ ├── tar-stream │ ├── tunnel-agent │ ├── util-deprecate │ ├── which-pm-runs │ ├── wide-align │ └── wrappy └── v8.9.3 ├── darwin │ └── x64 │ └── node_modules │ ├── ansi-regex │ ├── aproba │ ├── are-we-there-yet │ ├── bindings │ ├── bl │ ├── buffer-alloc │ ├── buffer-alloc-unsafe │ ├── buffer-fill │ ├── chownr │ ├── code-point-at │ ├── console-control-strings │ ├── core-util-is │ ├── debug │ ├── decompress-response │ ├── deep-extend │ ├── delegates │ ├── detect-libc │ ├── end-of-stream │ ├── expand-template │ ├── fs-constants │ ├── gauge │ ├── github-from-package │ ├── has-unicode │ ├── inherits │ ├── ini │ ├── isarray │ ├── is-fullwidth-code-point │ ├── mimic-response │ ├── minimist │ ├── mkdirp │ ├── ms │ ├── nan │ ├── napi-build-utils │ ├── node-abi │ ├── noop-logger │ ├── npmlog │ ├── number-is-nan │ ├── object-assign │ ├── once │ ├── os-homedir │ ├── prebuild-install │ ├── process-nextick-args │ ├── pump │ ├── rc │ ├── readable-stream │ ├── safe-buffer │ ├── semver │ ├── serialport │ ├── @serialport │ ├── set-blocking │ ├── signal-exit │ ├── simple-concat │ ├── simple-get │ ├── string_decoder │ ├── string-width │ ├── strip-ansi │ ├── strip-json-comments │ ├── tar-fs │ ├── tar-stream │ ├── to-buffer │ ├── tunnel-agent │ ├── util-deprecate │ ├── which-pm-runs │ ├── wide-align │ ├── wrappy │ └── xtend └── linux ├── ia32 │ └── node_modules │ ├── ansi-regex │ ├── aproba │ ├── are-we-there-yet │ ├── bindings │ ├── bl │ ├── buffer-alloc │ ├── buffer-alloc-unsafe │ ├── buffer-fill │ ├── chownr │ ├── code-point-at │ ├── console-control-strings │ ├── core-util-is │ ├── debug │ ├── decompress-response │ ├── deep-extend │ ├── delegates │ ├── detect-libc │ ├── end-of-stream │ ├── expand-template │ ├── fs-constants │ ├── gauge │ ├── github-from-package │ ├── has-unicode │ ├── inherits │ ├── ini │ ├── isarray │ ├── is-fullwidth-code-point │ ├── mimic-response │ ├── minimist │ ├── mkdirp │ ├── ms │ ├── nan │ ├── napi-build-utils │ ├── node-abi │ ├── noop-logger │ ├── npmlog │ ├── number-is-nan │ ├── object-assign │ ├── once │ ├── os-homedir │ ├── prebuild-install │ ├── process-nextick-args │ ├── pump │ ├── rc │ ├── readable-stream │ ├── safe-buffer │ ├── semver │ ├── serialport │ ├── @serialport │ ├── set-blocking │ ├── signal-exit │ ├── simple-concat │ ├── simple-get │ ├── string_decoder │ ├── string-width │ ├── strip-ansi │ ├── strip-json-comments │ ├── tar-fs │ ├── tar-stream │ ├── to-buffer │ ├── tunnel-agent │ ├── util-deprecate │ ├── which-pm-runs │ ├── wide-align │ ├── wrappy │ └── xtend └── x64 └── node_modules ├── ansi-regex ├── aproba ├── are-we-there-yet ├── bindings ├── bl ├── buffer-alloc ├── buffer-alloc-unsafe ├── buffer-fill ├── chownr ├── code-point-at ├── console-control-strings ├── core-util-is ├── debug ├── decompress-response ├── deep-extend ├── delegates ├── detect-libc ├── end-of-stream ├── expand-template ├── fs-constants ├── gauge ├── github-from-package ├── has-unicode ├── inherits ├── ini ├── isarray ├── is-fullwidth-code-point ├── mimic-response ├── minimist ├── mkdirp ├── ms ├── nan ├── napi-build-utils ├── node-abi ├── noop-logger ├── npmlog ├── number-is-nan ├── object-assign ├── once ├── os-homedir ├── prebuild-install ├── process-nextick-args ├── pump ├── rc ├── readable-stream ├── safe-buffer ├── semver ├── serialport ├── @serialport ├── set-blocking ├── signal-exit ├── simple-concat ├── simple-get ├── string_decoder ├── string-width ├── strip-ansi ├── strip-json-comments ├── tar-fs ├── tar-stream ├── to-buffer ├── tunnel-agent ├── util-deprecate ├── which-pm-runs ├── wide-align ├── wrappy └── xtend

But the same error appears.

I’ve also modified the following line

https://github.com/Marus/cortex-debug/blob/12bc8c0c4f17b11b1fb22e218b45732c521863bb/src/frontend/swo/sources/serial.ts#L27

to

vscode.window.showErrorMessage(e.stack);

to get a bit more information, and this is what it says:

Error: Cannot find module ‘serialport’ Require stack:

  • /home/diego/.vscode/extensions/cortex-debug/dist/extension.js
  • /usr/share/code/resources/app/out/vs/loader.js
  • /usr/share/code/resources/app/out/bootstrap-amd.js
  • /usr/share/code/resources/app/out/bootstrap-fork.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:627:15) at Function.Module._load (internal/modules/cjs/loader.js:531:27) at Function.t._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:796:852) at Function.n._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:765:302) at Function.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:761:870) at Module.require (internal/modules/cjs/loader.js:685:19) at n (/usr/share/code/resources/app/out/vs/loader.js:15:524) at Object.serialport (/home/diego/.vscode/extensions/cortex-debug/dist/extension.js:47097:18) at webpack_require (/home/diego/.vscode/extensions/cortex-debug/dist/extension.js:21:30) at new SerialSWOSource (/home/diego/.vscode/extensions/cortex-debug/dist/extension.js:45478:26) at CortexDebugExtension.receivedSWOConfigureEvent (/home/diego/.vscode/extensions/cortex-debug/dist/extension.js:43830:30) at CortexDebugExtension.receivedCustomEvent (/home/diego/.vscode/extensions/cortex-debug/dist/extension.js:43785:22) at l.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47:207) at P.$acceptDebugSessionCustomEvent (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:731:424)

Any clue? what it may be?

I’m using the following config in launch.json:

“swoConfig”: { “enabled”: true, “cpuFrequency”: 72000000, “swoFrequency”: 4000000, “source”: “/dev/ttyUSB1”, “decoders”: [ { “type”: “console”, “port”: 0, “showOnStartup”: true } ] }

I’m using this FTDI-based adapter ( https://github.com/diegoherranz/steppenprobe), but I believe you can test this error with any adapter since this is using an external serial port (/dev/ttyUSB1 in my case) instead of one built with the probe. Even if you didn’t have any serial port, it should be able to load the serialport module and then fail to find that specific serial port, I guess.

I’ve spent a couple of hours testing different nodejs versions and similar stuff, but my knowledge of all this is limited so I’ve had no success.

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Marus/cortex-debug/issues/85?email_source=notifications&email_token=AAD2FLIMCRUIPHH44IL6L63QYAJWVA5CNFSM4FRTFAL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGRFXZQ#issuecomment-564288486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD2FLO74C3NUPS3P2KGST3QYAJWVANCNFSM4FRTFALQ .