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.
If you prefer to build your applications from the command line, see Build and Run an Application.
Building with SES¶
Run the file
Select File -> Open nRF Connect SDK Project.
To import a project into SES, you must specify the following information:
CMakeLists.txt - the location of the
CMakeLists.txtproject file of the sample that you want to work with
Board Directory - the location of the board description of the board for which to build the project
Board Name - the board name (select from the list that is populated based on the board directory)
Build Directory - the folder in which to run the build (automatically filled based on the board name, but you can specify a different directory)
Delete Existing CMakeCache.txt - select this option to ensure that you are not building with an outdated build cache
The following figure shows an example configuration for the Asset Tracker application built for the
Click OK to import the project into SES. You can now work with the project in the IDE.
At this stage, you might get 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.
Build and program your project.
The required steps differ depending on if you build a single application or a multi-image project (such as the nRF9160 samples, which include SPM).
If you are working with an nRF9160 DK, make sure to select the correct controller before you program the application to your board.
Put the SW5 switch (marked debug/prog) in the NRF91 position to program the main controller, or in the NRF52 position to program the board controller. See the Device programming section in the nRF9160 DK User Guide for more information.
To build and program an application:
Select your project in the Project Explorer.
From the menu, select Build -> Build Solution.
When the build completes, you can program the sample to a connected board:
For a single-image application, select Target -> Download zephyr/zephyr.elf.
For a multi-image application, select Target -> Download zephyr/merged.hex.
Alternatively, choose the Build and Debug option. Build and Debug will build the application and program it when the build completes.
To inspect the details of the code that was programmed and the memory usage, click Debug -> Go.
In a multi-image build, this allows you to debug the source code of your application only.
If you get an error that a tool or command cannot be found, first make sure that the tool is installed. If it is installed, verify that its location is correct in the PATH variable or, if applicable, in the SES settings.