How to build an application

nRF Connect for VS Code

tags
nRF Connect for VS Code

Note

The following procedure lists basic steps. For more advanced building steps, see How to work with a build configuration.

To create your first build configuration, complete the following steps:

  1. Verify the configuration of the sample or application you are planning to build.
    You need the following information from the sample or an application documentation in the nRF Connect SDK:

    • The SDK version from which you copied the sample or application.
    • The board target onto which you want to program the firmware (Requirements section).
    • Kconfig fragments or CMake build fragments specific to the application or sample you are building (Configuration section).

    You need this information in the steps that follow.

  2. In the Applications View, click Add build configuration.

    Add build configuration

    This opens the Add Build Configuration page.

    Add Build Configuration page - fragment

  3. For your very first build configuration, double-check the values in the SDK and toolchain menus:

    SDK and toolchain management menu

  4. Select the board target onto which you want to program the firmware.
    For your very first build configuration, select a compatible board target from the drop-down menu.

    Board target drop-down menu

  5. For your very first build configuration, do not specify the board revision.
    If you select a board target that has revisions, the build system matches the revision to the best available board revision configuration files.

  6. Optionally, add Kconfig fragment and Devicetree overlay files.
    If no base files are specified, the build system autoselects them.

    Tip

    When you write in a UI text input field, you must press Enter or Tab for the extension to accept your input. The italics used for text formatting indicate that the input is not permanent: pressing Esc restores the previous value.

  7. Optionally, add snippets.
    You can read more about the syntax for providing these and other extra CMake arguments in the nRF Connect SDK documentation. See also Snippets in the Zephyr documentation.

  8. In Optimization level (size, speed, or debugging), select Use project default.

    Optimization level drop-down menu

    This lets you build the application with the basic configuration.
    You can change this option later.

  9. Keep the Include debug thread information option enabled.
    This includes thread information in the build. You can change this option later.

  10. Optionally, add extra CMake arguments.
    You can read more about the syntax for providing these and other extra CMake arguments in the nRF Connect SDK documentation.

  11. Make sure the Generate only checkbox is not selected.

    Generate only checkbox

  12. Keep the default setting for sysbuild.

    Sysbuild menu

  13. Click the Generate and Build button.

The extension generates the configuration file and triggers the build process, which can take some time. The build configuration entry in the Applications View is highlighted during that time. You can monitor the build progress in the notification that appears or in the Terminal panel that automatically opens.

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