Posts

Showing posts from February, 2024

How to develop STM32 with VScode? part 1/2

Image
  Introduction When you start programming microcontrollers, usually you use some IDE (integrated development environment). That is convenient - you just select your board, plug it into your computer and start writing your program. But maybe someday you ask yourself: how is it possible that code from your PC is toggling LEDs on your Nucleo board? Let's summarize everything from writing code through flashing it to debugging and viewing register values. This post will discuss the integration of VScode, CMake, OpenOCD, and Cortex-Debug for STM32 development. Basic theory Firstly, you need to create your code. You can do it in every text editor e.g. Notepad, Word, Eclipse or VScode.   When you have the text (code) written in C or C++ you need to compile it -> translate a source code into machine code, bytecode which will be understandable for the microcontroller. The compiler looks for errors and optimises the final binary code (those .bin files made with zeros and ones). At this poi