Configure VS Code for STM32 development on Windows 10

Viewed 1917

so I am pretty new to STM32 programming. As a part of my project I am using STM32L432KC board from ST. I used the Mbed online compiler to extract the blinky led example. I want to use VS Code, so I installed the C/C++ extensions and I also downloaded and installed GNU Arm Embedded toolchain. But now I am stuck. After trying to build the solution I get this message on terminal: "'make.exe' is not recognized as an internal or external command, operable program or batch file." I know it has something to do with the Makefile. But I need a step by step guide to set everything up, since all the tutorials I found did not help me. I already found simmilar thread here but it was not described deeply enough for me to understand.

2 Answers

I found a solution. Here is the answer by Zoltan Hudak on Mbed page:
How to setup Visual Studio Code

Answer:

Is the make program installed on your system?

  • If yes, make sure its path is added to the PATH system variable.
  • If not, try to install one. The MinGW package seems to be a good choice for MS Windows.

Go to https://sourceforge.net/projects/mingw/.

  • Click on the Download button.
  • When asked select Run and then click on the Install button.

Or install MSYS2. Just follow the installation instructions on the site.
Once installed and running issue the following command from the command prompt:

pacman -S make

Make is indeed one way, another is to build using Mbed CLI, so you don't have to export (and thus lose some functionality that Mbed CLI provides, like repository management). I've put together a VSCode configuration which builds and debugs for STM32 here. The only thing you need to change is the configuration files loaded under debugServerArgs depending on the architecture.

Related