Skip to main content

Configuring an application for the Icarus

This guide gives an introduction of how the configuration and build system of Zephyr and the nRF Connect SDK work. It gives a general overview of the components that make up te build system. Furthermore, it discusses project files that are used for configuration. The guide also shows how to modify configuration options through a GUI or menuconfig.

Configuration and build system

The configuration and build system of the nRF connect SDK is largely based on the Zephyr project. Applications for the nRF9160 are built using the following tools:

  • Kconfig: This system is used for kernel configuration of the Zephyr RTOS. It is the same configuration system that is used for configuring the Linux kernel. Configuration options are used to turn certain kernel features on/off, modify settings, or enable/disable certain subsystems. These configuration options are defined in Kconfig files and can be referenced to in the source code of an application. They usually have the form of CONFIG_<OPTION>. More information on Kconfig in the Zephyr documentation on build and configuration systems.
  • Device-tree: This is yet another system that is coming from the Linux world. The device-tree is used to describe hardware for the Zephyr RTOS. The Icarus board has its own device-tree which can be found here. More information on the device-tree can be found in Zephyr's device-tree guide.
  • CMake: This system is used for generating build files and scripts. In the nRF Connect SDK, it is used in combination with the Ninja build tool to build the user application and Zephyr kernel. More information can be found in the Zephyr documentation on CMake.
  • Ninja: Ninja is the build tool used by the nRF Connect SDK. It is similar to make.
  • GCC: The GCC compiler is used to compile all source code. The linker then takes all blobs generated by GCC and links them together to create the final binaries for the nRF9160.

A diagram of how all the components of the build system are connected can be seen in the image below (source: nRF Connect SDK docs). The base of the configuration and build system rests on Kconfig and the device-tree.

nRF Connect SDK configuration and build system

nRF Connect SDK configuration and build system

User application project structure

The user application, Zephyr kernel, subsystems, and libraries are configured through a set of files available in the project directory. A project directory has the following contents:

<app-project-dir>
├── CMakeLists.txt
├── prj.conf
├── build
| ├── zephyr/
| ├── mcuboot/
| ├── spm/
| └── etc...
└── src
├── main.c
└── etc...
file / directorydescription
build/Contains the build files that are created during the building process by CMake. The build/zephyr/ directory contains the binaries of the user application and Zephyr kernel.
src/Contains the source files of the user application. This directory can contain libraries and their Kconfig files for enabling/disabling certain modules.
CMakeLists.txtThis file configures the building process and tells the build system where to find the source files of the application and what to build.
prj.confThis is a Kconfig configuration file. It is used to configure the Zephyr kernel, libraries, modules, and subsystems user configuration options. The configuration options can be added manually or can be modified through menuconfig.

Configuration using menuconfig or a GUI

As mentioned in the table above, configuration of the kernel and other parts of the application can be done through menuconfig (provided by West). Menuconfig is a menu-like user interface in the terminal that displays all the configuration options and allows you to change them. West also provides a way to change the configuration options through a GUI. These commands can be used to change an application configuration:

# For configuration through menuconfig
$ west build --target menuconfig

# For configuration through a GUI
$ west build --target guiconfig

The changes that are made in the provided menus will be apparent in the prj.conf file. Using the menus is useful to explore and find the different configuration options that are needed for your project. Not all available options are present in the menus. For these options you still need to manually edit the prj.conf file.