cancel
Showing results for 
Search instead for 
Did you mean: 

VSCode task to flash gives path argument error after update to STM32Cube Debug Core 1.1.0

AHugh.2
Associate III

I have a vscode task that allows me to just flash the application using `cube` which has worked fine until I got the lastest extensions update where now running this task will give a "The "path" argument must be of type string. Received undefined" error. 

The task definition (tasks.json):

"type": "shell",
"label": "Program flash",
"command": "cube",
"args": [
  "programmer",
  "-c",
  "port=SWD",
  "-d",
  "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}",
  "-g"
],
"problemMatcher": [], 

Part of the error log:

025-12-16 23:18:12.319 [error] TypeError: The "path" argument must be of type string. Received undefined
at Object.basename (node:path:911:5)
at n (c:\Users\user\.vscode\extensions\stmicroelectronics.stm32cube-ide-debug-core-1.1.0\lib\extension.js:435:4173)
at c:\Users\user\.vscode\extensions\stmicroelectronics.stm32cube-ide-debug-core-1.1.0\lib\extension.js:435:4493

How can I resolve this?

Thanks!

3 REPLIES 3
Florent V
ST Employee

Hi @AHugh.2 ,

 

Please replace the VSCode command :

${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}

with the path to the binary file.
You can use the variable ${workspaceFolder} or an absolute path

${workspaceFolder}/path/to/the/binary

 

KR,

Flo

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
AHugh.2
Associate III

Thanks for this. However I'm not keen on using explicit paths like this - the previous solution worked nicely since it would deal with configuration/preset changes where the output binary is put into different directories depending on the selected configuration/preset (e.g. debug / release).

Is there any other way to avoid any explicit paths?

To be honest, before it worked by chance and caused problems in other cases.
The arguments received during the resolution of the VSCode command vary depending on the context (launch.json, tasks.json, etc.).
The process is now safer, but less convenient in your case. I will investigate how to improve it.


KR,
Flo

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.