Thanks for downloading VS Code!
STM32 VSCODE Instructions for setting up a development environment for the STM32 family on Windows using Visual Studio Code. Multiple out-of-the-box solutions exists, for example PlatformIO, but having full control over the toolchain can be usefull. Developing Arduino code for STM32 boards with Visual Studio June 18, 2019 arduino, stm32 This tutorial shows how to develop Arduino-based projects for the STM32 boards using the STM32Duino project, Visual Studio and VisualGDB.
Download not starting? Try this direct download link.Want a head start? Watch this 5min overview.
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
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
Now the project can be built. The following options are available to compile the final firmware:
Vs Code Stm32
- 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:
Visual Studio Code Stm32 Cmake
- 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
Hp laserjet p2035 driver mac download. After successful uploading, the green LED2 should start blinking.
Debugging the Firmware
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
:
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
Here are some useful links for exploring the PlatformIO ecosystem:
Visual Studio Code Stm32cube
- 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