Skip to content

How to build an application from the nRF Connect SDK

Complete the steps listed on this page to build an nRF Connect SDK 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.
  2. From the Welcome View, click Create a new application.
    This opens the New Application page.

    New Application page

  3. In the application type, select Freestanding.

  4. If this is the first time you are building an nRF Connect SDK application in Visual Studio Code, make sure to fill in or select the following fields:

    Field Value to select
    Application type Freestanding.
    nRF Connect SDK and nRF Connect Toolchain Corresponding to the version of the nRF Connect SDK you installed.
    Application location Path to the directory where you want to save the application.
    Application template Path to the directory 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/.
    Application name Custom name of your application.

    New Application page for a freestanding application

  5. Click Create Application to create your application from a sample or an nRF Connect SDK application.
    The new application entry is automatically added in the Applications View.

  6. If prompted, click Yes when asked if you trust the authors of the files.
  7. 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.
  8. 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

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

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

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.

How to edit 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.