Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: matter: Refactor nRF54H20 partition in samples #19735

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions applications/matter_bridge/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ config DFU_MULTI_IMAGE_PACKAGE_NET
endif # SOC_SERIES_NRF53X
endif # BOOTLOADER_MCUBOOT

## Disable DFU for nRF54h20
config MATTER_OTA
default n if SOC_SERIES_NRF54HX

#### Enable generating factory data
config MATTER_FACTORY_DATA_GENERATE
default y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# TODO: Workaround to be removed once DFU and external flash will be supported on nRF54H20.
CONFIG_CHIP_QSPI_NOR=n

CONFIG_MPU_STACK_GUARD=n

# Enable PSA crypto from SSF client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,3 @@
#include <../samples/matter/common/dts/nrf54h20/nrf54h20_cpuapp_peripherals.dtsi>
#include <../samples/matter/common/dts/nrf54h20/nrf54h20_cpuapp_memory_map.dtsi>
#include <../samples/matter/common/dts/nrf54h20/nrf54h20_ram_allocation.dtsi>

/delete-node/ &cpuapp_rx_partitions;
/delete-node/ &cpuapp_rw_partitions;

&mram1x {
erase-block-size = <0x1000>;
write-block-size = <0x10>;

cpuapp_rx_partitions: cpuapp-rx-partitions {
compatible = "nordic,owned-partitions", "fixed-partitions";
status = "okay";
nordic,access = <NRF_OWNER_ID_APPLICATION NRF_PERM_RXS>;
#address-cells = <1>;
#size-cells = <1>;

companion_partition: partition@98000 {
reg = <0x98000 DT_SIZE_K(64)>;
};

cpuapp_slot0_partition: partition@a8000 {
reg = <0xa8000 DT_SIZE_K(948)>;
};
};

cpuapp_rw_partitions: cpuapp-rw-partitions {
compatible = "nordic,owned-partitions", "fixed-partitions";
status = "okay";
nordic,access = <NRF_OWNER_ID_APPLICATION NRF_PERM_RW>;
#address-cells = <0x1>;
#size-cells = <0x1>;

storage_partition: partition@195000 {
reg = <0x195000 DT_SIZE_K(32)>;
};

factory_data: partition@19D000 {
reg = <0x19D000 DT_SIZE_K(4)>;
};

/* DFU partition to store SUIT manifests and Nordic Firmware update */
dfu_partition: partition@19E000 {
reg = <0x19E000 DT_SIZE_K(300)>;
};
};
};
10 changes: 7 additions & 3 deletions applications/matter_bridge/doc/matter_bridge_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ For example:

For information about how to upgrade the device firmware using a PC or a smartphone, see the :ref:`matter_bridge_app_dfu` section.

.. note::
Currently the DFU over Bluetooth LE SMP and Matter OTA are not available for the ``nrf54h20dk/nrf54h20/cpuapp`` board target.

The Matter bridge device has an additional functionality, enabling it to work as a smart plug.
This feature provides an additional endpoint with an ID equal to 2, which represents Matter on/off smart plug device type functionality.
This means that you can integrate the Matter bridge functionality into your end product, such as a smart plug, and avoid having to use a standalone bridge device.
This is an optional feature and can be enabled by :ref:`Configuring the smart plug functionality <matter_bridge_smart_plug_functionality>`.

SUIT DFU on nRF54H20
====================

.. include:: ../../../samples/matter/template/README.rst
:start-after: matter_template_dfu_suit_start
:end-before: matter_template_dfu_suit_end

.. _matter_bridge_app_bridged_support:

Bridged device support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ SUIT_Envelope_Tagged:
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
{%- if 'SB_CONFIG_SUIT_ENVELOPE_NORDIC_TOP_IN_ROOT' in sysbuild['config'] %}
- suit-directive-set-component-index: 0
- suit-directive-override-parameters:
suit-parameter-image-size:
raw: 0
{%- endif %}

suit-manifest-component-id:
- INSTLD_MFST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ SUIT_Envelope_Tagged:
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
{%- if 'SB_CONFIG_SUIT_ENVELOPE_NORDIC_TOP_IN_ROOT' in sysbuild['config'] %}
- suit-directive-set-component-index: 0
- suit-directive-override-parameters:
suit-parameter-image-size:
raw: 0
{%- endif %}

suit-manifest-component-id:
- INSTLD_MFST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,28 @@ SUIT_Envelope_Tagged:

