How to set up a build configuration

nRF Connect for VS Code

tags
nRF Connect for VS Code

This procedure expands the basic How to build an application procedure from the Get started section. To set up a build configuration:

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

    Add build configuration

    This opens the Add Build Configuration page.

    Add Build Configuration page - fragment

  2. In the SDK and toolchain management menus, set the SDK and toolchain versions.

    SDK and toolchain management menu

    The pre-selected versions are always the last used ones.

    Tips

    • The asterisk (*) next to the SDK version number indicates that the selected SDK is a fork of the nRF Connect SDK.
    • You can only select SDK and toolchain versions that you have previously installed from the respective Welcome View menus.
    • If you work with a workspace application, you cannot change the SDK version in the build configuration later on. You need to edit the west workspace manifest file instead.
    • If you are creating a new build configuration for a complex sample or application that you copied from the SDK, use the SDK and toolchain versions that match the SDK version from which you copied the application code.
  3. In the board target menu, select the board onto which you want to program the sample.

    Board target drop-down menu

    The supported boards are also listed in the application or sample documentation in the nRF Connect SDK, in the Requirements section of each application or sample documentation page. If you want to use a new custom board, make sure to add the new board first.

  4. Optionally, specify the board revision. See the UI and reference section for more information about this field.

    Board revision field (greyed out)

  5. Fill in the configuration options in the following sections according to your project needs.
    See the fields' tooltips and the UI and reference section.
    The Generate only checkbox option is not selected by default, which means that the final binaries are built. You can select this checkbox if you want to build them later using the Build action in the Actions View.

    Note

    The nRF Connect SDK has a preference for where to build overlay files. Read more about this in devicetree overlay documentation in the Zephyr documentation. VS Code implements this rule set to determine which files should end up in the build, but ultimately it is the build system that decides. The most commonly used location is <application-root>/<board-id>.overlay.

    For example, for a build of the peripheral_lbs sample for the nRF52 DK (one of boards that are supported by the nRF Connect SDK), the nrf52dk_nrf52832.overlay file is stored at samples/bluetooth/peripheral_lbs/.

    You can set custom overlay files by passing the argument -DDTC_OVERLAY_FILE=path/to/an/overlay_file.overlay in the Extra CMake arguments field when generating a build.

  6. Make sure you have entered the desired Build directory name.
    You cannot change this setting after you have generated the build configuration.

  7. Click Generate and Build.
    This will be Generate if you selected the Generate only checkbox option.

The extension starts generating the configuration, which can take some time. During this process, the build configuration entry in the Applications View is highlighted, the Terminal panel and a progress notification appear, and the Sidebar is gradually populated with several new Views. At the end of the process, the build files appear in the Details View, which is named after your application (HELLO_WORLDS_3 in the following image.)

Build configuration files

Once the build is complete, a build configuration entry is added for the application and the application is set as active in the Applications View. You can hover over this entry to check the build configuration details.

Tip

Standard CMake build configurations have a gear icon and usually include a single image. A build configuration created using sysbuild has a wrench icon in the Application View, can include several domains and has a sysbuild-specific file structure in the Details View.

Sysbuild configurations have a wrench icon

For more information about what changes in the extension UI when you use sysbuild, see the UI differences for sysbuild section.

At this point, you can also use the Build action from the Actions View to rebuild the application.

If a build configuration has child images that target different cores, the extension groups these images according to the separate cores.

Application with images for different cores of the same SoC (built without sysbuild)