Skip to content

Commit

Permalink
suit: Move MPI to sysbuild Kconfig
Browse files Browse the repository at this point in the history
Use sysbuild to build and configure SUIT Manifest Provisioning
Information.

Ref: NCSDK-30461

Signed-off-by: Tomasz Chyrowicz <[email protected]>
  • Loading branch information
tomchy committed Dec 12, 2024
1 parent 0e66051 commit 9bd5f35
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 29 deletions.
4 changes: 0 additions & 4 deletions ncs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ config SUIT_RECOVERY
bool "The given image is part of a SUIT recovery application"
depends on !NRF_REGTOOL_GENERATE_UICR

config SUIT_ENVELOPE_OUTPUT_MPI_MERGE
bool "Merge MPI files into final SUIT_ENVELOPE_OUTPUT_ARTIFACT"
default y if !SUIT_RECOVERY

config SUIT_LOCAL_ENVELOPE_GENERATE
bool "Generate local envelope"
default y if SOC_NRF54H20_CPUAPP_COMMON || SOC_NRF54H20_CPURAD_COMMON
Expand Down
4 changes: 2 additions & 2 deletions ncs/app_envelope_encrypted.yaml.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- set mpi_application_vendor_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_1_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_application_class_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_1_CLASS_NAME']|default('nRF54H20_sample_app') %}
{%- set mpi_application_vendor_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_APP_LOCAL_1_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_application_class_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_APP_LOCAL_1_CLASS_NAME']|default('nRF54H20_sample_app') %}
SUIT_Envelope_Tagged:
suit-authentication-wrapper:
SuitDigest:
Expand Down
12 changes: 6 additions & 6 deletions ncs/root_with_nordic_top_envelope.yaml.jinja2
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{%- set component_index = 0 %}
{%- set component_list = [] %}
{%- set mpi_root_vendor_name = application['config']['CONFIG_SUIT_MPI_ROOT_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_root_class_name = application['config']['CONFIG_SUIT_MPI_ROOT_CLASS_NAME']|default('nRF54H20_sample_root') %}
{%- set mpi_app_vendor_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_1_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_app_class_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_1_CLASS_NAME']|default('nRF54H20_sample_app') %}
{%- set mpi_rad_vendor_name = application['config']['CONFIG_SUIT_MPI_RAD_LOCAL_1_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_rad_class_name = application['config']['CONFIG_SUIT_MPI_RAD_LOCAL_1_CLASS_NAME']|default('nRF54H20_sample_rad') %}
{%- set mpi_root_vendor_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_ROOT_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_root_class_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_ROOT_CLASS_NAME']|default('nRF54H20_sample_root') %}
{%- set mpi_app_vendor_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_APP_LOCAL_1_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_app_class_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_APP_LOCAL_1_CLASS_NAME']|default('nRF54H20_sample_app') %}
{%- set mpi_rad_vendor_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_RAD_LOCAL_1_VENDOR_NAME']|default('nordicsemi.com') %}
{%- set mpi_rad_class_name = sysbuild['config']['SB_CONFIG_SUIT_MPI_RAD_LOCAL_1_CLASS_NAME']|default('nRF54H20_sample_rad') %}
{%- if hci_rpmsg_subimage is defined %}
{% set rad = hci_rpmsg_subimage %}
{%- elif _802154_rpmsg_subimage is defined %}
Expand Down
10 changes: 5 additions & 5 deletions suit_generator/cmd_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,20 @@ def _get_role_assignments_from_kconfig(kconfig: str) -> list:
config = BuildConfiguration(input_file=kconfig)
kconfig_assignments = []
for key, value in config.items():
if re_value := re.match(r"^CONFIG_SUIT_MPI_(?P<manifest>[A-Z1-9_]+)_VENDOR_NAME$", key):
if re_value := re.match(r"^SB_CONFIG_SUIT_MPI_(?P<manifest>[A-Z1-9_]+)_VENDOR_NAME$", key):
manifest = re_value.group("manifest")
# ensure that the same combination of vid/cid has not been set for different role
for item in kconfig_assignments:
if (
item["vendor_name"] == config[f"CONFIG_SUIT_MPI_{manifest}_VENDOR_NAME"]
and item["class_name"] == config[f"CONFIG_SUIT_MPI_{manifest}_CLASS_NAME"]
item["vendor_name"] == config[f"SB_CONFIG_SUIT_MPI_{manifest}_VENDOR_NAME"]
and item["class_name"] == config[f"SB_CONFIG_SUIT_MPI_{manifest}_CLASS_NAME"]
):
raise GeneratorError(
"Duplicate vid/cid combination for different roles detected in the KConfig file."
)
data = {
"vendor_name": config[f"CONFIG_SUIT_MPI_{manifest}_VENDOR_NAME"],
"class_name": config[f"CONFIG_SUIT_MPI_{manifest}_CLASS_NAME"],
"vendor_name": config[f"SB_CONFIG_SUIT_MPI_{manifest}_VENDOR_NAME"],
"class_name": config[f"SB_CONFIG_SUIT_MPI_{manifest}_CLASS_NAME"],
"role": ManifestRole[f"APP_{manifest}" if manifest == "ROOT" else manifest],
}
kconfig_assignments.append(data)
Expand Down
24 changes: 12 additions & 12 deletions tests/test_cmd_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,18 @@
)

MPI_KCONFIG_TEMPLATE = """
CONFIG_SUIT_MPI_ROOT_VENDOR_NAME="{root_vendor_name}"
CONFIG_SUIT_MPI_ROOT_CLASS_NAME="{root_class_name}"
CONFIG_SUIT_MPI_APP_LOCAL_1=y
CONFIG_SUIT_MPI_APP_LOCAL_1_VENDOR_NAME="{app_local_1_vendor_name}"
CONFIG_SUIT_MPI_APP_LOCAL_1_CLASS_NAME="{app_local_1_class_name}"
CONFIG_SUIT_MPI_APP_LOCAL_2 is not set
CONFIG_SUIT_MPI_APP_LOCAL_3 is not set
CONFIG_SUIT_MPI_RAD_RECOVERY is not set
CONFIG_SUIT_MPI_RAD_LOCAL_1=y
CONFIG_SUIT_MPI_RAD_LOCAL_1_VENDOR_NAME="{rad_local_1_vendor_name}"
CONFIG_SUIT_MPI_RAD_LOCAL_1_CLASS_NAME="{rad_local_1_class_name}"
CONFIG_SUIT_MPI_RAD_LOCAL_2 is not set
SB_CONFIG_SUIT_MPI_ROOT_VENDOR_NAME="{root_vendor_name}"
SB_CONFIG_SUIT_MPI_ROOT_CLASS_NAME="{root_class_name}"
SB_CONFIG_SUIT_MPI_APP_LOCAL_1=y
SB_CONFIG_SUIT_MPI_APP_LOCAL_1_VENDOR_NAME="{app_local_1_vendor_name}"
SB_CONFIG_SUIT_MPI_APP_LOCAL_1_CLASS_NAME="{app_local_1_class_name}"
SB_CONFIG_SUIT_MPI_APP_LOCAL_2 is not set
SB_CONFIG_SUIT_MPI_APP_LOCAL_3 is not set
SB_CONFIG_SUIT_MPI_RAD_RECOVERY is not set
SB_CONFIG_SUIT_MPI_RAD_LOCAL_1=y
SB_CONFIG_SUIT_MPI_RAD_LOCAL_1_VENDOR_NAME="{rad_local_1_vendor_name}"
SB_CONFIG_SUIT_MPI_RAD_LOCAL_1_CLASS_NAME="{rad_local_1_class_name}"
SB_CONFIG_SUIT_MPI_RAD_LOCAL_2 is not set
"""

INPUT_ENVELOPE_YAML = """SUIT_Envelope_Tagged:
Expand Down

0 comments on commit 9bd5f35

Please sign in to comment.