Migrating from other IDEs to VS Code¶
If you have used the command line or other IDEs for work with the nRF Connect SDK, such as SEGGER Embedded Studio (SES), you can migrate to the Visual Studio Code and download the nRF Connect for Visual Studio Code extension pack to continue your work in the new environment. The extension pack includes everything you need to build, edit, and debug your application. This includes the recommended third-party extensions for C/C++, Cortex Debug, GNU Linker Map Files, and CMake support for VS Code.
Add an existing application¶
Use the extension's GUI to add an existing application. Complete the following steps:
From the Welcome View, click Add an existing application.
Select the root directory of the application you want to migrate into VS Code.
A popup may appear and ask if you want to change the nRF Connect SDK version path. Click Yes and confirm the SDK version at the top of the screen when the dropdown menu appears.
Another popup may appear after the SDK version is set. This will ask you to change the toolchain path to a version compatible with the SDK. Click Yes.
The imported application will appear in the Applications View.
Read more about how to open an existing application in the Creating an application page.
Creating a new application¶
To create a new application, click on the Create a new application action in the Welcome View. This opens the New Application wizard, where you can select which version of nRF Connect SDK and the nRF Toolchain you would like to use, the paths to these versions, and more.
Read more in the Creating an application page.
Building an application¶
To create a build configuration, you do not need to click on anything from the title bar, as you would have in SES or in other similar IDEs.
As long as the extension is downloaded and launched, creating a build configuration with nRF Connect for Visual Studio Code can be done from the Applications View by following the steps below.
Click on the application folder you want to build on a configuration for. The folder icon will turn blue once is it selected.
Click on where it says "No build configurations. Click to create one" within the application folder. The Add Build Configuration wizard will appear in the Editor.
Populate the fields for the build configuration, then click on the Build Configuration button on the bottom right corner of the wizard.
If you want to create additional build configurations for an application, hover your mouse to the right of the application folder and click on the Add build configuration icon.
Flashing an application¶
With the nRF Connect for Visual Studio Code extension, flashing an application must be done as a separate action after a build configuration has been created.
To flash an application, click on Flash in the Actions View.
Read more about how to Flash and how to perform other actions, such as Erase and flash, in the Actions View section of the Navigating the UI page.
Debugging an application¶
In VS Code, there is no Debug title bar menu. Instead, you can access the debugging actions in two different ways, both described below.
Similar to other IDEs, such as SES, you can start debugging in VS Code by clicking on the title bar Run > Start Debugging. This will not automatically lead you to debugging for you selected application. If you are new to VS Code, use one of the methods below to debug your application.
In the Actions View click on Debug (which opens Run and Debug), or Debug with Ozone.
Click on the Run and Debug icon in the Activity Bar.
To access debugging features for your application, we recommend to select Enable debug options when creating a build configuration. This is not mandatory, and you can still access debugging options even if you have not selected this option when creating the build configuration.
Read more about how to debug in nRF Connect on the Debugging an application page.
Creating an overlay file¶
With the nRF Connect for Visual Studio Code extension pack, you can create and appropriately store an overlay file for your application by completing the following steps:
Create overlay files from the application's Details View by clicking on Input files. It will say "No overlay files. Click to create one".
Click on the text "No overlay files. Click to Create one."
A popup message in the bottom right corner of your VS Code window will appear, stating that the overlay file has been created and that a pristine build must be run before it can be used.
Click on the Run Pristine Build button in the message. A progress bar of the pristine build appears.
Once the pristine build is complete, the overlay file will populate in the Input files section of the application's Details View. You can click on the newly created overlay file and populate it with your desired content.
Read more in the nRF DeviceTree Creating an overlay file page.
Editing configuration files¶
The extension pack includes the extension nRF Kconfig, thus the nRF Kconfig GUI, which lets you view and manage the Kconfig options used in your project's configuration files.
To access the nRF Kconfig GUI, click on Kconfig from the Actions View.
From the nRF Kconfig GUI, you can enable or disable Kconfig options by selecting or deselecting their associated check boxes. Read more about how you can manage your configuration files in the nRF Kconfig documentation page.