Skip to content

Commit

Permalink
suit: Migrate suit-text encoding
Browse files Browse the repository at this point in the history
With the manifest specification version 24 the suit-text field has a
language tag, so descriptions in multiple languages can be added.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
  • Loading branch information
tomchy committed Mar 19, 2024
1 parent 73c99e2 commit 7117323
Show file tree
Hide file tree
Showing 18 changed files with 467 additions and 413 deletions.
17 changes: 10 additions & 7 deletions examples/input_files/envelope_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,16 @@
}
},
"suit-text": {
"[\"M\", 2, 235577344, 352256]": {
"suit-text-vendor-name": "Nordic Semiconductor ASA",
"suit-text-model-name": "The nRF5420 application core",
"suit-text-vendor-domain": "nordicsemi.com",
"suit-text-model-info": "The nRF5420 application core",
"suit-text-component-description": "Sample application core FW",
"suit-text-component-version": "v1.0.0"}
"en": {
"[\"M\", 2, 235577344, 352256]": {
"suit-text-vendor-name": "Nordic Semiconductor ASA",
"suit-text-model-name": "The nRF5420 application core",
"suit-text-vendor-domain": "nordicsemi.com",
"suit-text-model-info": "The nRF5420 application core",
"suit-text-component-description": "Sample application core FW",
"suit-text-component-version": "v1.0.0"
}
}
},
"suit-integrated-payloads":
{
Expand Down
15 changes: 8 additions & 7 deletions examples/input_files/envelope_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ SUIT_Envelope_Tagged:
suit-digest-algorithm-id: cose-alg-sha-256
suit-digest-bytes: ''
suit-text:
'["M", 2, 235577344, 352256]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: nRF5420_cpuapp
suit-text-vendor-domain: nordicsemi.com
suit-text-model-info: The nRF5420 application core
suit-text-component-description: Sample application core FW
suit-text-component-version: v1.0.0
en:
'["M", 2, 235577344, 352256]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: nRF5420_cpuapp
suit-text-vendor-domain: nordicsemi.com
suit-text-model-info: The nRF5420 application core
suit-text-component-description: Sample application core FW
suit-text-component-version: v1.0.0
suit-integrated-payloads:
'#file.bin': file.bin
45 changes: 24 additions & 21 deletions examples/input_files/envelope_2_hierarchical.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ SUIT_Dependent_Manifests:
namespace: nordicsemi.com
name: nRF54H20_sample_app
suit-text:
'["M", 2, 235577344, 522240]':
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
en:
'["M", 2, 235577344, 522240]':
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.bin': app.bin
radio_envelope: &rad
Expand Down Expand Up @@ -138,13 +139,14 @@ SUIT_Dependent_Manifests:
namespace: nordicsemi.com
name: nRF54H20_sample_rad
suit-text:
'["M", 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
en:
'["M", 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:
'#rad.bin': rad.bin
SUIT_Envelope_Tagged:
Expand Down Expand Up @@ -282,13 +284,14 @@ SUIT_Envelope_Tagged:
namespace: nordicsemi.com
name: nRF54H20_sample_root
suit-text:
'["C", 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
en:
'["C", 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:
'#rad.suit': *rad
'#app.suit': *app
15 changes: 8 additions & 7 deletions ncs/802154_rad_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ SUIT_Envelope_Tagged:
namespace: {{ mpi_rad_vendor_name }}
name: {{ mpi_rad_class_name }}
suit-text:
'["MEM", {{ _802154_rpmsg_subimage['dt'].label2node['cpu'].unit_addr }}, {{ get_absolute_address(_802154_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition']) }}, {{ _802154_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}]':
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
en:
'["MEM", {{ _802154_rpmsg_subimage['dt'].label2node['cpu'].unit_addr }}, {{ get_absolute_address(_802154_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition']) }}, {{ _802154_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}]':
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:
'#{{ _802154_rpmsg_subimage['name'] }}': {{ _802154_rpmsg_subimage['binary'] }}
15 changes: 8 additions & 7 deletions ncs/app_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,14 @@ SUIT_Envelope_Tagged:
namespace: {{ mpi_app_vendor_name }}
name: {{ mpi_app_class_name }}
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
en:
'["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'] }}
{%- if flash_companion_subimage is defined %}
Expand Down
15 changes: 8 additions & 7 deletions ncs/multiprotocol_rad_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ SUIT_Envelope_Tagged:
namespace: {{ mpi_rad_vendor_name }}
name: {{ mpi_rad_class_name }}
suit-text:
'["MEM", {{ multiprotocol_rpmsg_subimage['dt'].label2node['cpu'].unit_addr }}, {{ get_absolute_address(multiprotocol_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition']) }}, {{ multiprotocol_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}]':
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
en:
'["MEM", {{ multiprotocol_rpmsg_subimage['dt'].label2node['cpu'].unit_addr }}, {{ get_absolute_address(multiprotocol_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition']) }}, {{ multiprotocol_rpmsg_subimage['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}]':
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:
'#{{ multiprotocol_rpmsg_subimage['name'] }}': {{ multiprotocol_rpmsg_subimage['binary'] }}
15 changes: 8 additions & 7 deletions ncs/rad_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ SUIT_Envelope_Tagged:
namespace: {{ mpi_rad_vendor_name }}
name: {{ mpi_rad_class_name }}
suit-text:
'["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-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
en:
'["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-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'] }}
8 changes: 7 additions & 1 deletion suit_generator/suit/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,16 @@ class SuitTextKeys(SuitEnum):
)


