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 authored and rlubos committed Oct 8, 2024
1 parent 8a6db79 commit 1ee2695
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 107 deletions.
53 changes: 45 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,14 @@ SUIT_Envelope_Tagged:
- {{ application['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
- - CAND_IMG
- 0
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in application['config'] or application['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
- - CACHE_POOL
- 1
{%- endif %}
{%- 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 +63,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 +88,40 @@ SUIT_Envelope_Tagged:
suit-current-version: {{ DEFAULT_VERSION }}
{%- endif %}

suit-candidate-verification:
- suit-directive-set-component-index: 1
- suit-directive-override-parameters:
{%- 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: 'file://{{ application['filename'] }}'
{%- endif %}
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
file: {{ application['binary'] }}
- suit-directive-fetch:
- suit-send-record-failure
- suit-directive-try-each:
- - suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- - suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure

{%- 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 +138,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 +156,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 All @@ -143,6 +181,7 @@ SUIT_Envelope_Tagged:
- suit-send-sysinfo-failure
suit-text:
suit-digest-algorithm-id: cose-alg-sha-256

suit-manifest-component-id:
- INSTLD_MFST
- RFC4122_UUID:
Expand All @@ -157,10 +196,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 %}
}
45 changes: 40 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,10 @@ SUIT_Envelope_Tagged:
- {{ radio['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
- - CAND_IMG
- 0
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in application['config'] or application['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
- - CACHE_POOL
- 1
{%- endif %}
suit-shared-sequence:
- suit-directive-set-component-index: 0
- suit-directive-override-parameters:
Expand Down Expand Up @@ -75,13 +79,47 @@ SUIT_Envelope_Tagged:
suit-current-version: {{ DEFAULT_VERSION }}
{%- endif %}

suit-install:
suit-candidate-verification:
- 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'] }}'
{%- endif %}
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
file: {{ radio['binary'] }}
- suit-directive-fetch:
- suit-send-record-failure
- suit-directive-try-each:
- - suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- - suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure

{%- 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: 'file://{{ radio['filename'] }}'
{%- endif %}
- suit-directive-fetch:
- suit-send-record-failure
Expand Down Expand Up @@ -116,7 +154,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 @@ -37,12 +37,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 @@ -69,3 +65,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.

Loading

0 comments on commit 1ee2695

Please sign in to comment.