Skip to content

Commit

Permalink
samples: matter: Enable DFU over BLE SMP for nRF54H20
Browse files Browse the repository at this point in the history
- Works with external flash utilizing companion image.
- Uses SUIT CACHE RW to store app & rad images into the cache
partition.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
  • Loading branch information
ArekBalysNordic committed Sep 27, 2024
1 parent 9c7c28c commit 5af2a13
Show file tree
Hide file tree
Showing 17 changed files with 208 additions and 107 deletions.
24 changes: 16 additions & 8 deletions config/suit/templates/nrf54h20/matter/v1/app_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ SUIT_Envelope_Tagged:
- {{ application['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
- - CAND_IMG
- 0
- - CACHE_POOL
- 1
{%- if flash_companion is defined %}
- - MEM
- {{ flash_companion['dt'].label2node['cpu'].unit_addr }}
- {{ get_absolute_address(flash_companion['dt'].chosen_nodes['zephyr,code-partition']) }}
- {{ get_absolute_address(flash_companion['dt'].chosen_nodes['zephyr,code-partition'], false) }}
- {{ flash_companion['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
{%- endif %}
suit-shared-sequence:
Expand Down Expand Up @@ -59,7 +61,7 @@ SUIT_Envelope_Tagged:
suit-digest-bytes:
file: {{ application['binary'] }}
{%- if flash_companion is defined %}
- suit-directive-set-component-index: 2
- suit-directive-set-component-index: 3
- suit-directive-override-parameters:
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
Expand All @@ -84,6 +86,14 @@ SUIT_Envelope_Tagged:
suit-current-version: {{ DEFAULT_VERSION }}
{%- endif %}

{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in application['config'] or application['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
suit-payload-fetch:
- suit-directive-set-component-index: 2
- suit-directive-override-parameters:
suit-parameter-uri: 'file://{{ application['filename'] }}'
- suit-directive-fetch:
- suit-send-record-failure
{%- endif %}
suit-install:
{%- if flash_companion is defined %}
- suit-directive-set-component-index: 1
Expand All @@ -100,7 +110,7 @@ SUIT_Envelope_Tagged:
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- suit-directive-set-component-index: 2
- suit-directive-set-component-index: 3
- suit-directive-override-parameters:
suit-parameter-source-component: 1
- suit-directive-copy:
Expand All @@ -118,7 +128,7 @@ SUIT_Envelope_Tagged:
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI' in application['config'] and application['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI'] != '' %}
suit-parameter-uri: '{{ application['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI'] }}'
{%- else %}
suit-parameter-uri: '#{{ application['name'] }}'
suit-parameter-uri: 'file://{{ application['filename'] }}'
{%- endif %}
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
Expand Down Expand Up @@ -157,10 +167,8 @@ SUIT_Envelope_Tagged:
suit-text-model-info: The nRF54H20 application core
suit-text-component-description: Sample application core FW
suit-text-component-version: v1.0.0
suit-integrated-payloads:
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in application['config'] or application['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
'#{{ application['name'] }}': {{ application['binary'] }}
{%- endif %}
suit-integrated-payloads: {
{%- if flash_companion is defined %}
'#{{ flash_companion['name'] }}': {{ flash_companion['binary'] }}
{%- endif %}
}
17 changes: 12 additions & 5 deletions config/suit/templates/nrf54h20/matter/v1/rad_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ SUIT_Envelope_Tagged:
- {{ radio['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
- - CAND_IMG
- 0
- - CACHE_POOL
- 1
suit-shared-sequence:
- suit-directive-set-component-index: 0
- suit-directive-override-parameters:
Expand Down Expand Up @@ -75,13 +77,21 @@ SUIT_Envelope_Tagged:
suit-current-version: {{ DEFAULT_VERSION }}
{%- endif %}

{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in radio['config'] or radio['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
suit-payload-fetch:
- suit-directive-set-component-index: 2
- suit-directive-override-parameters:
suit-parameter-uri: 'file://{{ radio['filename'] }}'
- suit-directive-fetch:
- suit-send-record-failure
{%- endif %}
suit-install:
- suit-directive-set-component-index: 1
- suit-directive-override-parameters:
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI' in radio['config'] and radio['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI'] != '' %}
suit-parameter-uri: '{{ radio['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI'] }}'
{%- else %}
suit-parameter-uri: '#{{ radio['name'] }}'
suit-parameter-uri: 'file://{{ radio['filename'] }}'
{%- endif %}
- suit-directive-fetch:
- suit-send-record-failure
Expand Down Expand Up @@ -116,7 +126,4 @@ SUIT_Envelope_Tagged:
suit-text-model-info: The nRF54H20 radio core
suit-text-component-description: Sample radio core FW
suit-text-component-version: v1.0.0
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in radio['config'] or radio['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
suit-integrated-payloads:
'#{{ radio['name'] }}': {{ radio['binary'] }}
{%- endif %}
suit-integrated-payloads: {}
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,102 @@ SUIT_Envelope_Tagged:
suit-current-version: {{ DEFAULT_VERSION }}
{%- endif %}

suit-payload-fetch:
{%- if application is defined %}
- suit-directive-set-component-index: 0
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ application['name'] }}'
- 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
{%- endif %}
{%- if radio is defined %}
- suit-directive-set-component-index: 0
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ radio['name'] }}'
- 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
{%- endif %}

suit-install:
- suit-directive-set-component-index: 0
{%- if application is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ application['name'] }}'
- 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
{%- endif %}
{%- if radio is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ radio['name'] }}'
- 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
{%- endif %}
{%- if nordic_top %}
- suit-directive-override-parameters:
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
{%- endif %}

suit-candidate-verification:
- suit-directive-set-component-index: 0
{%- if application is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ application['name'] }}'
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
envelope: {{ artifacts_folder ~ radio['name'] }}.suit
envelope: {{ artifacts_folder ~ application['name'] }}.suit
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-image-match:
Expand All @@ -147,13 +234,13 @@ SUIT_Envelope_Tagged:
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
{%- endif %}
{%- if application is defined %}
{%- if radio is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ application['name'] }}'
suit-parameter-uri: '#{{ radio['name'] }}'
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
envelope: {{ artifacts_folder ~ application['name'] }}.suit
envelope: {{ artifacts_folder ~ radio['name'] }}.suit
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-image-match:
Expand Down
21 changes: 15 additions & 6 deletions samples/matter/common/dts/nrf54h20/nrf54h20_cpuapp_memory_map.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@
#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(784)>;
cpuapp_slot0_partition: partition@98000 {
reg = <0x98000 DT_SIZE_K(848)>;
};
};

Expand All @@ -67,3 +63,16 @@

};
};

&mx25uw63 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

dfu_cache_partition_1: partition@0 {
reg = <0x0 DT_SIZE_K(1024)>;
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
chosen {
/* prepare IPC to HCI Radio core */
zephyr,bt-hci-ipc = &ipc0;
extmem-device = &mx25uw63;
};

aliases {
Expand Down
53 changes: 0 additions & 53 deletions samples/matter/common/dts/nrf54h20/nrf54h20_flash_companion.dtsi

This file was deleted.

10 changes: 10 additions & 0 deletions samples/matter/lock/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS

endif # BOOTLOADER_MCUBOOT

if SOC_SERIES_NRF54HX

config SUIT_ENVELOPE
default y

config SUIT_BUILD_FLASH_COMPANION
default y

endif # SOC_SERIES_NRF54HX

#### Enable generating factory data
config MATTER_FACTORY_DATA_GENERATE
default y if !BOARD_NRF21540DK
Expand Down
10 changes: 10 additions & 0 deletions samples/matter/lock/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ VERSION_MINOR = 7
PATCHLEVEL = 99
VERSION_TWEAK = 0
EXTRAVERSION =

# SUIT configuration
APP_ROOT_SEQ_NUM = 1
APP_ROOT_VERSION = 0.1.0
APP_LOCAL_1_SEQ_NUM = 1
APP_LOCAL_1_VERSION = 0.1.0
APP_RECOVERY_SEQ_NUM = 1
APP_RECOVERY_VERSION = 0.1.0
RAD_LOCAL_1_SEQ_NUM = 1
RAD_LOCAL_1_VERSION = 0.1.0
11 changes: 7 additions & 4 deletions samples/matter/lock/boards/nrf54h20dk_nrf54h20_cpuapp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
# 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
# Disable Oberon PSA crypto drivers
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n

# Enable PSA crypto from SSF client
CONFIG_PSA_SSF_CRYPTO_CLIENT=y
Expand All @@ -16,8 +14,13 @@ CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y
# Disable Data Cache
CONFIG_DCACHE=n

# Enable cache processing for application core.
# It will add the application firmware to the cache partition.
CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE=y

# TODO: Enable factory data once it is available
CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY=n

# TODO: Workaround to be removed once Zephyr's CONFIG_FPROTECT is supported on nRF54H20.
CONFIG_CHIP_FACTORY_DATA_WRITE_PROTECT=n
10 changes: 0 additions & 10 deletions samples/matter/lock/sysbuild/flash_companion.overlay

This file was deleted.

Loading

0 comments on commit 5af2a13

Please sign in to comment.