Skip to content

Commit

Permalink
Feature/ncsdk 23895 hierarchical manifest in build system (#47)
Browse files Browse the repository at this point in the history
* feat (hierarchichal manifest): integration with the NCS build system

Signed-off-by: Robert Stypa <[email protected]>
  • Loading branch information
robertstypa authored Oct 19, 2023
1 parent 8b119d4 commit d04923b
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 8 deletions.
50 changes: 42 additions & 8 deletions ncs/Kconfig
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,53 @@ config SUIT_ENVELOPE_SEQUENCE_NUM
int "Sequence number of the generated SUIT manifest"
default 0

config SUIT_ENVELOPE_HIERARCHICAL_MANIFEST
bool "Create hierarchical manifest"
select EXPERIMENTAL
help
Create hierarchical root manifest with it's dependent sub-manifests
default n

config SUIT_ENVELOPE_DEFAULT_TEMPLATE
string "Path to the default envelope template"
default "${ZEPHYR_SUIT_GENERATOR_MODULE_DIR}/ncs/default_app_rad_cores_envelope.yaml.jinja2" if SOC_NRF54H20_CPUAPP
string "Path to the default envelope template (deprecated)"
default "${ZEPHYR_SUIT_GENERATOR_MODULE_DIR}/ncs/default_app_rad_cores_envelope.yaml.jinja2" if SOC_NRF54H20_CPUAPP && !SUIT_ENVELOPE_HIERARCHICAL_MANIFEST
default "${ZEPHYR_SUIT_GENERATOR_MODULE_DIR}/ncs/root_hierarchical_envelope.yaml.jinja2" if SOC_NRF54H20_CPUAPP && SUIT_ENVELOPE_HIERARCHICAL_MANIFEST
help
Path to the template, that is used if the application directory does not
Path to the root template, that is used if the application directory does not
contain an input root envelope template file.
This KConfig is available for backward compatibility and will be removed soon.

config SUIT_ENVELOPE_ROOT_TEMPLATE
string "Path to the default root envelope template"
default SUIT_ENVELOPE_DEFAULT_TEMPLATE
help
Path to the default root envelope template, that is used if the application directory does not
contain an input envelope template file.

config SUIT_ENVELOPE_EDITABLE_TEMPLATE
string "Path to the input envelope template"
default "../../envelope.yaml.jinja2"
if SUIT_ENVELOPE_HIERARCHICAL_MANIFEST

config SUIT_ENVELOPE_APP_TEMPLATE
string "Path to the default application envelope template"
default "${ZEPHYR_SUIT_GENERATOR_MODULE_DIR}/ncs/app_envelope.yaml.jinja2"
help
Path to the default application envelope template, that is used if the application directory does not
contain an input application envelope template file.

config SUIT_ENVELOPE_HCI_RPMSG_SUBIMAGE_TEMPLATE
string "Path to the default radio envelope template"
default "${ZEPHYR_SUIT_GENERATOR_MODULE_DIR}/ncs/rad_envelope.yaml.jinja2"
help
Path to the default radio envelope template, that is used if the application directory does not
contain an input application envelope template file.

endif # SUIT_ENVELOPE_HIERARCHICAL_MANIFEST

config SUIT_ENVELOPE_EDITABLE_TEMPLATES_LOCATION
string "Path to the folder with envelope templates"
default "../../"
help
Path to the input editable template used to create binary envelopes.
This file is created by the build system during first build from the SUIT_ENVELOPE_DEFAULT_TEMPLATE.
Path to the folder containing editable templates used to create binary envelopes.
Input templates are created by the build system during first build from the SUIT_ENVELOPE_DEFAULT_TEMPLATE.
You can use either absolute or relative path.
In case relative path is used, the build system uses PROJECT_BINARY_DIR directory.

Expand Down
73 changes: 73 additions & 0 deletions ncs/app_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
SUIT_Envelope_Tagged:
suit-authentication-wrapper:
SuitDigest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-manifest:
suit-manifest-version: 1
suit-manifest-sequence-number: {{ version }}
suit-common:
suit-components:
- - MEM
- {{ app['dt'].label2node['cpu'].unit_addr }}
- {{ get_absolute_address(app['dt'].chosen_nodes['zephyr,code-partition']) }}
- {{ app['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
suit-shared-sequence:
- suit-directive-override-parameters:
suit-parameter-vendor-identifier:
RFC4122_UUID: nordicsemi.com
suit-parameter-class-identifier:
RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_app
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
file: {{ app['binary'] }}
suit-parameter-image-size:
file: {{ app['binary'] }}
- suit-condition-vendor-identifier:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- suit-condition-class-identifier:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-validate:
- suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-invoke:
- suit-directive-invoke:
- suit-send-record-failure
suit-install:
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ app['binary'] }}'
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-text:
suit-digest-algorithm-id: cose-alg-sha-256
suit-manifest-component-id:
- INSTLD_MFST
- RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_app
suit-text:
'["MEM", {{ app['dt'].label2node['cpu'].unit_addr }}, {{ get_absolute_address(app['dt'].chosen_nodes['zephyr,code-partition']) }}, {{ app['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: nRF54H20_cpuapp
suit-text-vendor-domain: nordicsemi.com
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:
'#{{ app['name'] }}': {{ app['binary'] }}
Empty file modified ncs/build.py
100644 → 100755
Empty file.
73 changes: 73 additions & 0 deletions ncs/rad_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
SUIT_Envelope_Tagged:
suit-authentication-wrapper:
SuitDigest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-manifest:
suit-manifest-version: 1
suit-manifest-sequence-number: {{ version }}
suit-common:
suit-components:
- - MEM
- {{ hci_rpmsg_subimage['dt'].label2node['cpu'].unit_addr }}
- {{ get_absolute_address(hci_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition']) }}
- {{ hci_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
suit-shared-sequence:
- suit-directive-override-parameters:
suit-parameter-vendor-identifier:
RFC4122_UUID: nordicsemi.com
suit-parameter-class-identifier:
RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_rad
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
file: {{ hci_rpmsg_subimage['binary'] }}
suit-parameter-image-size:
file: {{ hci_rpmsg_subimage['binary'] }}
- suit-condition-vendor-identifier:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- suit-condition-class-identifier:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-validate:
- suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-invoke:
- suit-directive-invoke:
- suit-send-record-failure
suit-install:
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ hci_rpmsg_subimage['binary'] }}'
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-text:
suit-digest-algorithm-id: cose-alg-sha-256
suit-manifest-component-id:
- INSTLD_MFST
- RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_rad
suit-text:
'["MEM", 3, 235225088, 350208]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: nRF54H20_cpurad
suit-text-vendor-domain: nordicsemi.com
suit-text-model-info: The nRF54H20 radio core
suit-text-component-description: Sample radio core FW
suit-text-component-version: v1.0.0
suit-integrated-payloads:
'#{{ hci_rpmsg_subimage['name'] }}': {{ hci_rpmsg_subimage['binary'] }}
173 changes: 173 additions & 0 deletions ncs/root_hierarchical_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{%- set component_index = 0 %}
{%- set component_list = [] %}
SUIT_Envelope_Tagged:
suit-authentication-wrapper:
SuitDigest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-manifest:
suit-manifest-version: 1
suit-manifest-sequence-number: {{ version }}
suit-common:
suit-components:
- - CAND_MFST
- 0
{%- if hci_rpmsg_subimage is defined %}
{%- set component_index = component_index + 1 %}
{%- set hci_rpmsg_subimage_component_index = component_index %}
{{- component_list.append( hci_rpmsg_subimage_component_index ) or ""}}
- - INSTLD_MFST
- RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_rad
{%- endif %}
{%- if app is defined %}
{%- set component_index = component_index + 1 %}
{%- set app_component_index = component_index %}
{{- component_list.append( app_component_index ) or ""}}
- - INSTLD_MFST
- RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_app
{%- endif %}
suit-shared-sequence:
{%- if hci_rpmsg_subimage is defined %}
- suit-directive-set-component-index: {{ hci_rpmsg_subimage_component_index }}
- suit-directive-override-parameters:
suit-parameter-vendor-identifier:
RFC4122_UUID: nordicsemi.com
suit-parameter-class-identifier:
RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_rad
{%- endif %}
{%- if app is defined %}
- suit-directive-set-component-index: {{ app_component_index }}
- suit-directive-override-parameters:
suit-parameter-vendor-identifier:
RFC4122_UUID: nordicsemi.com
suit-parameter-class-identifier:
RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_app
{%- endif %}
- suit-directive-set-component-index: [{{ component_list|join(',') }}]
- suit-condition-vendor-identifier:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
- suit-condition-class-identifier:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-failure
suit-dependencies:
# Key is the index of suit-components that describe the dependency manifest
"0": {}
{%- for component_element in component_list %}
"{{ component_element }}": {}
{%- endfor %}
suit-validate:
- suit-directive-set-component-index: [{{ component_list|join(',') }}]
- 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-invoke:
- suit-directive-set-component-index: [{{ component_list|join(',') }}]
- 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-install:
- suit-directive-set-component-index: 0
{%- if hci_rpmsg_subimage is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ hci_rpmsg_subimage['name'] }}'
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
envelope: {{ hci_rpmsg_subimage['binary'] | replace('zephyr.bin', hci_rpmsg_subimage['name'] ~ '.suit') }}
suit-parameter-image-size:
envelope: {{ hci_rpmsg_subimage['binary'] | replace('zephyr.bin', hci_rpmsg_subimage['name'] ~ '.suit') }}
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-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 app is defined %}
- suit-directive-override-parameters:
suit-parameter-uri: '#{{ app['name'] }}'
suit-parameter-image-digest:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes:
envelope: {{ app['binary'] | replace('zephyr.bin', app['name'] ~ '.suit') }}
suit-parameter-image-size:
envelope: {{ app['binary'] | replace('zephyr.bin', app['name'] ~ '.suit') }}
- suit-directive-fetch:
- suit-send-record-failure
- suit-condition-image-match:
- suit-send-record-success
- suit-send-record-failure
- suit-send-sysinfo-success
- suit-send-sysinfo-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-text:
suit-digest-algorithm-id: cose-alg-sha-256
suit-manifest-component-id:
- INSTLD_MFST
- RFC4122_UUID:
namespace: nordicsemi.com
name: nRF54H20_sample_root
suit-text:
'["CAND_MFST", 0]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: nRF54H20
suit-text-vendor-domain: nordicsemi.com
suit-text-model-info: The nRF54H20 root manifest
suit-text-component-description: Sample root manifest
suit-text-component-version: v1.0.0
suit-integrated-dependencies:
{%- if hci_rpmsg_subimage is defined %}
'#{{ hci_rpmsg_subimage['name'] }}': {{ hci_rpmsg_subimage['binary'] | replace('zephyr.bin', hci_rpmsg_subimage['name'] ~ '.suit') }}
{%- endif %}
{%- if app is defined %}
'#{{ app['name'] }}': {{ app['binary'] | replace('zephyr.bin', app['name'] ~ '.suit') }}
{%- endif %}

0 comments on commit d04923b

Please sign in to comment.