nRF5 SDK v17.0.0
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 enables 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

Generic sdk_config.h and linker files

For each supported device, there is a generic sdk_config.h file that contains all available configuration options.

For each supported device, there are generic linker files for Segger Embedded Studio and ARM GCC. These linker files contain all memory sections used by SDK modules.

These files are not actually used by any of the SDK projects, but they can serve as a template when developing a new application.

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 consists 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:

Editing sdk_config.h in IDE

This section contains information on how to edit the sdk_config.h file in different IDEs.

ARM Keil uVision

ARM Keil uVision natively supports the standard and when special markers are detected in the file, the editor allows to switch to graphical representation.

Segger Embedded Studio

The open source Java tool CMSIS Configuration Wizard can be integrated with Segger Embedded Studio. The Java tool is bundled with the release and all examples have a reference to this tool (See "Project Macros" in project options).

The External Tools Configuration must be updated to enable integration with CMSIS Config Wizard.

  1. Go to File -> Open Studio Folder... -> External Tools Configuration.
  2. The tools.xml file will be opened in the editor.
  3. Insert the following text before the </tools> tag:
    <item name="Tool.CMSIS_Config_Wizard" wait="no">
    <menu>&amp;CMSIS Configuration Wizard</menu>
    <text>CMSIS Configuration Wizard</text>
    <tip>Open a configuration file in CMSIS Configuration Wizard</tip>
    <key>Ctrl+Y</key>
    <match>*config*.h</match>
    <message>CMSIS Config</message>
    <commands>
    java -jar &quot;$(CMSIS_CONFIG_TOOL)&quot; &quot;$(InputPath)&quot;
    </commands>
    </item>

ARM GCC

CMSIS Config Wizard (CMSIS Configuration Wizard) is integrated with example makefiles. In order to open sdk_config.h in this tool, type:

make sdk_config

Other IDEs

Use a standard editor to modify the define values in sdk_config.h.


Documentation feedback | Developer Zone | Subscribe | Updated