Setting up VSCODE for ARM development using the example of the stm32f429i-disco debug board

  • Tutorial


Today we will consider setting up a convenient and beautiful development environment for a microcontroller programmer using a set of completely free development tools.

All steps are checked on a virtual machine with freshly installed Ubuntu 16.04 xenial desktop x64.

It is understood that you already have the source of any project.

All settings relating to a specific hardware (in my case, this is the STM32F429 controller and the STM32F429DISCO devboard) need to be replaced with their own. The same goes for the ways.

If ready, then go

Install curl

sudo apt-get install curl

Vscode installation

curl | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

Install arm-none-eabi toolchain

sudo apt-get install gcc-arm-none-eabi
sudo apt-get install gdb-arm-none-eabi

Install openocd

sudo apt-get install openocd

Run and configure vscode

To run vscode call the command in the terminal code.
Go to the Extensions section (Ctrl + Shift + X) .
We are looking for and install the following plugins:

  1. Cortex-Debug by marus25.
  2. C / C ++ from Microsoft.

Open the folder with the project through the menu File / Open Folder .
Go to the Debug section (Ctrl + Shift + D) .

At the top in the drop-down line we see the text No configurations .

Click on the gear next to it, drop down a menu with a proposal to create a configuration for debug, choose Cortex-Debug .

In the project directory, a hidden .vscode folder is created , in which a file with launch.json debug configurations is created .

If this file does not open itself, open it with your hands: go to the Explorer section (Ctrl + Shift + E) and select this file in the tree.

Configuring the configuration for openocd:

"configurations": [
        "name": "openocd",
        "request": "launch",
        "type": "cortex-debug",
        "cwd": "${workspaceRoot}",
        "servertype": "openocd",
        "executable": "build/lol.elf",
        "svdFile": "STM32F429.svd",
        "configFiles": [

The last three properties: the location of the elf file, the location of the svd file, the path to the configuration for openocd, are customizable.

Save the launch.json file and go to the Debug section again, we’re convinced that our configuration appeared in the drop-down menu.

Next, go back to the Explorer section and in the .vscode directory add a new file named settings.json , open it, write the following there:

    "cortex-debug.armToolchainPath": "/usr/bin",
    "cortex-debug.openocdPath": "/usr/bin/openocd"

Next, we add another c_cpp_properties.json file to .vscode , open it and write the following there:

    "configurations": [
            "name": "vscode_stm32_c_cpp_properties",
            "compilerPath": "/usr/bin/arm-none-eabi-gcc",
            "includePath": [
            "defines": [
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
    "version": 4

By pressing F5, you can start debugging (do not forget to build a project before this, so that the elf file will be in the right place).

Also popular now: