Open Joebeazelman opened 1 year ago
@Joebeazelman What extension do you use for debug?
As a workaround you can set correct PATH
environment variable in the workspace
I'm using cortex-debug. Is this recommended for debugging microcontroller firmware?
I'm using cortex-debug. Is this recommended for debugging microcontroller firmware?
@Joebeazelman we can't help on that unfortunately, it really depends on the microcontrollier.
Regards,
If you still need this information ... You need to create a launch.json file inside .vscode occult folder to debug with VSCode. Here is a simple example for the cortex-debug plugin:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"name": "Ada: Debug (cortex-debug/ST-Util) main - src/blocking/demo_string.adb",
"request": "launch",
"cwd": "${workspaceFolder}",
"executable": "${workspaceFolder}/exec/string_polling.elf",
"svdPath": "${workspaceFolder}/STM32F429.svd",
"servertype": "stutil",
"v1": false,
"serverArgs": ["--connect-under-reset --semihosting"],
"preLaunchTask": "ada: Build current project",
"armToolchainPath": "",
"gdbPath": "arm-eabi-gdb",
"showDevDebugOutput": "raw"
}
]
}
"name" is anyone you choose, "executable" is the file you will use to flash your program into your board, "svdPath" is the SVD file of the microprocessor of your board, "servertype" is the debug server you are using that, in this case, is from ST-Link, "gdbPath" is the debugger for your microprocessor, that in this case is in the PATH, if not you must put the full path.
You may get full information at cortex-debug.
I figured out the problem. There was something wrong with the gdb I was using. I switched to the official ARM gdb and I worked.
While trying to debug a microcontroller project, VSCode launches the debugger from another toolchain path instead of the project's toolchain path set by Alire. When I inspect the toolchain prefix environment variables in the terminal, it's not set. When I eval $(alr printenv), the debugger launches correctly.
As an added note, I tried to see if it would work by launching vscode using "alr edit" and it didn't open my project. I'm not sure if this is a bug or if there's something wrong with my configuration.