Skip to content

Commit 51609f0

Browse files
jonathannilsenhakonfam
authored andcommitted
drivers: firmware: nrf_ironside: add IRONside update service
Add an IPC service API for triggering updates of the Nordic IRONside SE firmware using the IRONside call module. Co-authored-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no> Signed-off-by: Jonathan Nilsen <jonathan.nilsen@nordicsemi.no>
1 parent afc8389 commit 51609f0

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed

drivers/firmware/nrf_ironside/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ zephyr_library()
66
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c)
77

88
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c)
9+
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c)

drivers/firmware/nrf_ironside/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@ config NRF_IRONSIDE_CPUCONF_SERVICE
3737
help
3838
Service used to boot local domain cores.
3939

40+
config NRF_IRONSIDE_UPDATE_SERVICE
41+
bool "IRONside update service"
42+
select NRF_IRONSIDE_CALL
43+
help
44+
Service used to update the IRONside SE firmware.
45+
4046
endmenu
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/drivers/firmware/nrf_ironside/update.h>
7+
#include <zephyr/drivers/firmware/nrf_ironside/call.h>
8+
9+
int ironside_update(const struct ironside_update_blob *update)
10+
{
11+
int err;
12+
struct ironside_call_buf *const buf = ironside_call_alloc();
13+
14+
buf->id = IRONSIDE_CALL_ID_UPDATE_SERVICE_V0;
15+
buf->args[IRONSIDE_UPDATE_SERVICE_UPDATE_PTR_IDX] = (uintptr_t)update;
16+
17+
ironside_call_dispatch(buf);
18+
19+
if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) {
20+
err = buf->args[IRONSIDE_UPDATE_SERVICE_RETCODE_IDX];
21+
} else {
22+
err = buf->status;
23+
}
24+
25+
ironside_call_release(buf);
26+
27+
return err;
28+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_
7+
#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_
8+
9+
#include <stdint.h>
10+
#include <stddef.h>
11+
12+
/**
13+
* @name Update service error codes.
14+
* @{
15+
*/
16+
17+
/** Caller does not have access to the provided update candidate buffer. */
18+
#define IRONSIDE_UPDATE_ERROR_NOT_PERMITTED (1)
19+
/** Failed to write the update metadata to SICR. */
20+
#define IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED (2)
21+
22+
/**
23+
* @}
24+
*/
25+
26+
/** Length of the update manifest in bytes */
27+
#define IRONSIDE_UPDATE_MANIFEST_LENGTH (256)
28+
/** Length of the update public key in bytes. */
29+
#define IRONSIDE_UPDATE_PUBKEY_LENGTH (32)
30+
/** Length of the update signature in bytes. */
31+
#define IRONSIDE_UPDATE_SIGNATURE_LENGTH (64)
32+
33+
/* IRONside call identifiers with implicit versions.
34+
*
35+
* With the initial "version 0", the service ABI is allowed to break until the
36+
* first production release of IRONside SE.
37+
*/
38+
#define IRONSIDE_CALL_ID_UPDATE_SERVICE_V0 1
39+
40+
/* Index of the update blob pointer within the service buffer. */
41+
#define IRONSIDE_UPDATE_SERVICE_UPDATE_PTR_IDX (0)
42+
/* Index of the return code within the service buffer. */
43+
#define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0)
44+
45+
/**
46+
* @brief IRONside update blob.
47+
*/
48+
struct ironside_update_blob {
49+
uint8_t manifest[IRONSIDE_UPDATE_MANIFEST_LENGTH];
50+
uint8_t pubkey[IRONSIDE_UPDATE_PUBKEY_LENGTH];
51+
uint8_t signature[IRONSIDE_UPDATE_SIGNATURE_LENGTH];
52+
uint32_t firmware[];
53+
};
54+
55+
/**
56+
* @brief Request a firmware upgrade of the IRONside SE.
57+
*
58+
* This invokes the IRONside SE update service. The device must be restarted for the update
59+
* to be installed. Check the update status in the application boot report to see if the update
60+
* was successfully installed.
61+
*
62+
* @param update Pointer to update blob
63+
*
64+
* @retval -IRONSIDE_UPDATE_ERROR_NOT_PERMITTED if missing access to the update candidate.
65+
* @retval -IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED if writing update parameters to SICR failed.
66+
* @returns Positive non-0 error status if reported by IRONside call.
67+
* @returns 0 on a successful request (although the update itself may still fail).
68+
*
69+
*/
70+
int ironside_update(const struct ironside_update_blob *update);
71+
72+
#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ */

0 commit comments

Comments
 (0)