Migrating Matter projects from sdk-nrf to Matter add-on

The nRF Connect SDK v3.4.0 was the last major release with Matter samples, shared sample code, board partition devicetree files, and Matter-specific snippets integrated in the sdk-nrf repository. In later releases, the Matter reference applications and their supporting assets are maintained in the separate Matter add-on repository (ncs-matter).

This guide describes the changes required when migrating a Matter project that was based on paths under sdk-nrf to the ncs-matter add-on structure. It covers workspace setup, repository layout, build system updates, Kconfig symbol renames, devicetree and snippet changes, and documentation references.

Note

If you only use Matter samples without custom modifications, the simplest approach is to create a new workspace from the ncs-matter add-on and copy over your application-specific source files, configuration overlays, and factory data. Use this guide when you maintain a custom Matter application that was forked from an nRF Connect SDK v3.4.0 (or earlier) Matter sample or application.

Overview

The ncs-matter add-on is a Zephyr module that extends the nRF Connect SDK with:

  • Matter reference samples (formerly under nrf/samples/matter)

  • Matter bridge and weather station reference applications (formerly under nrf/applications, now under ncs-matter/samples)

  • Shared Matter sample infrastructure (formerly under nrf/samples/matter/common, now under ncs-matter/subsys)

  • Matter partition devicetree include files (formerly under nrf/dts/samples/matter, now under ncs-matter/dts)

  • Matter build and data-model CMake helpers (formerly under nrf/samples/matter/common/cmake, now under ncs-matter/cmake)

  • Matter-specific Zephyr snippets (formerly under nrf/snippets/matter, now under ncs-matter/snippets)

The add-on manifest (ncs-matter/west.yml) imports a fixed nRF Connect SDK release together with the matching sdk-connectedhomeip revision.

Setting up the workspace

To work with Matter samples and applications from the add-on, set up a west workspace that includes the ncs-matter repository.

Initialize from the add-on manifest

Complete the following steps to create a new workspace with the Matter Add-on as the manifest repository:

west init -m https://github.com/nrfconnect/ncs-matter --mr <release>
cd ncs-matter
west update

Replace <release> with the add-on release tag that matches your target nRF Connect SDK version (see the add-on release notes).

Alternatively, if you already cloned the add-on repository locally:

west config manifest.path ncs-matter
west update

To get back to the nRF Connect SDK manifest, run:

west config manifest.path nrf
west update

Building Matter samples

Build commands must point to sample paths under the add-on repository. The board target and sysbuild configuration options remain the same as in the nRF Connect SDK Matter samples.

For example, to build the Matter template sample for the nrf54l15dk/nrf54l15/cpuapp board target:

west build -b nrf54l15dk/nrf54l15/cpuapp ncs-matter/samples/template

Compare this with the former path:

west build -b nrf54l15dk/nrf54l15/cpuapp nrf/samples/matter/template

You can also create a workspace application by copying a sample from ncs-matter/samples/ into your workspace application folder. Follow the instructions in Creating application from add-ons for add-on based application creation in nRF Connect for VS Code.

Repository layout changes

The repository layout has been changed in comparison to the nRF Connect SDK repository structure. See the following sections to learn about the changes.

Sample and application paths

All Matter reference code moves from sdk-nrf to ncs-matter. The matter subdirectory is removed from sample paths, and former applications are relocated under ncs-matter/samples/.

Matter sample and application path mapping

Former path in sdk-nrf

New path in ncs-matter

nrf/samples/matter/template

ncs-matter/samples/template

nrf/samples/matter/light_bulb

ncs-matter/samples/light_bulb

nrf/samples/matter/light_switch

ncs-matter/samples/light_switch

nrf/samples/matter/lock

ncs-matter/samples/lock

nrf/samples/matter/window_covering

ncs-matter/samples/window_covering

nrf/samples/matter/thermostat

ncs-matter/samples/thermostat

nrf/samples/matter/smoke_co_alarm

ncs-matter/samples/smoke_co_alarm

