Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

  1. File Explorer

    1. Let’s you open, make, delete files and directories

  2. Search

    1. Let’s you search the whole project for a word or phrase, and let’s you replace it too

  3. Source Control

    1. Integrates with Git to help you track what changes need to be added/committed

    2. I’m not a big fan of using this, I like using Git in the Command Line better

  4. Debug

    1. Allows you to run your code step by step to find bugs

    2. I haven’t really ever used this, it is especially useless for embedded code and firmware

  5. Remote Explorer

    1. Lets you SSH into other computers and develop on them

  6. Extensions

    1. 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.

    2. There’s even an extension where you can get a virtual pet for while you code

    3. This is where you can install PlatformIO and STM32 VSCode Extension

  7. Testing

    1. This is where users can write and utilize testing scripts/frameworks to test their code before releasing it

  8. PlatformIO icon, which I’ll go into more depth about in the next section

  9. STM32 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

  1. PlatformIO: Home

    1. This brings you to the homepage for setting up a PlatformIO project/libraries

  2. PlatformIO: Build

    1. This compiles your code to make sure it builds

  3. PlatformIO: Upload

    1. This actually uploads the code to the board

    2. Note you need to be connected to the board via a serial connection

  4. PlatformIO: Serial Monitor

    1. This begins a serial monitor of whichever COM/dev port the board is using

    2. This is where you can view Serial.print("") statements, similar to Arduino IDE

  5. PlatformIO: New Terminal

    1. 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.