2025-10-10 3:21 AM
Hello,
I'm struggling with setting up a environment to develop Zephyr applications using VS Code. I've little to no knowledge about VS Code, Zephyr and the underlying build system. I only used STM32CubeIDE in the past.
What I have so far is a dedicated computer running Ubuntu, VS Code, Zephyr & Zephyr IDE extension for VS Code. I'm able to build e.g. the blinky example and I also can download it. Attaching to a running target is not possible.
The launch.json file has been automatically created by Zephyr IDE and should provide configurations for launching (flash the MCU + debug with breakpoint at main()) and attaching (connect to MCU without flashing, probably halting the MCU). Interestingly, there was no difference in the behaviour of those configurations. Both flashed and connected to the MCU. So, by digging deeper into that launch mechanism I realized that both configurations used 'launch' as the request type. I changed the type to 'attach' for the corresponding attach configuration, which should be the correct request as far as I can tell. However, the ST Link GDB server immediately quits, stating that the ST device couldn't be verified.
Now I'm lost in space because I couldn't find any information on how to narrow down the issue. I tried to find working examples for the launch configuration file and some of them indeed had only a different request type (launch vs attach). However, those configurations have been created for build systems other than Zephyr IDE. It looks like every system uses different settings, approaches etc. and it's hard to understand at the beginning.
So, where can I find informations about how the whole stuff works under the hood? For example, with which default parameters is the debug server being called if using launch/attach request type?
Is anyone using VS Code + Zephyr IDE and can provide a working configuration file example? So I can compare against my configurations.
Regards