nrf/samples/matter/temperature_sensor

ncs-matter/samples/temperature_sensor

nrf/samples/matter/contact_sensor

ncs-matter/samples/contact_sensor

nrf/samples/matter/closure

ncs-matter/samples/closure

nrf/samples/matter/manufacturer_specific

ncs-matter/samples/manufacturer_specific

nrf/applications/matter_bridge

ncs-matter/samples/matter_bridge

nrf/applications/matter_weather_station

ncs-matter/samples/matter_weather_station

Shared sample infrastructure

The shared code, Kconfig definitions, and CMake logic that were previously located under nrf/samples/matter/common are reorganized in the add-on module:

Shared Matter infrastructure path mapping

Former path in sdk-nrf

New path in ncs-matter

nrf/samples/matter/common/src/

ncs-matter/subsys/

nrf/samples/matter/common/cmake/source_common.cmake

Automatic via ncs-matter/subsys/CMakeLists.txt (linked when CONFIG_CHIP=y)

nrf/samples/matter/common/cmake/data_model.cmake

ncs-matter/cmake/data_model.cmake

nrf/samples/matter/common/cmake/zap_helpers.cmake

ncs-matter/cmake/zap_helpers.cmake

nrf/samples/matter/common/cmake/source_common.cmake, data_model.cmake, and zap_helpers.cmake (combined)

ncs-matter/cmake/sample.cmake

nrf/samples/matter/common/src/Kconfig

ncs-matter/subsys/Kconfig (included from ncs-matter/Kconfig)

Devicetree partition files

Base Matter partition layouts move from nrf/dts/samples/matter/ to ncs-matter/dts/. The add-on registers this directory as a devicetree root (dts_root in zephyr/module.yml), so partition files are included by filename only.

Matter partition devicetree file mapping

Former include in board overlay

New include in board overlay

#include <samples/matter/nrf52840_partitions.dtsi>

#include <nrf52840_partitions.dtsi>

#include <samples/matter/nrf5340_cpuapp_partitions.dtsi>

#include <nrf5340_cpuapp_partitions.dtsi>

#include <samples/matter/nrf5340_cpunet_partitions.dtsi>

#include <nrf5340_cpunet_partitions.dtsi>

#include <samples/matter/nrf54l15_cpuapp_partitions.dtsi>

#include <nrf54l15_cpuapp_partitions.dtsi>

#include <samples/matter/nrf54l15_cpuapp_internal_partitions.dtsi>

#include <nrf54l15_cpuapp_internal_partitions.dtsi>

#include <samples/matter/nrf54l15_cpuapp_tfm_application_partitions.dtsi>

#include <nrf54l15_cpuapp_tfm_application_partitions.dtsi>

#include <samples/matter/nrf54l15_cpuapp_tfm_base_partitions.dtsi>

#include <nrf54l15_cpuapp_tfm_base_partitions.dtsi>

#include <samples/matter/nrf54l10_cpuapp_partitions.dtsi>

#include <nrf54l10_cpuapp_partitions.dtsi>

#include <samples/matter/nrf54lm20_cpuapp_partitions.dtsi>

#include <nrf54lm20_cpuapp_partitions.dtsi>

#include <samples/matter/nrf54lm20_cpuapp_internal_partitions.dtsi>

#include <nrf54lm20_cpuapp_internal_partitions.dtsi>

Update every board-specific .overlay file in your project that references the old samples/matter/ devicetree path.

Snippets

Matter snippets move from nrf/snippets/matter/ to ncs-matter/snippets/. Snippet names are shortened because the add-on registers ncs-matter/snippets as a snippet root.

Matter snippet mapping

Former snippet path

Former snippet name

New snippet name

nrf/snippets/matter/matter-debug/

matter-debug

debug

nrf/snippets/matter/matter-diagnostic-logs/

matter-diagnostic-logs

diagnostic-logs

Update build commands and sample.yaml definitions that reference the old snippet names. For example, replace template_SNIPPET="matter-diagnostic-logs;matter-debug" with template_SNIPPET="diagnostic-logs;debug".

