Skip to content

How to build an application from the nRF Connect SDK

Complete the steps listed on this page to build an application or sample in Visual Studio Code. Make sure you have configured the application or sample according to your needs, as described on its documentation page.

  1. Open the nRF Connect for VS Code extension by clicking its icon or pressing Ctrl+Alt+N.
  2. From the Welcome View, click Add an existing application.
  3. In the prompt, navigate to the folder containing the sample or application you want to build. Check the sample or application documentation in the nRF Connect SDK for the source file path. For example, for the Bluetooth Peripheral LBS sample, the path is nrf/samples/bluetooth/peripheral_lbs. Samples are located under nrf/samples/, and applications are located under nrf/applications/.
  4. Click Select folder to select the sample's or the application's folder. A new application is automatically added in the Applications View.
  5. If prompted, click Yes when asked if you trust the authors of the files.
  6. Verify the configuration of the sample or application you are planning to build based on the information in the Configuration section in the application or sample documentation in the nRF Connect SDK. This section might contain information about application-specific Kconfig fragments or CMake build fragments.
  7. Click the Add Build Configuration button in the Applications View, or click the text stating No build configurations. Click to create one. This opens the Add Build Configuration page.

    How to add a build configuration

  8. Select the board onto which you want to program the sample. The supported boards are also listed in the application or sample documentation in the nRF Connect SDK, in the Requirements section.

  9. Make sure the Build after generating configuration checkbox is selected.
  10. Enter any desired Kconfig fragments or extra CMake arguments.
  11. Click the Build Configuration button. This generates the configuration file and triggers the build process.

For more information about the build configurations, see the Build configuration page.

When the process is complete, the Actions View appears. In this View, you can trigger the build process again, flash the built sample, start a debug session, or generate a memory report. The build files appear in the build's Details View, which is named after your application.

Build configuration files

Testing and debugging the application

To test or debug the application or sample you have just built, see the How to flash, test, and debug page.

Editing a build configuration

You can make changes to the configurations for any application you have already built.

  1. In the Applications View, click on the build folder that contains the files you want to edit.

  2. Click on the menu icon that is to the right, or right-click on the build folder.

  3. Click on Edit Build Configuration.

  4. After you have edited the configuration, click on Build Configuration to save your changes and rebuild the application with the new configuration.