[ERR_INVALID_ARG_TYPE] when trying to debug using VSCode & the ST LINK-V3

Hello,
I can successfully flash and run programs on my Daisy pod directly and via the ST LINK-V3 mini debugger on my Mac.

However, when I attempt to debug my program…

  1. press F5 to enter debug mode
  2. text scrolls past in the terminal window ending with “Terminal will be reused by tasks, press any key to close it.”
  3. an error window appears with TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received null at validateString (internal/validators.js:124:11) with a prompt to open the projects (e.g. blink) launch.json file.

Any ideas on how to fix this would be appreciated, thanks!

What does your launch.json file look like? Something somewhere is trying to pass a non string into cortex debug where it expects a string.

1 Like

Here’s the launch.json code for the blink example…

{
“configurations”: [
{
“configFiles”: [
“interface/stlink.cfg”,
“target/stm32h7x.cfg”
],
“cwd”: “${workspaceFolder}”,
“debuggerArgs”: [
“-d”,
“${workspaceRoot}”
],
“executable”: “${workspaceRoot}/build/Blink.elf”,
“interface”: “swd”,
“name”: “Cortex Debug”,
“openOCDLaunchCommands”: [
“init”,
“reset init”
],
“preLaunchTask”: “build_all_debug”,
“preRestartCommands”: [
“load”,
“enable breakpoint”,
“monitor reset”
],
“request”: “launch”,
“runToMain”: true,
“servertype”: “openocd”,
“showDevDebugOutput”: true,
“svdFile”: “${workspaceRoot}/.vscode/STM32H750x.svd”,
“type”: “cortex-debug”
}
],
“version”: “0.2.0”
}

Also, I’m not modifying the file. I’m opening the DaisyExamples which compile and deploy to the Seed/Pod hardware just fine, it’s just when I try to debug that I get the issue.

And just to confirm the hardware setup…

  • I have a daisy pod, with the usb connected to the seed (mounted to the pod) and the other end to my computer
  • I have the STLINK v3 usb connected to the computer as well
  • I have the STLINK v3 connected to the daisy pod via the ribbon cable

Thanks

Yeah I was just curious since that was what it suggested you open.
your hardware setup sounds fine. If it worked for flashing, it’s fine for debugging.

Do you have any more information about the errors you’re getting? I’d like to know what the path argument actually is, and where it’s coming from.

The dialog window that appears when the error occurs contains this text…
TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received null
at validateString (internal/validators.js:124:11)
at Object.isAbsolute (path.js:1029:5)
at _.normalizeArguments (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:9:7987)
at _.launchAttachInit (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:9:7020)
at _.launchRequest (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:9:7760)
at _.dispatchRequest (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:1:10427)
at _.handleMessage (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:9:42615)
at _handleData (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:9:44337)
at Socket. (/Users/jdoe/.vscode/extensions/comp2300-anu.cortex-debug-0.3.19/dist/debugadapter.js:9:42947)
at Socket.emit (events.js:315:20)

I wonder if it has anything to do with the location of your project (assuming you’re working in the DaisyExamples hierarchy or something similar to it).

I don’t think it would matter, but is your project in a folder with spaces? I’m trying to recall if I’ve tried to use any paths with spaces on either OS with Daisy.

Unfortunately these issues occur with the examples, e.g. Blink, Chorus, etc. I haven’t started with my own code yet.

Per the setup instructions, I cloned the DaisyExamples folder to my desktop
example paths:
Desktop/DaisyExamples/seed/Blink
Desktop/DaisyExamples/seed/Chorus
Desktop/DaisyExamples/pod/MultiEffect
etc…

Thanks!

Assuming I can’t get this working soon, is there an alternative method for monitoring my code’s variables in real-time while the hardware is running? In the past I’d use printf or debug.print to send variable info to an output/console window. Is there an equivalent for the daisy hardware? Or would I have to do something more significant like adding LCD screen support to my daisy circuits?

Again any assistance is appreciated, Thanks!

Regarding alternative debugging: I’ve been using the Logger class to great effect.
Here’s a sparse example:

Logger<> logger;
int main(){
    Logger.StartLog();
    for(int i = 0; i < 100; i++){
        Logger.Print("i = %d\n", i);
    }
}

Obviously you’ll need all of the other usual daisy setup stuff in there.
You can read the output over USB with a serial monitor. I’ve been using the one built into Arduino since I already have it installed.

Regarding fixing the debug probe issue: it’s some kind of cortex debug error for sure.
The google results point to this being an issue with angular.
Cortex debug is written in typescript so there’s your smoking gun.

Have you been doing any javascript development on your machine?

Just to confirm, I’m using VS Code, so I can add this to my VS Code program and have Arduino IDE’s serial port open as well. Or do I need to do all of this in the Arduino IDE?

Thanks!

Nope no Javascript dev on my computer and thanks again for helping me dig into this, I appreciate it!

I’ve been finding the serial monitor built into the VScode Arduino Extension very useful. You need to open the serial port and monitor each time you flash, but you don’t have to change to a different window/process (Arduino IDE).

Just a wild guess, in addition to setting up the VS Code dev environment, I also installed the Arduino dev environment as well, would this cause a conflict?

You can add that stuff to your CPP programs in VS Code. If you have a serial monitor you like using in VS Code that’s even better. I just suggested the Arduino one as a quick hack.

Good to note here, if you’re developing on Arduino, you can use Serial there. You might think of our Logger class as our version of Arduino’s Serial.

Also, there’s no conflict between having the cpp and arduino environments installed side by side.

So, I had an older Mac laptop (mohave) lying around and I was able to successfully debug on it, using VS Code :smile: So at least I’m unblocked and over time I can figure out why my iMac Desktop setup won’t work.

Speaking of the Mohave OS, if you’re running on Mac as well, is there any risk upgrading to Big Sur?

Thanks again for all your help!!!

Glad to hear it!
I’ve tested the setup out on Big Sur, everything should still work fine.

Cool, thank you, I’ll upgrade as well.