Skip to content

Commit 3145735

Browse files
ahasztagmaciejpietras
authored andcommitted
suit: Manifest checks recovery button from companion
This commit adds the possibility to run a companion image which checks the need of entering foreground update mode based on pressing a button. Signed-off-by: Artur Hadasz <[email protected]>
1 parent a793d88 commit 3145735

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

config/suit/templates/nrf54h20/default/v1/app_recovery_local_envelope.yaml.jinja2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ SUIT_Envelope_Tagged:
6565
- suit-send-sysinfo-failure
6666
suit-invoke:
6767
- suit-directive-set-component-index: 0
68+
{%- if 'CONFIG_SUIT_RECOVERY_BUTTON' in app_recovery_img['config'] and app_recovery_img['config'][CONFIG_SUIT_RECOVERY_BUTTON] != '' %}
69+
- suit-directive-override-parameters:
70+
suit-parameter-invoke-args:
71+
suit-synchronous-invoke: True
72+
suit-timeout: 1000
73+
{%- endif %}
6874
- suit-directive-invoke:
6975
- suit-send-record-failure
7076

config/suit/templates/nrf54h20/default/v1/root_with_binary_nordic_top.yaml.jinja2

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
{%- else %}
1717
{%- set nordic_top = False %}
1818
{%- endif %}
19+
{%- if 'SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3' in sysbuild['config'] and sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3'] != '' %}
20+
{%- set mpi_app_recovery_local_vendor_name = main_config['config']['CONFIG_SUIT_MPI_APP_LOCAL_3_VENDOR_NAME']|default('nordicsemi.com') %}
21+
{%- set mpi_app_recovery_local_class_name = main_config['config']['CONFIG_SUIT_MPI_APP_LOCAL_3_CLASS_NAME']|default('nRF54H20_sample_app_3') %}
22+
{%- endif %}
23+
{%- if app_recovery_img is defined and 'CONFIG_SUIT_RECOVERY_BUTTON' in app_recovery_img['config'] and app_recovery_img['config'][CONFIG_SUIT_RECOVERY_BUTTON] != '' %}
24+
{%- set recovery_button_check_on_invoke = True %}
25+
{%- else %}
26+
{%- set recovery_button_check_on_invoke = False %}
27+
{%- endif %}
1928
SUIT_Envelope_Tagged:
2029
suit-authentication-wrapper:
2130
SuitDigest:
@@ -33,14 +42,14 @@ SUIT_Envelope_Tagged:
3342
suit-components:
3443
- - CAND_MFST
3544
- 0
36-
{%- if radio is defined %}
45+
{% if recovery_button_check_on_invoke %}
3746
{%- set component_index = component_index + 1 %}
38-
{%- set rad_component_index = component_index %}
39-
{{- component_list.append( rad_component_index ) or ""}}
47+
{%- set app_recovery_local_component_index = component_index %}
48+
{{- component_list.append( app_recovery_local_component_index ) or ""}}
4049
- - INSTLD_MFST
4150
- RFC4122_UUID:
42-
namespace: {{ mpi_radio_vendor_name }}
43-
name: {{ mpi_radio_class_name }}
51+
namespace: {{ mpi_app_recovery_local_vendor_name }}
52+
name: {{ mpi_app_recovery_local_class_name }}
4453
{%- endif %}
4554
{%- if application is defined %}
4655
{%- set component_index = component_index + 1 %}
@@ -51,6 +60,15 @@ SUIT_Envelope_Tagged:
5160
namespace: {{ mpi_application_vendor_name }}
5261
name: {{ mpi_application_class_name }}
5362
{%- endif %}
63+
{%- if radio is defined %}
64+
{%- set component_index = component_index + 1 %}
65+
{%- set rad_component_index = component_index %}
66+
{{- component_list.append( rad_component_index ) or ""}}
67+
- - INSTLD_MFST
68+
- RFC4122_UUID:
69+
namespace: {{ mpi_radio_vendor_name }}
70+
name: {{ mpi_radio_class_name }}
71+
{%- endif %}
5472

5573
{%- set component_list_without_top = component_list[:] %}
5674
{%- if nordic_top %}

samples/suit/smp_transfer/sysbuild/recovery.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
/ {
1010
chosen {
11-
recovery-button = &button0;
11+
ncs,recovery-button = &button0;
1212
};
1313
};

subsys/suit/recovery_button/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
DT_CHOSEN_NCS_RECOVERY_BUTTON := ncs,recovery-button
8+
79
config SUIT_RECOVERY_BUTTON
810
bool "Enable SUIT enter recovery button checking on startup"
9-
depends on $(dt_chosen_enabled,recovery-button)
11+
depends on $(dt_chosen_enabled,$(DT_CHOSEN_NCS_RECOVERY_BUTTON))
1012
select SSF_SUIT_SERVICE_ENABLED
1113
help
1214
This will make the firmware check if the recovery button specified in the

subsys/suit/recovery_button/src/suit_recovery_button.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <nrfx_gpiote.h>
1010
#include <sdfw/sdfw_services/suit_service.h>
1111

12-
#define RECOVERY_BUTTON_NODE DT_CHOSEN(recovery_button)
12+
#define RECOVERY_BUTTON_NODE DT_CHOSEN(ncs_recovery_button)
1313
#define RECOVERY_BUTTON_PIN DT_GPIO_PIN(RECOVERY_BUTTON_NODE, gpios)
1414
#define RECOVERY_BUTTON_PORT_NUM DT_PROP(DT_GPIO_CTLR(RECOVERY_BUTTON_NODE, gpios), port)
1515
#define RECOVERY_BUTTON_FLAGS DT_GPIO_FLAGS(RECOVERY_BUTTON_NODE, gpios)
@@ -22,7 +22,7 @@
2222
#define RECOVERY_BUTTON_PRESSED(pin_value) (RECOVERY_BUTTON_FLAGS & GPIO_ACTIVE_LOW ? (!pin_value) \
2323
: pin_value)
2424

25-
BUILD_ASSERT(DT_NODE_EXISTS(DT_CHOSEN(recovery_button)), "No recovery button chosen in dts");
25+
BUILD_ASSERT(DT_NODE_EXISTS(DT_CHOSEN(ncs_recovery_button)), "No recovery button chosen in dts");
2626

2727
static int recovery_button_check(void)
2828
{

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ manifest:
241241
upstream-sha: c6eaeda5a1c1c5dbb24dce7e027340cb8893a77b
242242
compare-by-default: false
243243
- name: suit-generator
244-
revision: 9c5e8f16ef49e5ffbdeabc87ffd60b82b1fd72b0
244+
revision: 8f9ce9039e6fb8584dc915944b2bc275856757c0
245245
path: modules/lib/suit-generator
246246
- name: suit-processor
247247
revision: c97fbb352687383378d9ee2f5017668ebaac9fc7

0 commit comments

Comments
 (0)