Code-level debugging EmbeddedSwift app in STM32CubeIDE

I’ve managed to build my first executable using armv7em-none-none-eabi for ST32 and got a blinking LED on my custom hardware.

I am flashing, and trying to debug it from STM32CubeIDE. I can setup my debugger to point to my .elf file, and it flashes and runs correctly, but it is not picking up any source files and I can only step through the assembly.

I tried adding “-g” to the build options, but it made no difference.

I tried doing a “debug” build instead of release but this failed to link, overflowing my flash with megabytes.

Is there a way to have some level of code-level debugging?

Greetings !

The best I’ve managed to get is pyOCD + lldb from terminal.
But I’m working with bare metal micro:bit.
In my case linker was stripping debug information, so make sure to include all the DWARF debug sections in your linker script.

It’s probably possible to get some VS Code extension working one you’ve verified that lldb from console works. Haven’t looked into VS Code extension support yet.