Build system changes

To align the Matter Add-on with the nRF Connect SDK build system, the CMake, Sysbuild and Kconfig files have been created. The Zephyr module configuration points to the new files instead of the alternatives in the nRF Connect SDK repository.

CMake updates

Replace references to ZEPHYR_NRF_MODULE_DIR Matter sample paths with ZEPHYR_NCS_MATTER_MODULE_DIR add-on paths.

In application CMakeLists.txt files, make the following changes:

  • Remove the explicit enable-gnu-std.cmake include. GNU standard support is enabled globally by the add-on module (ncs-matter/CMakeLists.txt).

  • Replace separate includes of source_common.cmake, data_model.cmake, and zap_helpers.cmake with a single include of sample.cmake:

    # Before (sdk-nrf)
    include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/app/enable-gnu-std.cmake)
    include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/source_common.cmake)
    include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/data_model.cmake)
    include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/zap_helpers.cmake)
    
    # After (ncs-matter add-on)
    include(${ZEPHYR_NCS_MATTER_MODULE_DIR}/cmake/sample.cmake)
    
  • Update explicit source file paths. For example, in the Matter bridge application, replace:

    ${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/src/binding/binding_handler.cpp
    

    with:

    ${ZEPHYR_NCS_MATTER_MODULE_DIR}/subsys/binding/binding_handler.cpp
    

The shared Matter sample sources under ncs-matter/subsys/ are linked automatically for all applications that enable CONFIG_CHIP through the add-on module CMake entry point. You no longer need to include source_common.cmake manually unless you have a non-standard build layout.

Kconfig updates

Removed the following line from sample Kconfig files:

source "$(ZEPHYR_NRF_MODULE_DIR)/samples/matter/common/src/Kconfig"

The add-on Kconfig tree (ncs-matter/Kconfig and ncs-matter/subsys/Kconfig) is loaded automatically when the ncs-matter Zephyr module is present in the workspace.

Kconfig symbol renames

All CONFIG_NCS_SAMPLE_MATTER_* options are renamed to CONFIG_MATTER_* in the add-on. Update every prj.conf, prj_release.conf, *.conf overlay, and sample.yaml reference.

Matter sample Kconfig symbol renames

Former symbol (sdk-nrf)

New symbol (ncs-matter)

CONFIG_NCS_SAMPLE_MATTER_APP_TASK_QUEUE_SIZE

CONFIG_MATTER_APP_TASK_QUEUE_SIZE

CONFIG_NCS_SAMPLE_MATTER_APP_TASK_MAX_SIZE

CONFIG_MATTER_APP_TASK_MAX_SIZE

CONFIG_NCS_SAMPLE_MATTER_CUSTOM_BLUETOOTH_ADVERTISING

CONFIG_MATTER_CUSTOM_BLUETOOTH_ADVERTISING

CONFIG_NCS_SAMPLE_MATTER_OPERATIONAL_KEYS_MIGRATION_TO_ITS

CONFIG_MATTER_OPERATIONAL_KEYS_MIGRATION_TO_ITS

CONFIG_NCS_SAMPLE_MATTER_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE

CONFIG_MATTER_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE

CONFIG_NCS_SAMPLE_MATTER_LEDS

CONFIG_MATTER_LEDS

CONFIG_NCS_SAMPLE_MATTER_SETTINGS_SHELL

CONFIG_MATTER_SETTINGS_SHELL

CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS

CONFIG_MATTER_TEST_EVENT_TRIGGERS

CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_MAX

CONFIG_MATTER_TEST_EVENT_TRIGGERS_MAX

CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_REGISTER_DEFAULTS

CONFIG_MATTER_TEST_EVENT_TRIGGERS_REGISTER_DEFAULTS

CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_MAX_TRIGGERS_DELEGATES

CONFIG_MATTER_TEST_EVENT_TRIGGERS_MAX_TRIGGERS_DELEGATES

CONFIG_NCS_SAMPLE_MATTER_TEST_SHELL

CONFIG_MATTER_TEST_SHELL

CONFIG_NCS_SAMPLE_MATTER_PERSISTENT_STORAGE

CONFIG_MATTER_PERSISTENT_STORAGE

CONFIG_NCS_SAMPLE_MATTER_ZAP_FILE_PATH

CONFIG_MATTER_ZAP_FILE_PATH

CONFIG_NCS_SAMPLE_MATTER_CERTIFICATION

CONFIG_MATTER_CERTIFICATION

CONFIG_NCS_SAMPLE_MATTER_USE_DEFAULT_BUTTON_HANDLER

CONFIG_MATTER_USE_DEFAULT_BUTTON_HANDLER

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS

CONFIG_MATTER_DIAGNOSTIC_LOGS

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_MAX_SIMULTANEOUS_SESSIONS

CONFIG_MATTER_DIAGNOSTIC_LOGS_MAX_SIMULTANEOUS_SESSIONS

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_CRASH_LOGS

CONFIG_MATTER_DIAGNOSTIC_LOGS_CRASH_LOGS

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_REMOVE_CRASH_AFTER_READ

CONFIG_MATTER_DIAGNOSTIC_LOGS_REMOVE_CRASH_AFTER_READ

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_END_USER_LOGS

CONFIG_MATTER_DIAGNOSTIC_LOGS_END_USER_LOGS

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_NETWORK_LOGS

CONFIG_MATTER_DIAGNOSTIC_LOGS_NETWORK_LOGS

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_TEST

CONFIG_MATTER_DIAGNOSTIC_LOGS_TEST

CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_REDIRECT

CONFIG_MATTER_DIAGNOSTIC_LOGS_REDIRECT

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG

CONFIG_MATTER_WATCHDOG

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG_PAUSE_IN_SLEEP

CONFIG_MATTER_WATCHDOG_PAUSE_IN_SLEEP

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG_PAUSE_ON_DEBUG

CONFIG_MATTER_WATCHDOG_PAUSE_ON_DEBUG

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG_DEFAULT

CONFIG_MATTER_WATCHDOG_DEFAULT

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG_TIMEOUT

CONFIG_MATTER_WATCHDOG_TIMEOUT

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG_DEFAULT_FEED_TIME

CONFIG_MATTER_WATCHDOG_DEFAULT_FEED_TIME

CONFIG_NCS_SAMPLE_MATTER_WATCHDOG_EVENT_TRIGGERS

CONFIG_MATTER_WATCHDOG_EVENT_TRIGGERS

CONFIG_NCS_SAMPLE_MATTER_SETTINGS_STORAGE_BACKEND

CONFIG_MATTER_SETTINGS_STORAGE_BACKEND

CONFIG_NCS_SAMPLE_MATTER_SECURE_STORAGE_BACKEND

CONFIG_MATTER_SECURE_STORAGE_BACKEND

CONFIG_NCS_SAMPLE_MATTER_STORAGE_MAX_KEY_LEN

CONFIG_MATTER_STORAGE_MAX_KEY_LEN

CONFIG_NCS_SAMPLE_MATTER_SECURE_STORAGE_MAX_ENTRY_NUMBER

CONFIG_MATTER_SECURE_STORAGE_MAX_ENTRY_NUMBER

CONFIG_NCS_SAMPLE_MATTER_SECURE_STORAGE_PSA_KEY_VALUE_OFFSET

CONFIG_MATTER_SECURE_STORAGE_PSA_KEY_VALUE_OFFSET

Removed Kconfig options

The following options from nrf/samples/matter/common/src/Kconfig are no longer available in the add-on:

  • CONFIG_NCS_SAMPLE_MATTER_ZAP_GENERATION_STATIC

  • CONFIG_NCS_SAMPLE_MATTER_ZAP_GENERATION_BUILD_TIME

The add-on uses pre-generated ZAP output checked into each sample’s src/default_zap/zap-generated/ directory. Regenerate ZAP files using the Matter west commands documented in the add-on tooling section.

Sysbuild configuration

Matter samples in the add-on use a sysbuild_internal.conf file at the sample root to hold sysbuild image options that were previously embedded in sample-specific sysbuild configuration. If your custom project relied on the same sysbuild defaults (for example, MCUboot overwrite-only mode with compressed image support), copy the relevant options from the corresponding add-on sample’s sysbuild_internal.conf file.

The add-on sysbuild Kconfig (ncs-matter/sysbuild/Kconfig.sysbuild) disables the Partition Manager globally for Matter builds, consistent with the devicetree-based partitioning introduced in nRF Connect SDK v3.4.0. See also Matter for partition migration details that still apply after moving to the add-on.

Documentation and tooling

Documentation

Matter sample documentation, getting started guides, and protocol documentation that previously lived under nrf/doc/nrf/protocols/matter/ and nrf/doc/nrf/samples/matter.rst are published from the ncs-matter add-on documentation set. After migrating your project, use the add-on documentation as the primary reference for building, configuring, and testing Matter samples.

The nRF Connect SDK documentation retains high-level Matter integration information and links to the add-on, similar to how Zigbee samples references the Zigbee add-on repositories.

Note

Documentation cross-references that use the |sample path| substitution now point to paths under ncs-matter/samples/ instead of nrf/samples/matter/. Update any custom documentation or internal wikis that hard-code the old paths.

Validation scripts

If you use the Matter sample validation tooling locally, switch to the add-on copy under ncs-matter/scripts/matter_sample_checker/. The checker configuration expects the add-on directory layout - for example, partition #include directives without the samples/matter/ prefix, and snippet paths under ncs-matter/snippets/.

West ZAP tooling

The Matter west extension commands (west zap-gui, west zap-generate, and related commands) remain part of the Connected Home IP module in the nRF Connect SDK. When working in an add-on workspace, make sure your ZAP_INSTALL_PATH environment variable is set and run west commands from the workspace root that contains both ncs-matter and modules/lib/matter.

What remains in sdk-nrf

The following Matter-related components stay in the core nRF Connect SDK (sdk-nrf and imported modules):

  • The Connected Home IP stack itself (modules/lib/matter, imported through sdk-nrf)

  • Matter Kconfig and GN integration under modules/lib/matter/config/nrfconnect/

  • Shared nRF Connect SDK infrastructure used by Matter (OpenThread, MCUboot integration, IPC radio, factory data generation in sdk-nrf)

  • Core nRF Connect SDK documentation links and software maturity information for Matter platform features

Only the Matter reference samples, their shared sample code, snippets, and partition devicetree assets move to ncs-matter.

Migration checklist

Use this checklist when migrating a custom Matter application:

  1. Set up a west workspace that includes the ncs-matter add-on at a release matching your target nRF Connect SDK version.

  2. Move or copy your application sources to a path under your workspace (or use an add-on sample as the new base).

  3. Update CMakeLists.txt:

    • Include ncs-matter/cmake/sample.cmake instead of the former samples/matter/common/cmake/* files.

    • Replace ZEPHYR_NRF_MODULE_DIR Matter paths with ZEPHYR_NCS_MATTER_MODULE_DIR.

  4. Update Kconfig files: remove the samples/matter/common/src/Kconfig source line.

  5. Rename all CONFIG_NCS_SAMPLE_MATTER_* symbols to CONFIG_MATTER_* in configuration files.

  6. Update devicetree board overlays: replace #include <samples/matter/...> with #include <...> using the filenames from ncs-matter/dts/.

  7. Update snippet names in build commands (matter-debugdebug, matter-diagnostic-logsdiagnostic-logs).

  8. Update west build paths to point to the new sample location.

  9. Copy or merge sysbuild_internal.conf defaults from the matching add-on sample if needed.

  10. Rebuild from a pristine build directory and verify commissioning, DFU, and factory data workflows.