Thanks for downloading VS Code!
- Stm32 Programming Visual Studio Code
- Visual Studio Code Stm32 Cmake
- Stm32 Vscode Windows
- Visual Studio Code Stm32cube
- Vscode Stm32 Gcc
- Visual Studio Code Openocd Stm32
Want a head start? Watch this 5min overview.
STM32 with Visual Studio Code Posted on August 13, 2017 by Jan Visual Studio Code is more an editor with debugger support than a full IDE, it takes a bit fiddling to set up and get right. Basically you don’t have any setup screens and have to edit your project in files with XML syntax. After using Eclipse for some time, I have come to a state where Visual Studio Code is more appealing. Because Eclipse messed up my repo once again. And I want to try something out with Visual Studio Code. I like the interface and also its speed. The extensions are getting more available and even when you want to code with ARM/GNU. STM32 commercial IDEs Provider Product and labels Cores Framework Compiler Debugger in x OS X Safety edition Free edition or Proprietary Eclipse use, limitation IAR Systems EWARM All IAR IAR Code limit: 32KB Arm KEIL MDK5-Cortex-M All llvm / ARM uVision Code limit: 32KB Emprog ThunderBench All gcc OpenOCD Time limit: 30-day iSystem iSYS-WinIDEA All gcc, others gdb WinIDEAOpen.
Continue with Customize VS Code or browse all intro videos.
Please take a few seconds and help us improve ... click to take survey.
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity). Begin your journey with VS Code with these introductory videos.
Visual Studio Code in Action
Intelligent Code Completion
Code smarter with IntelliSense - completions for variables, methods, and imported modules.Streamlined Debugging
Print debugging is a thing of the past. Debug in VS Code with your terminal tools.Fast, Powerful Editing
Linting, multi-cursor editing, parameter hints, and other powerful editing features.Code Navigation and Refactoring
Browse your source code quickly using peek and navigate to definition.In-Product Source Control
Speed up your release cycle with SCM support inside your editor, including rich Git integration.Top Extensions
![Stm32 Stm32](https://i.ytimg.com/vi/dany7ae_0ks/maxresdefault.jpg)
Enable additional languages, themes, debuggers, commands, and more. VS Code's growing community shares their secret sauce to improve your workflow.
First Steps
To get the most out of Visual Studio Code, start by reviewing a few introductory topics:
Intro Videos - Begin your journey with VS Code through these introductory videos.
Setup - Install VS Code for your platform and configure the tool set for your development needs.
User Interface - Introduction to the basic UI, commands, and features of the VS Code editor.
Settings - Customize VS Code for how you like to work.
Languages - Learn about VS Code's support for your favorite programming languages.
Node.js - This tutorial gets you quickly running and debugging a Node.js web app.
Tips and Tricks - Jump right in with Tips and Tricks to become a VS Code power user.
Azure - VS Code is great for deploying your web applications to the cloud.
Extension API - Learn how to write a VS Code extension.
Why VS Code? - Read about the design philosophy and architecture of VS Code.
Keyboard Shortcuts
Increase your productivity with VS Code's keyboard shortcuts.
Keyboard Shortcut Reference Sheet - Learn the commonly used keyboard shortcuts.
Keymap Extensions - Change VS Code's keyboard shortcuts to match another editor.
Customize Keyboard Shortcuts - Modify the default keyboard shortcuts.
Downloads
Download VS Code - Quickly find the appropriate install for your platform (Windows, macOS and Linux)
Privacy
By default, VS Code auto-updates to new versions, and collects usage data and crash report information. You may opt out of these defaults by disabling them as instructed below:
This guide will help you take the first steps with programming STM32 microcontrollers using the PlatformIO ecosystem. The goal of this guide is to show you how simple it is to set up PlatformIO with Visual Studio Code and use it to compile, upload, and debug STM32Cube-based application on the STM32 Nucleo-F401RE
board.
What is PlatformIO?
PlatformIO is a professional collaborative platform for embedded development that includes lots of instruments for the most common development tasks. It has out-of-the-box support for STM32 microcontrollers and allows working with low-level libraries like CMSIS, STM32Cube, and LibOpenCM3 as well as with popular high-level frameworks like Arduino, Mbed, or Zephyr without changing your development environment.
A detailed overview of the PlatformIO ecosystem and its philosophy can be found in the official documentation.
Installation
Some software needs to be installed before diving into the development process. In this guide Visual Studio Code is used as the editor. The most up-to-date and detailed installation instructions can be found in the official PlatformIO IDE for VSCode documentation.
Once the PlatformIO IDE is ready, the ST STM32 development platform can be installed. This way PlatformIO will do all the heavy lifting by installing everything that is needed (toolchain, framework, etc) automatically. The easiest way to install any development platform is the PlatformIO Home App:
When all installation steps are completed, a dialog window will pop up to tell you that the ststm32
platform has been installed.
Creating a project
The same PlatformIO Home App is used to create a new project:
In the next step, ST Nucleo-F401RE
should be selected as the development board, STM32Cube
as the framework, and a path to the project location (or use the default one):
Please note:
Processing the selected project may take a considerable amount of time as PlatformIO will download and install all required packages. After these steps a fully configured project is ready for developing code with the STM32Cube framework.
Now some actual code can be added to the project. Firstly, a new file main.c
should be created in the src
folder. Right click on the src
in the project window:
with the following contents:
After this step the project is ready for compiling and uploading.
Compiling and Uploading the Firmware
![Studio Studio](https://zhihaoruan.xyz/images/screenshot-vscode-tutorial-3.png)
Stm32 Programming Visual Studio Code
Now the project can be built. The following options are available to compile the final firmware:
- Build option on the
Project Tasks
menu - Build button on PlatformIO Toolbar
- Command Palette
View: Command Palette > PlatformIO: Build
- Task Menu
Tasks: Run Task... > PlatformIO: Build
cmd-alt-b / ctrl-alt-b
hotkeys
If everything went well, the successful result should be printed in the terminal window:
If you see errors, please check your typing carefully and try again.
The following options can be used to upload the firmware to the board:
- Upload option on the
Project Tasks
menu - Upload button on PlatformIO Toolbar
- Command Palette
View: Command Palette > PlatformIO: Upload
- Task Menu
Tasks: Run Task... > PlatformIO: Upload
cmd-alt-u / ctrl-alt-u
hotkeys
After successful uploading, the green LED2 should start blinking.
Visual Studio Code Stm32 Cmake
Debugging the Firmware
Stm32 Vscode Windows
PlatformIO offers the easiest way to debug your applications. To start a debugging session you can use the Start Debugging
option in the PlatformIO Quick Access
menu, Debug: Start debugging
from the top menu, or the hotkey button F5
:
Visual Studio Code Stm32cube
The initialization of a debug session will take some time and when the first line after the main
function is highlighted the project is ready for debugging:
During a debug session it’s possible to step through the code using control buttons, set breakpoints, see peripheral registers, and add variables to the Watch
window:
Conclusion
This guide showed how to start developing for STM32 microcontrollers from within Visual Studio Code and the PlatformIO ecosystem. The project created throughout this guide can be used as a boilerplate for the next projects based on the STM32 Nucleo-F401RE
board.
Next steps
Vscode Stm32 Gcc
Here are some useful links for exploring the PlatformIO ecosystem:
Visual Studio Code Openocd Stm32
- Try other frameworks that can be used with the STM32 microcontrollers
- Learn more about integrations with other IDEs/Text Editors
- Check out additional tutorials and examples
- Get help from the PlatformIO community
![](https://cdn-ak.f.st-hatena.com/images/fotolife/r/ruriatunifoefec/20200910/20200910011346.png)