In the latest version of the cortex-debug extension, debugging starts before the code is fully compiled. This means that the compilation process runs in parallel with the debugging process. As I understand it, this is related to the specifics of how the ARMCLANG compiler is launched. A similar issue occurs when restarting the debugger, as the build task always runs.
tasks.json
{
"label": "build",
"type": "shell",
"command": "${command:eide.project.build}",
"group": "build",
"problemMatcher": "$gcc"
},
launch.json
{
"cwd": "${workspaceFolder}",
"executable": "./Output/Debug/Project.elf",
"name": "Debug with ST-Link",
"request": "launch",
"type": "cortex-debug",
"runToEntryPoint": "main",
"showDevDebugOutput": "none",
"servertype": "stlink",
"liveWatch": {
"enabled": true,
"samplesPerSecond": 4
},
"preLaunchTask": "build",
"svdFile": ".pack/Keil/STM32F4xx_DFP.2.14.0/CMSIS/SVD/STM32F429x.svd",
"v1": false,
"serverArgs": ["-m","0"],
}
I tried to solve the problem as you suggested in one of the threads, but with that option, the ELF file is not generated, although it is created normally through the standard build.
{
"label": "debug build",
"type": "shell",
"command": "unify_builder",
"args": ["-p", "Output/Debug/builder.params"],
"group": "build",
"problemMatcher": "$gcc"
},