| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
SDK configuration header file

The SDK configuration header file (sdk_config.h) helps to manage the static configuration of an application that is built on top of nRF5 SDK. The configuration options included in this file can be quickly edited in a GUI wizard that is generated from the CMSIS Configuration Wizard Annotations. This annotations standard is supported natively by ARM Keil uVision (versions 4 and 5) or can be parsed using an open source Java tool - CMSIS Configuration Wizard.

Every module in SDK contains at least one configuration option that is enabling this module. If the module is disabled, then even if source code is added to the project, it is not compiled because the module implementation is conditionally included. With only a quick evaluation of the sdk_config.h file, you can check which modules are used in the application:

example_module.c
|#include "sdk_config.h"
|#if EXAMPLE_MODULE_ENABLED
|...
|#endif //EXAMPLE_MODULE_ENABLED

# CMSIS Configuration Annotations Wizard

The configuration wizard is generated from the annotations inside the configuration file. For the set of rules for creating these annotations, refer to Configuration Wizard Annotations.

# Template projects

This SDK contains a couple of template projects that have the SDK modules included (with sources) and enabled. These projects can serve as good starting points for developing an application based on nRF5 SDK.

# Standard projects

All examples contain a full configuration header file in which only the used modules are enabled. The configuration file constists of the SDK modules configuration part, which is common for all projects, and an application-specific configuration section. All include paths are added, as well as the source files for modules that are actually used. If you want to start using one of the SDK modules, you must enable it in the configuration and add the sources (include paths are already present in the file). Keeping the full configuration file should be helpful when migrating to new SDK versions.

# Overriding the sdk_config.h configuration

Each define in the sdk_config.h file is a conditional define that is added only if it has not been defined previously so it can be easily overriden.

Configuration in sdk_config.h can be overriden in two ways:

- Adding a project flag/define.
- Adding the USE_APP_CONFIG flag to the project settings and creating an app_config.h file which is included at the top of the sdk_config.h file.