Categories
Development

ST-Link V2, vscode and debugging

stlink programmer

I have started using Microsofts VSCode IDE to code just about anything. There are pletora of plugins and the IDE runs on all three major operating systems (Windows, Mac OSX and Linux). The VSCode IDE is free and runs really smoothly.

To transfer code to the microcontroller (using mostly STM32) I have Segger jlink plus programmer, but since I have some ST-Link V2 dongles laying around I often use them. There is .. or should I say was one issue though. When using Segger’s programmer I could use their Ozone environment for debugging the code, but with ST-Link V2 and running it on Mac OSX that was not possible.

There are some “command line” solutions using gdb and a lot of glue code to stick everything together, but I would rather have it in my programming environment so I don’t waste time with different setups.

As mentioned previously I use VSCode and there is an extension called Cortex-debug.

To use it you need to install ARM GCC toolchain. Which is also needed to program the microcontroller so this one is obvious in my opinion. This toolchain provides some glue apps to connect code to the debugger (e.g. arm-none-eabi-gdb …).

After that you need to install GDB debugger and there are many sources for that, but I have choosen the one coming with the Homebrew environment.

That’s basically it.

Leave a Reply

Your email address will not be published. Required fields are marked *