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.
- Open the nRF Connect for VS Code extension by clicking its icon.
-
From the Welcome View, click Create a new application. This opens the New Application page.
-
In the application type, select Freestanding.
-
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 undernrf/samples/
, and applications are located undernrf/applications/
.Application name Custom name of your application. -
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.
- If prompted, click Yes when asked if you trust the authors of the files.
- 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.
-
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.
-
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.
- Make sure the
Build after generating configuration
checkbox is selected. - Enter any desired Kconfig fragments or extra CMake arguments.
- 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.
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.
- In the Applications View, click on the build folder that contains the files you want to edit.
- Click on the menu icon that is to the right, or right-click on the build folder.
- Click on Edit Build Configuration.
- After you have edited the configuration, click on Build Configuration to save your changes and rebuild the application with the new configuration.