suit-install:
- suit-directive-set-component-index: 0
{%- if application is defined %}
{%- if nordic_top %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ application['name'] }}'
suit-parameter-uri: '#top'
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-dependency-integrity:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- suit-directive-process-dependency:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- suit-directive-run-sequence:
- suit-directive-override-parameters:
suit-parameter-soft-failure: True
- suit-directive-process-dependency:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
{%- endif %}
{%- if radio is defined %}
{%- if application is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ radio['name'] }}'
suit-parameter-uri: '#{{ application['name'] }}'
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-dependency-integrity:
Expand All @@ -185,9 +188,9 @@ SUIT_Envelope_Tagged:
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
{%- endif %}
{%- if nordic_top %}
{%- if radio is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#top'
suit-parameter-uri: '#{{ radio['name'] }}'
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-dependency-integrity:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ However, there are the following limitations:
* Two separate updates are required, which is not supported by all protocols.
* The manufacturer envelope cannot ensure the compatibility of SoC binaries with the manufacturer application.

.. _ug_nrf54h20_suit_soc_binaries_root_in_manufacturer:

Attaching the nordic_top.suit envelope to the manufacturer root manifest
========================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ IPC radio firmware
Matter Bridge
-------------

|no_changes_yet_note|
* Enabled SUIT DFU support for the :ref:`matter_bridge_app` application.
Currently, only the Matter OTA protocol is fully supported for SUIT DFU purposes.

nRF5340 Audio
-------------
Expand Down Expand Up @@ -319,7 +320,8 @@ Keys samples
Matter samples
--------------

|no_changes_yet_note|
* Enabled SUIT DFU support for the :ref:`matter_lock_sample`, and :ref:`matter_template_sample` samples.
Currently, only the Matter OTA protocol is fully supported for SUIT DFU purposes.

Networking samples
------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#address-cells = <1>;
#size-cells = <1>;

cpuapp_slot0_partition: partition@98000 {
reg = <0x98000 DT_SIZE_K(848)>;
cpuapp_slot0_partition: partition@86000 {
reg = <0x86000 DT_SIZE_K(1336)>;
};
};

Expand All @@ -48,17 +48,17 @@
#address-cells = < 0x1 >;
#size-cells = < 0x1 >;

storage_partition: partition@16C000 {
reg = < 0x16C000 DT_SIZE_K(32) >;
storage_partition: partition@1D4000 {
reg = < 0x1D4000 DT_SIZE_K(32) >;
};

factory_data: partition@174000 {
reg = < 0x174000 DT_SIZE_K(4) >;
factory_data: partition@1DC000 {
reg = < 0x1DC000 DT_SIZE_K(4) >;
};

/* DFU partition to store SUIT manifests and Nordic Firmware update */
dfu_partition: partition@175000 {
reg = < 0x175000 DT_SIZE_K(464) >;
dfu_partition: partition@1DD000 {
reg = < 0x1DD000 DT_SIZE_K(64) >;
};

};
Expand All @@ -72,7 +72,7 @@
#size-cells = <1>;

dfu_cache_partition_1: partition@0 {
reg = <0x0 DT_SIZE_K(1024)>;
reg = <0x0 DT_SIZE_K(2048)>;
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
nordic,access = <NRF_OWNER_ID_RADIOCORE NRF_PERM_RXS>;
#address-cells = < 0x1 >;
#size-cells = < 0x1 >;
cpurad_slot0_partition: partition@66000 {
reg = < 0x66000 DT_SIZE_K(200) >;
cpurad_slot0_partition: partition@54000 {
reg = < 0x54000 DT_SIZE_K(200) >;
};
};
};
13 changes: 0 additions & 13 deletions samples/matter/lock/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,6 @@ endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS

endif # BOOTLOADER_MCUBOOT

if SOC_SERIES_NRF54HX

config SUIT_ENVELOPE
default y

config SUIT_BUILD_FLASH_COMPANION
default y

config SUIT_MULTI_IMAGE_PACKAGE_BUILD
default y if MATTER_OTA

endif # SOC_SERIES_NRF54HX

#### Enable generating factory data
config MATTER_FACTORY_DATA_GENERATE
default y if !BOARD_NRF21540DK
Expand Down
7 changes: 7 additions & 0 deletions samples/matter/lock/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ For example:
.. matter_door_lock_sample_build_with_dfu_end
SUIT DFU on nRF54H20
--------------------

.. include:: ../template/README.rst
:start-after: matter_template_dfu_suit_start
:end-before: matter_template_dfu_suit_end

.. _matter_lock_sample_configuration_fem:

FEM support
Expand Down
13 changes: 0 additions & 13 deletions samples/matter/template/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,6 @@ endif # BOARD_NRF54L15DK

endif # BOOTLOADER_MCUBOOT

if SOC_SERIES_NRF54HX

config SUIT_ENVELOPE
default y

config SUIT_BUILD_FLASH_COMPANION
default y

config SUIT_MULTI_IMAGE_PACKAGE_BUILD
default y if MATTER_OTA

endif # SOC_SERIES_NRF54HX

#### Enable generating factory data
config MATTER_FACTORY_DATA_GENERATE
default y if !BOARD_NRF21540DK
Expand Down
40 changes: 40 additions & 0 deletions samples/matter/template/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,46 @@ The following is an example command to build the sample on the nRF54L15 DK with

Note that in this case, the size of the application partition is half of what it would be when using a configuration with external flash memory support.

SUIT DFU on nRF54H20
--------------------

.. matter_template_dfu_suit_start

Matter devices running on an nRF54H20 SoC support :ref:`ug_nrf54h20_suit_dfu`.
You can use SUIT mechanisms to update both the application and radio core firmware as well as the *nRF54H20 SoC binaries* provided by Nordic Semiconductor.
Currently, Matter samples support only the :ref:`ug_nrf54h20_suit_external_memory` approach and the *Push* firmware update model.
The default SUIT manifest template files are located in the :file:`config/suit/templates/nrf54h20/matter/v1` directory.
To change the source directory of the SUIT manifest template files, set the ``SUIT_BASE_MANIFEST_VARIANT`` sysbuild configuration option.

Currently, only DFU over the :ref:`ug_matter_overview_dfu` protocol is fully supported for this sample without any external tools.
To perform a firmware update using the Simple Management Protocol (SMP) over Bluetooth LE, you need an external tool that supports :ref:`ug_nrf54h20_suit_smp`.

To perform a firmware update of the application and radio core firmware using the :ref:`ug_matter_overview_dfu` protocol, ensure that the ``MATTER_OTA`` sysbuild configuration option is set to ``y`` and perform the firmware update as usual following the :doc:`matter:nrfconnect_examples_software_update` user guide.
In this case, the *nRF54H20 SoC binaries* will not be updated.

To update the *nRF54H20 SoC binaries*, follow the :ref:`ug_nrf54h20_suit_soc_binaries_root_in_manufacturer` user guide and define the page erase size of the device on which the cache partition is stored.
To set the page erase size for SUIT purposes use the ``SUIT_DFU_CACHE_PARTITION_X_EB_SIZE`` CMake variable, where ``X`` means the cache partition number.
If the external flash is used to store the cache partition, the page erase size is the same as the external flash page erase size.
For example on nRF54H20 DK, the page erase size is 4096 bytes accordingly to the ``mx25uw63`` flash memory erase page size.
To see the exact value of the cache 1 page erase size, see the devicetree configuration file, find the ``dfu_cache_partition_1`` node and check the erase page value for the device on which the partition is defined.

For example, you can use the following command to prepare the DFU files that include the *nRF54H20 SoC binaries* for Matter OTA on nRF54H20 DK:

.. code-block:: console

west build -b nrf54h20dk/nrf54h20/cpuapp -- -DSB_CONFIG_SUIT_ENVELOPE_NORDIC_TOP_DIRECTORY="\"<NORDIC_TOP_DIRECTORY>\"" -DSUIT_DFU_CACHE_PARTITION_1_EB_SIZE=4096

To perform a firmware update using the SMP over the Bluetooth LE protocol, write the following files to the device using an external tool and the SUIT SMP extension described in the :ref:`ug_nrf54h20_suit_smp` user guide:

* :file:`<build_dir>/DFU/root.suit` into slot 0.
* :file:`<build_dir>/DFU/dfu_cache_partition_1.bin` into slot 1.

The ``<build_dir>`` refers to your build directory.
The SUIT envelope file is included in the :file:`root.suit` file, whereas the new application firmware is included in the :file:`dfu_cache_partition_1.bin` file.
After transferring both files, confirm the update and reboot the device.

.. matter_template_dfu_suit_end

FEM support
===========

Expand Down
17 changes: 16 additions & 1 deletion sysbuild/Kconfig.matter
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,22 @@ config MATTER_OTA_IMAGE_FILE_NAME
help
Provides the file name of the generated Matter OTA image in the build directory.

if SOC_SERIES_NRF54HX

config SUIT_ENVELOPE
default y

config SUIT_BUILD_FLASH_COMPANION
default y

config SUIT_MULTI_IMAGE_PACKAGE_BUILD
default y if MATTER_OTA

config SUIT_BASE_MANIFEST_VARIANT
default "matter/v1"

endif
config SUIT_ENVELOPE_NORDIC_TOP_EXTRACT_PAYLOADS_TO_CACHE
default y if SUIT_ENVELOPE_NORDIC_TOP_DIRECTORY != ""
Comment on lines +40 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be abusing Kconfig files as thought they are defconfig files. If these are needed then the symbols should depend on them, or select them if the known issues are adhered to properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I would like to set the SUIT_ENVELOPE_NORDIC_TOP_EXTRACT_PAYLOADS_TO_CACHE if the user provides a path to the top directory using SUIT_ENVELOPE_NORDIC_TOP_DIRECTORY. Currently in Kconfig.suit SUIT_ENVELOPE_NORDIC_TOP_EXTRACT_PAYLOADS_TO_CACHE depends on SUIT_ENVELOPE_NORDIC_TOP_IN_ROOT and SUIT_ENVELOPE_NORDIC_TOP_IN_ROOT is default y if SUIT_ENVELOPE_NORDIC_TOP_DIRECTORY != "". I don't understand the abuse here, which kconfig of all mentioned should select or have dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nordicjm what do you recommend in this case?


endif # SOC_SERIES_NRF54HX
endif # MATTER
Loading