Building and programming a sample application

The recommended way of building and programming an nRF Connect SDK sample is to use the Nordic Edition of the SEGGER Embedded Studio (SES) IDE.

SEGGER Embedded Studio is free of charge for use with Nordic Semiconductor devices. After downloading it, you can register and activate a free license.

Note

If you prefer to build your applications from the command line, see Build and Run an Application.

Building with SES

You must install a special version of SEGGER Embedded Studio to be able to open and compile the projects in the nRF Connect SDK. You can download it from the following links:

  1. Extract the downloaded package and run the file bin/emStudio.

  2. Select File -> Open nRF Connect SDK Project.

    Open nRF Connect SDK Project menu

    Open nRF Connect SDK Project menu

  3. To import a project into SES, you must specify the following paths:

    • Zephyr Base - the location of your cloned Zephyr repository
    • CMakeLists.txt - the location of the CMakeLists.txt project file of the sample that you want to work with
    • Build Directory - the folder in which to run the build
    • Board Directory - the location of the board description of the board for which to build the project
    • GNU ARM Embedded Toolchain Directory - the location of the GNU Arm Embedded Toolchain installation

    The following figure shows an example configuration for the Asset Tracker sample built for the nrf9160_pca10090 board target:

    Opening the Asset Tracker project

    Opening the Asset Tracker project

  4. Click OK to import the project into SES. You can now work with the project in the IDE.

  5. To build your project, select Build -> Build zephyr/zephyr.elf.

    Note

    Alternatively, choose the Build and Debug option. Build and Debug will build the application and flash it when the build completes.

6. Once the build completes, you can flash the sample to a connected board. To do this, select Target -> Download zephyr/zephyr.elf.

7. To inspect the details of the flashed code and the memory usage, click Debug -> Go.

Troublehooting SES

When using SES to build the nRF Connect SDK samples, it might return an error indicating a project load failure. For example:

Can't load project file
The project file <filepath> is invalid.
The reported error is 'solution load command failed (1)'

This issue might be caused by a variety of problems, such as incorrectly specified project file paths. SES helps you to identify the source of the issue by providing a text output with detailed information about the error. Make sure to click OK on the error pop-up message and then inspect the text output in SES.