...
VSCode (Visual Studio Code) is probably the most popular IDE for software development because of its versatility and lightweight framework. You can go from writing C++ to Python to Javascript to HTML in a single IDE, with tools you can download for formatting and writing each language. For the software development in NER, we typically prefer using Visual Studio Code, just because it is lightweight and easy to install and doesn’t end up with weird file names or project files like some other IDEs. VSCode also works on macOS, Linux, and Windows, and operates pretty much the same across all of them. VSCode is simple, effective, cross-platform, and powerful.
Downloading VSCode
To download VSCode, you just need to go to this link to install it on your machine. Then follow the instructions in the installation wizard, making sure to add any “open with code” options you see. For Windows, you may also want to add to PATH.
Little VSCode Overview
...
VSCode is essentially just a normal text editor on steroids. On the left side of the screen, you got some of the main functionality of the IDE. VSCode works best when you open a directory, which you can do by clicking File
in the top left, and then choosing Open Folder
. You can also edit single files by opening a file with VSCode, or by going to File
and then Open File
.
In order, the icons under the blue VSCode logo in the top left are:
File Explorer
Let’s you open, make, delete files and directories
Search
Let’s you search the whole project for a word or phrase, and let’s you replace it too
Source Control
Integrates with Git to help you track what changes need to be added/committed
I’m not a big fan of using this, I like using Git in the Command Line better
Debug
Allows you to run your code step by step to find bugs
I haven’t really ever used this, it is especially useless for embedded code and firmware
Remote Explorer
...
Lets you SSH into other computers and develop on them
Extensions
This is the true bread and butter of VSCode, where you can download extensions that the community/VSCode has made to help format your code, check for syntax errors, build code, etc.
There’s even an extension where you can get a virtual pet for while you code
This is where you can install PlatformIO and STM32 VSCode Extension
Testing
This is where users can write and utilize testing scripts/frameworks to test their code before releasing it
...
PlatformIO
icon, which I’ll go into more depth about in the next sectionSTM32
icon, which I’ll go into more depth about later, too
Installing PlatformIO
To install PlatformIO, navigate to the Extensions
tab on the left and search for PlatformIO
, then install it. That is essentially it. I have seen a bug where you can’t have spaces in your username, specifically for Windows, so keep in mind that this is just an open-source project and might have a few bugs.
Little PlatformIO Overview
Think of PlatformIO as essentially a better ArduinoIDE. It integrates with VSCode and it has support for a large amount of boards. I especially like how you can separate code into multiple header and source files to organize your code. The club used to use PlatformIO to drive all embedded code development, but now it is mostly used for testing and prototyping.
PlatformIO “projects” are defined by directories with a valid platformio.ini
file in them. For example, the Embedded_Code
repo has 2 PlatformIO projects in it: MPU and TCU. To open the PlatformIO project, either click on File -> Open Folder
then open the directory, or (for Windows) right-click in the file explorer in the project directory and click Open with Code
if you have the option set up for VSCode. You can also open VSCode via the CLI by typing code <Directory you want to open>
.
...
Above is a picture of the basic PlatformIO UI bar. The buttons that matter the most (starting from the Home Icon near the middle bottom) is
PlatformIO: Home
This brings you to the homepage for setting up a PlatformIO project/libraries
PlatformIO: Build
This compiles your code to make sure it builds
PlatformIO: Upload
This actually uploads the code to the board
Note you need to be connected to the board via a serial connection
PlatformIO: Serial Monitor
This begins a serial monitor of whichever COM/dev port the board is using
This is where you can view
Serial.print("")
statements, similar to Arduino IDE
PlatformIO: New Terminal
Just opens a new terminal
Installing STM32 VSCode Extension
List of STM tools to download to get it to work, this includes some command line tools, chip configuration tools, and some IDE tools that are used for development:
https://www.st.com/en/development-tools/stm32cubeclt.html
https://www.st.com/en/development-tools/stm32cubemx.html
https://www.st.com/en/development-tools/st-mcu-finder-pc.html#get-software
https://www.st.com/en/development-tools/stm32cubeide.html#get-software
Then navigate to the Extensions
tab on the left and search for STM32 VS Code Extension
, specifically the one by ST, then install it. That is essentially it.
To actually open a project, navigate to the folder/directory that the STM32 project is in and open it in VSCode. This should automatically start up everything. Note that this is a somewhat non-traditional and new way of developing code for STM32, and the typical way is to just use STM32CubeIDE. However, it is important to learn about VSCode since that is what a LOT of people use in industry for a majority of languages.