Configuring Kconfig

You can change the software-related configuration temporarily or permanently. The temporary build files are deleted when you clean the build directory with the pristine target (see Zephyr’s Rebuilding an Application for more information).

The Kconfig Reference provides the documentation for each configuration option and lists the menu path where the option can be found.

Temporary Kconfig changes

When building your application, the different .config, *_defconfig files, and the prj.conf file are merged together and then processed by Kconfig. The resulting configuration is written to the zephyr/.config file in your build directory. This means that this file is available when building the application until you clean the build directory pristinely.


While it is possible to edit the .config file directly, you should use the nRF Kconfig GUI in the nRF Connect for VS Code extension or a tool like menuconfig or guiconfig to update it. These tools present all available options and allow you to select the ones that you need. They also show the dependencies between the options and their limitations.

Use the nRF Kconfig GUI in the nRF Connect for VS Code extension to select the desired options. The GUI organizes the Kconfig options in a hierarchical list and lets you view and manage your selection.

To locate a specific configuration option, use the Search modules field. Read the Configuring with nRF Kconfig page in the nRF Connect for VS Code extension documentation for more information.

Alternatively, you can configure your application in the nRF Connect for VS Code extension using menuconfig. Open the More actions.. menu next to Kconfig action in the Actions View to start menuconfig in the extension.

Temporary Kconfig changes for a single build

You can also apply temporary Kconfig changes to a single build by providing the value of a chosen Kconfig option as a CMake option. The Kconfig option configuration will be available until you clean the build directory pristinely.

Permanent Kconfig changes

To configure your application and maintain the configuration after you clean the build directory pristinely, you need to specify the configuration in one of the permanent configuration files. In most of the cases, this means editing the default prj.conf file of the application, but you can also use an extra Kconfig fragment file.

The Kconfig fragment files are configuration files used for building an application image with or without software support that is enabled by specific Kconfig options. In these files, you can specify different values for configuration options that are defined by a library or board, and you can add configuration options that are specific to your application. Examples include whether to add networking support or which drivers are needed by the application. Kconfig fragments are applied on top of the default prj.conf file and use the .conf file extension. When they are board-specific, they are placed in the boards folder, are named <board>.conf, and they are applied on top of the default Kconfig file for the specified board.

See Setting Kconfig configuration values in the Zephyr documentation for information on how to change the configuration permanently and how the additional files are applied.


Reconfiguring through menuconfig only changes the specific setting and the invisible options that are calculated from it. It does not adjust visible symbols that have already defaulted to a value even if this default calculation is supposed to be dependent on the changed setting. This may result in a bloated configuration compared to changing the setting directly in prj.conf. See the section Stuck symbols in menuconfig and guiconfig on the Kconfig - Tips and Best Practices in the Zephyr documentation for more information.

If you work with nRF Connect for VS Code extension, you can use one of the following options:

  • Edit the prj.conf directly in Visual Studio Code.

  • Select an extra Kconfig fragment file when you build an application.

  • Edit the Kconfig options in prj.conf using the nRF Kconfig GUI and save changes permanently to an existing or new prj.conf file.

See the extension’s documentation about Kconfig for more information.

The configuration changes in prj.conf are automatically picked up by the build system when you rebuild the application.

Override Kconfig warnings

Kconfig options often depend on each other, and because of this the build system can override any Kconfig changes you make. If that happens, a warning will be printed in the build log, but the build may still complete successfully.

Here is an example for such a warning:

warning: UART_CONSOLE (defined at drivers/console/Kconfig:43) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: SERIAL (=n), SERIAL_HAS_DRIVER (=n). See and/or look up UART_CONSOLE in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

Look for these warnings to make sure no Kconfig options are overridden unexpectedly.

These warnings might be more frequent if you edit the Kconfig files manually. The Kconfig GUI and other Kconfig tools give you an overview over dependencies, which allows you to see which Kconfig options have been overridden and why before you build the project.