class SuitTextLMap(SuitKeyValueUnnamed):
"""Representation of language-specific SUIT text map."""

_metadata = Metadata(map={SuitComponentIdentifier: SuitTextComponentKeys, SuitTextKeys: SuitTstr})


class SuitTextMap(SuitKeyValueUnnamed):
"""Representation of SUIT text map."""

_metadata = Metadata(map={SuitComponentIdentifier: SuitTextComponentKeys, SuitTextKeys: SuitTstr})
_metadata = Metadata(map={SuitTstr: SuitTextLMap})


class SuitSeverableText(SuitUnion):
Expand Down
16 changes: 9 additions & 7 deletions tests/fuzz/fuzz_suit_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,15 @@
}},
"suit-text":
{{
"[\\"M\\", 2, 235577344, 352256]": {{
"suit-text-vendor-name": "{suit_text_vendor_name}",
"suit-text-model-name": "{suit_text_model_name}",
"suit-text-vendor-domain": "{suit_text_vendor_domain}",
"suit-text-model-info": "{suit_text_model_info}",
"suit-text-component-description": "{suit_text_component_description}",
"suit-text-component-version": "{suit_text_component_version}"
"en": {{
"[\\"M\\", 2, 235577344, 352256]": {{
"suit-text-vendor-name": "{suit_text_vendor_name}",
"suit-text-model-name": "{suit_text_model_name}",
"suit-text-vendor-domain": "{suit_text_vendor_domain}",
"suit-text-model-info": "{suit_text_model_info}",
"suit-text-component-description": "{suit_text_component_description}",
"suit-text-component-version": "{suit_text_component_version}"
}}
}}
}},
"suit-integrated-payloads":
Expand Down
15 changes: 8 additions & 7 deletions tests/fuzz/fuzz_suit_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@
- INSTLD_MFST
- raw: {suit_manifest_component_id}
suit-text:
'["MEM", 0, 524288, 0]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: test
suit-text-vendor-domain: nordicsemi.com
suit-text-model-info: The test application
suit-text-component-description: Sample application for test
suit-text-component-version: v1.0.0
en:
'["MEM", 0, 524288, 0]':
suit-text-vendor-name: Nordic Semiconductor ASA
suit-text-model-name: test
suit-text-vendor-domain: nordicsemi.com
suit-text-model-info: The test application
suit-text-component-description: Sample application for test
suit-text-component-version: v1.0.0
suit-integrated-payloads:
'#file.bin': file.bin
"""
Expand Down
15 changes: 8 additions & 7 deletions tests/test_cbor_out_of_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@
- INSTLD_MFST
- raw: {{suit_manifest_component_id}}
suit-text:
'["MEM", 0, 524288, 0]':
suit-text-vendor-name: test vendor
suit-text-model-name: test model name
suit-text-vendor-domain: vendor.domain.example
suit-text-model-info: test model
suit-text-component-description: test component description
suit-text-component-version: test component version
en:
'["MEM", 0, 524288, 0]':
suit-text-vendor-name: test vendor
suit-text-model-name: test model name
suit-text-vendor-domain: vendor.domain.example
suit-text-model-info: test model
suit-text-component-description: test component description
suit-text-component-version: test component version
"""

CBOR_TEST_DATA = {
Expand Down
Loading

0 comments on commit 7117323

Please sign in to comment.