Skip to content

Commit 801107e

Browse files
hakonfamkartben
authored andcommitted
drivers: firmware: add IRONside boot report
The boot report is used to pass information from IRONside to a CPU being booted. Integrate the boot report to the update service sample. Signed-off-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no>
1 parent 588c2e6 commit 801107e

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
status = "okay";
2323
};
2424

25+
ironside_se_boot_report: &cpuapp_ironside_se_boot_report {};
26+
2527
boot_partition: &cpuapp_boot_partition {
2628
label = "mcuboot";
2729
};

drivers/firmware/nrf_ironside/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ zephyr_library()
55

66
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c)
77

8+
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c)
89
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c)
910
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c)

drivers/firmware/nrf_ironside/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,11 @@ config NRF_IRONSIDE_UPDATE_SERVICE
4343
help
4444
Service used to update the IRONside SE firmware.
4545

46+
config NRF_IRONSIDE_BOOT_REPORT
47+
bool "IRONside boot report"
48+
depends on $(dt_nodelabel_exists,ironside_se_boot_report)
49+
select NRF_IRONSIDE
50+
help
51+
Support for parsing the Boot Report populated by Nordic IRONside firmware.
52+
4653
endmenu
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <errno.h>
7+
#include <zephyr/devicetree.h>
8+
#include <zephyr/drivers/firmware/nrf_ironside/boot_report.h>
9+
10+
#define IRONSIDE_SE_BOOT_REPORT_ADDR DT_REG_ADDR(DT_NODELABEL(ironside_se_boot_report))
11+
12+
int ironside_boot_report_get(const struct ironside_boot_report **report)
13+
{
14+
const struct ironside_boot_report *tmp_report = (void *)IRONSIDE_SE_BOOT_REPORT_ADDR;
15+
16+
if (tmp_report->magic != IRONSIDE_BOOT_REPORT_MAGIC) {
17+
return -EINVAL;
18+
}
19+
20+
*report = tmp_report;
21+
22+
return 0;
23+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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_BOOT_REPORT_H_
7+
#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_
8+
9+
#include <stdint.h>
10+
#include <stddef.h>
11+
12+
/** Constant used to check if an Nordic IRONside SE boot report has been written. */
13+
#define IRONSIDE_BOOT_REPORT_MAGIC (0x4d69546fUL)
14+
/** Length of the local domain context buffer in bytes. */
15+
#define IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE (16UL)
16+
/** Length of the random data buffer in bytes. */
17+
#define IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE (32UL)
18+
19+
/** @brief IRONside version structure. */
20+
struct ironside_version {
21+
/** Wrapping sequence number ranging from 1-126, incremented for each release. */
22+
uint8_t seqnum;
23+
/** Path version. */
24+
uint8_t patch;
25+
/** Minor version. */
26+
uint8_t minor;
27+
/** Major version. */
28+
uint8_t major;
29+
/** Human readable extraversion string. */
30+
char extraversion[12];
31+
};
32+
33+
/** @brief UICR error description contained in the boot report. */
34+
struct ironside_boot_report_uicr_error {
35+
/** The type of error. A value of 0 indicates no error */
36+
uint32_t error_type;
37+
/** Error descriptions specific to each type of UICR error */
38+
union {
39+
/** RFU */
40+
struct {
41+
uint32_t rfu[4];
42+
} rfu;
43+
} description;
44+
};
45+
46+
/** @brief IRONside boot report. */
47+
struct ironside_boot_report {
48+
/** Magic value used to identify valid boot report */
49+
uint32_t magic;
50+
/** Firmware version of IRONside SE. */
51+
struct ironside_version ironside_se_version;
52+
/** Firmware version of IRONside SE recovery firmware. */
53+
struct ironside_version ironside_se_recovery_version;
54+
/** Copy of SICR.UROT.UPDATE.STATUS.*/
55+
uint32_t ironside_update_status;
56+
/** See @ref ironside_boot_report_uicr_error */
57+
struct ironside_boot_report_uicr_error uicr_error_description;
58+
/** Data passed from booting local domain to local domain being booted */
59+
uint8_t local_domain_context[IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE];
60+
/** CSPRNG data */
61+
uint8_t random_data[IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE];
62+
/** Reserved for Future Use */
63+
uint32_t rfu[64];
64+
};
65+
66+
/**
67+
* @brief Get a pointer to the IRONside boot report.
68+
*
69+
* @param[out] report Will be set to point to the IRONside boot report.
70+
*
71+
* @retval 0 if successful.
72+
* @retval -EFAULT if the magic field in the report is incorrect.
73+
* @retval -EINVAL if @p report is NULL.
74+
*/
75+
int ironside_boot_report_get(const struct ironside_boot_report **report);
76+
77+
#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CONFIG_LOG=y
22

33
CONFIG_NRF_IRONSIDE_UPDATE_SERVICE=y
4+
CONFIG_NRF_IRONSIDE_BOOT_REPORT=y

samples/boards/nordic/nrf_ironside/update/src/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/drivers/firmware/nrf_ironside/boot_report.h>
78
#include <zephyr/drivers/firmware/nrf_ironside/update.h>
89
#include <zephyr/logging/log.h>
910

@@ -13,6 +14,18 @@ int main(void)
1314
{
1415
int err;
1516
const struct ironside_update_blob *update = (void *)CONFIG_UPDATE_BLOB_ADDRESS;
17+
const struct ironside_boot_report *report;
18+
19+
err = ironside_boot_report_get(&report);
20+
LOG_INF("ironside_boot_report_get err: %d", err);
21+
LOG_INF("version: %d.%d.%d-%s+%d", report->ironside_se_version.major,
22+
report->ironside_se_version.minor, report->ironside_se_version.patch,
23+
report->ironside_se_version.extraversion, report->ironside_se_version.seqnum);
24+
LOG_INF("recovery version: %d.%d.%d-%s+%d", report->ironside_se_version.major,
25+
report->ironside_se_version.minor, report->ironside_se_version.patch,
26+
report->ironside_se_version.extraversion, report->ironside_se_version.seqnum);
27+
LOG_INF("update status: 0x%x", report->ironside_update_status);
28+
LOG_HEXDUMP_INF((void *)report->random_data, sizeof(report->random_data), "random data");
1629

1730
err = ironside_update(update);
1831
LOG_INF("IRONside update retval: 0x%x", err);

0 commit comments

Comments
 (0)