I am trying to create a project to program a Tiva C Series board using VS Code and CMake.
So far, I've managed to make it kinda work, since it builds, flashes and even lets me debug it. However, it was based on sketchy launch.json
and tasks.json
files and I was not happy with it.
So now I'm trying to make it work properly with the CMakeTools extension in a way that I can start the debugger through the button on the bottom navbar provided by the extension. The problem is that it does not seem to use my launch.json
file, so when it launches it uses the wrong debugger path and executable (which were properly pointed by the launch.json
file).
My project currently look like this: my project structure.
It basically consists of a src
folder containing my source code, a CMakeLists.txt
file, a cmake
folder containing the toolchain configuration, a linker file for the Tiva, a .vscode
folder containing the launch.json
and tasks.json
files and the build output directory generated by CMake.
As of right now, if I click on the build command on the CMakeTools extension navbar it builds correctly and flashes to the Tiva using a custom target command in my CMake. But when I click on the debug button it does not launch properly, instead it gives me this output.
This is my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debugger Tiva",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/projeto.axf",
"targetArchitecture": "ARM",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"MIMode": "gdb",
"miDebuggerServerAddress": "localhost:3333",
"externalConsole": false,
"miDebuggerPath": "C:/ProgramData/chocolatey/lib/gcc-arm-embedded/tools/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gdb.exe",
"preLaunchTask": "Launch OpenOCD",
"postDebugTask": "Kill OpenOCD"
}
]
}
As can be seen in this launch.json, the path I wanted to get the debugger from is C:/ProgramData/chocolatey/lib/gcc-arm-embedded/tools/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gdb.exe
, but in the picture in the output it shows that it tried to use C:/ProgramData/chocolatey/bin/arm-none-eabi-gdb.exe
(which does work so it's fine, I guess).
And the biggest problem is apparently it is looking for the launch program as C:/Users/Lucas Yukio/Documents/Projetos Tiva/teste display/build/projeto
which is missing the .axf
extension at the end.
When I launch the debugger using the f5
keyboard shortcut it launches properly, so my best idea is that the extension is not using the launch.json
file I made. Is it correct? And if so, how do I fix it?