Closed daantimmer closed 2 months ago
There is a workaround:
launch st-util
manually and change servertype
to external
:
{
"name": "Debug stm32g474re stlink",
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.launchTargetPath}",
"request": "launch",
"type": "cortex-debug",
"device": "STM32G474RE",
"servertype": "external",
"gdbTarget": "localhost:4242",
"overrideLaunchCommands": [
"monitor reset",
"-target-download",
"monitor reset"
],
"overrideRestartCommands": [
"monitor reset"
],
"runToEntryPoint": "main",
"svdFile": "Keil::STM32G4xx_DFP@1.5.0",
"deviceName": "STM32G474RETx"
}
If you use stutil
instead of stlink
as server type it will do the trick
"servertype": "stutil"
The following is wrong
"servertype": "stlink",
"serverpath": "/usr/local/bin/st-util",
stlink
and st-util
are very different gdb-servers, incompatible, supplied by different people. stlink
from ST Micro is my preferred gdb-server.
Thanks for responding, and pointing me at an error on my side!. However, I can't seem to find this stlink
tool. (Specifically for Linux).
The only thing that I can find is https://github.com/stlink-org/stlink, which, when installed, only installs:
Like I said, stlink is distributed by ST Micro and is part of their install of STMCube32 IDE.
https://www.st.com/en/development-tools/stm32cubeide.html
If you install in the default location, Cortex-Debug will find it automatically. You can also install STMicro's VSCode extension that will auto-generate the launch.json for you
There are hundreds of examples on the web.
https://stackoverflow.com/questions/71066091/problem-understanding-cortex-debug-configurations-in-visual-studio-code-stm32 https://forum.electro-smith.com/t/st-link-and-cortex-debugger-on-ubuntu-24-04/5260
But it all starts by installing the official ST Micro tools. You are taking a scenic route to getting this done. While we don't discourage that, we don't recommend it either.
Right, we don't depend on CubeIDE because we are in a devcontainer (you can call it scenic, we call it modern). We target multiple devices from multiple vendors and our container supports all of them with the same tools :-).
If you search for "stlink Ubuntu" you get pointed at the st-utils repository and not at CubeIDE. There is no mention of Cube whatsoever.
Regardless, thank you for the information regarding stlink
and CubeIDE. That was information that I missed. Also thank you for taking time to respond and pointing me at my error/mistake in a friendly manner :-)
Describe the bug I am using Visual Studio Code with a (linux) devcontainer on windows. We are able to bind our usb devices directly to WSL through usbipd-win. This works flawlessly for a j-link. I am now trying to create a setup for st-links instead.
I've downloaded the st-link sources and build from source to get them installed (1.8 version).
I've setup my launch configuration like:
But, this results in the following way that st-util is executed:
Which is an incorrect, this is the help menu from st-util:
There is no need to set the the cube programmer, or
--swd
or--halt
.To Reproduce Steps to reproduce the behavior:
servertype
:stlink
serverpath
: to whereever st-util is installedExpected behavior able to start debugging through st-util
Environment (please complete the following information):
Please include
launch.json
Note: We are unlikely to look at the issue if you do not supply this
Attach text from
Debug Console
Attach text from `Terminal
Additional context Install st-link tools from source did not work when I followed the build instructions. What I did instead: