3 Visual Studio Code Extensions Embedded Developers Can’t Live Without
These Visual Studio Code extensions could help you customize your embedded software development.
November 30, 2023
At a Glance
- Visual Studio Code is customizable through extensions.
- Of the several extensions available, these three could accelerate embedded software development.
- Learn about Cortex-Debug, Github Copilot, and Peripheral viewer.
If you’re like most embedded developers, you probably use your silicon vendor's integrated development environment. These IDEs come packed with many features, but they often aren’t customizable to fit a modern developer's workflow. One alternative that has been gaining popularity amongst developers is Visual Studio Code (VS Code). VS Code provides developers with a flexible source code editor that is customizable through extensions. In today’s post, we’ll explore three of my favorite extensions that have helped me dramatically accelerate my embedded software development.
Visual Studio Code Extension #1 : Cortex-Debug
The biggest issue I often see embedded software developers encounter when using Visual Studio Code is figuring out how to debug their microcontrollers. Embedded software is different from other software development areas because we must get into the bits and bytes of the hardware. There is a wide range of extensions developers can use to interact with gdb and openOCD to allow them to debug their microcontrollers seamlessly, just like in an Eclipse-based IDE.
My favorite debug extension is Cortex-Debug. Cortex-Debug provides ARM Cortex-M GDB debugger support for Visual Studio Code. It’s an open-source initiative supporting J-Link, ST-Link, and other debuggers. It doesn’t support SWO yet, a very useful debug tool. However, I have found that if you are just starting with VS Code, Cortex-Debug is one of the easier extensions to set up and configure for working with an embedded target.
Visual Studio Code Extension #2: Github Copilot
Another extension that will change how you develop software is Github Copilot. It’s an AI pair programmer extension that suggests code in real-time. If you like the code that it suggests, you can just click the tab button and the code will populate your IDE. While it’s suggestions are not always 100%, I’ve found that in many cases it can get you 60 – 80% of what you need. A few edits and adjustments and you’ll reach your end goal faster than if you had to type out the implementation yourself.
The use of an AI pair programmer might seem a bit strange or be something that you wouldn’t trust. However, it’s amazing how quickly you become used to it! I was recently working on updating some lab materials for one of my courses that does not use VS Code. It was painfully obvious how used to the code suggestions I’d become because I constantly noticed that the IDE was not taking my comments and turning them into code or suggesting what I might want to do next.
Using an AI extension like Github Copilot can dramatically help you speed up your software development. Just keep in mind that you can’t fully trust it. If anything, it’s helpful to save some typing and get some of your implementation onto the screen before you go back and edit it.
Visual Studio Code Extension #3: Peripheral Viewer
If you want to debug an embedded target and peer into the hardware registers, you’ll need some method to understand and display the memory map. Peripheral Viewer is an extension that will read your microcontroller's SVD file. The extension works with Cortex-Debug and any debugger that supports the Microsoft Debug Protocol. All you need to do is specify the SVD path in your launch configuration, and the extension will read the details and provide an interface for displaying the peripheral view.
An example configuration would include the “svdPath” configuration, which might look like the following:
{
...
"svdPath": "${workspaceFolder}/STM32F103.svd"
...
}
Conclusions
Visual Studio Code is a flexible, scalable, and customizable source code editor. While embedded developers are often used to having a full-blown IDE provided to them, VS Code allows you to customize your workflow for what works best for you. Each developer can customize their editor with the configurations and extensions that help them work efficiently. The number of extensions available for embedded developers is quite mind-boggling. Some extensions range from showing unused white space like Trailing Spaces to debugging embedded targets with RTOS-aware debugging (Embedded Tools). If you aren’t using VS Code to develop embedded software today, it’s a tool that you might find will help take your development to the next level.
About the Author
You May Also Like