nRF Connect for VS Code

nRF Connect for VS Code

Change log

  • 31/08/2021 10:00 AM - Ali Aljaani - Initial blog.
  • 22/09/2021 11:00 AM - Ali Aljaani - Changed download procedure from external VSIX file to integrated in Visual Studio Marketplace.

Introduction

Welcome to the nRF Connect for Visual Studio Code (VS Code). The nRF Connect extension lets you develop, build, and debug applications based on the nRF Connect SDK using the VS Code Integrated Development Environment (IDE). In this article, we introduce the nRF Connect for VS Code and its features, and show you how to get started with it.

nRF Connect for VS Code InterfacenRF Connect for VS Code Interface

nRF Connect for VS Code

VS Code is a fast, cross-platform, and popular IDE. Nordic Semiconductor’s nRF Connect extension turns VS Code into a complete IDE for developing applications for nRF91, nRF53 and nRF52 Series devices on Windows, macOS or Linux. This includes an interface to the compiler and linker, an RTOS-aware debugger, a seamless interface to the nRF Connect SDK, and a serial terminal.

The provided support for VS Code comes as a bundle(pack) of extensions. The bundle consists of:

  • nRF Connect for VS Code, the main extension, which contains an interface to the build system and nRF Connect SDK, as well as external tools such as guiconfig. 
  • DeviceTree for the Zephyr Project, which provides DeviceTree language support.
  • Kconfig for the Zephyr Project, which provides Kconfig language support.
  • nRF Terminal, a serial and RTT terminal.

Please note that more extensions might be added to the bundle over time.

The bundle helps with setting up new nRF-based applications based on a set of examples from the nRF Connect SDK and Zephyr. You can then configure them using the guiconfig feature available from the Zephyr Project. You can also define your own boards within the Zephyr rule set. The DeviceTree viewer displays the configured hardware and helps you navigate the DeviceTree source.

This bundle is based entirely on Zephyr tools, so you can continue your project from the command line at any point. You can also split the development between people with different OS preferences using your company’s internal revision control system. Even more features are still in development. With additional extensions from Microsoft for C/C++, or others for Git, you can spend your complete development life inside this environment.

Getting started with nRF Connect for VS Code

We’ve made a series of videos you can access through links within the extension itself showing how to use the extension. These are under continuous development and will change as more features are added to the extension. You can view all videos from this playlist:

Tutorial Videos

As explained in the first video, to install the bundle(extension pack), open the Extensions menu from the VS Code toolbar and type Nordic, select nRF Connect Extension Pack and click on Install as shown in the illustration below:

Open the extension by clicking the icon in the red square shown in the figure below and set up the basic configuration (green). You’re now ready to build an application. Open the walk-through (yellow) for the built-in training and links to the walk-through videos.

Setup basic configuration

The nRF Connect for VS Code extension is undergoing continuous updates. Written documentation is available in the readme file published as part of the extension bundle. You can find it by clicking nRF Connect (as shown in the screen shot below) in the Extensions menu in the VS Code toolbar. During testing, please check the Known Issues chapter if you encounter issues.

Stay tuned as more features and video tutorials are under development and will be available to you soon. If you have any issues related to this bundle, please submit a DevZone ticket.

ENJOY!

  • Using windows and Thingy:91 and connect with USB. It do not show up in Connected devices, Should it?

  • Excellent quick response from Nordic Semi Support Engineering. Thank you Vidar for the workaround, for my nRF Connect for VS Code issue on macOS. 

    Hopefully, the next nRF Connect extension release will have a proper fix.

    On macOS (11.6, 10.13.6, and 10.14.6), the nRF Connect extension attempted to select PyOCD when it sees that a J-link (e.g. Segger J-Link Edu Mini) is already connected. The workaround was to modify the board.cmake (in my case, particle_xenon) in the Zephyr directory in order for the nRF Connect to flash. The include with nrfjprog had to be made the default runner by moving it to the top of the includes.

    Now, I’m able to build and flash programs to my nRF52840 particle_xenon boards without any issues. Awesome!

    The nRF Connect for VS Code environment is turning out to be superb. I’m certain that as new features get added and the extensions made more robust, we’ll have an excellent dev environment. So many things to checkout with nRF Connect, including testing out debug functionality.

    Once more, kudos to Nordic Semi for the excellent nRF Connect for VS Code and their highly professional Support Engineering.

  • Currently, under macOS 10.16,  I can create a new project and build it without any issues. However, none of my nRF52840 boards appear under the CONNECTED DEVICES tab and therefore cannot flash the programs. 

    When I run the nRF Terminal, nRF Connect/VSC sees the nrf52840 board and I can connect to it. The VSC status bar acknowledges the connect but nothing appears under the CONNECTED DEVICES tab.

    It looks like the nRF Connect extension under macOS isn’t quite working yet. It would be great to get a fix, as the nRF Connect for VSC looks excellent and very promising for the future. Thank you.

  • This is excellent development regarding support nRF Connect support for VSC. Looking forward to enhancements.

  • In this beta version, you could go to File->Preferences-> Settings->Extensions -nRF Connect  and edit the 'Board Roots' setting to include a path to the directory that includes your 'boards' folder. Please note the extension also includes a wizard that helps in creating new boards.