Skip to content

Commit 929cdb0

Browse files
committed
[nrf fromlist] soc: nordic: Add UICR.RECOVERY configuration support
Add Kconfig options to configure the UICR RECOVERY field for enabling recovery firmware boot on Nordic Haltium SoCs. The configuration includes settings for processor core selection (APPLICATION or RADIOCORE), initial secure vector table offset register (INITSVTOR) address, and recovery firmware partition size in 4KB blocks. Upstream PR #: 91826 Signed-off-by: Sebastian Bøe <[email protected]>
1 parent 04c19ff commit 929cdb0

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

soc/nordic/common/uicr/Kconfig

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,49 @@ config NRF_HALTIUM_UICR_PERIPHCONF
1919
to point at the blob. The initialization values are then loaded ahead of
2020
ahead of the application boot.
2121

22+
config NRF_HALTIUM_UICR_RECOVERY
23+
bool "Configure UICR RECOVERY field"
24+
help
25+
Configure the UICR RECOVERY field to enable recovery firmware boot.
26+
This should be enabled by the main application to configure recovery
27+
firmware parameters. The recovery firmware itself does not need to
28+
enable this option.
29+
30+
if NRF_HALTIUM_UICR_RECOVERY
31+
32+
choice NRF_HALTIUM_UICR_RECOVERY_PROCESSOR
33+
prompt "Recovery processor core"
34+
default NRF_HALTIUM_UICR_RECOVERY_PROCESSOR_APPLICATION
35+
help
36+
Select the processor core for recovery firmware.
37+
38+
config NRF_HALTIUM_UICR_RECOVERY_PROCESSOR_APPLICATION
39+
bool "APPLICATION (cpuapp)"
40+
help
41+
Boot the APPLICATION processor core for recovery firmware.
42+
43+
config NRF_HALTIUM_UICR_RECOVERY_PROCESSOR_RADIOCORE
44+
bool "RADIOCORE (cpurad)"
45+
help
46+
Boot the RADIOCORE processor core for recovery firmware.
47+
48+
endchoice
49+
50+
config NRF_HALTIUM_UICR_RECOVERY_INITSVTOR
51+
hex "Recovery firmware INITSVTOR address"
52+
help
53+
Initial value of the secure VTOR (Vector Table Offset Register)
54+
for recovery firmware. This should match the recovery firmware's
55+
memory partition address.
56+
57+
config NRF_HALTIUM_UICR_RECOVERY_SIZE4KB
58+
int "Recovery firmware size in 4KB blocks"
59+
range 1 1024
60+
help
61+
Size of the recovery firmware partition in 4KB blocks.
62+
63+
endif # NRF_HALTIUM_UICR_RECOVERY
64+
2265
endif
2366

2467
config NRF_PERIPHCONF_SECTION

soc/nordic/common/uicr/gen_uicr.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
ENABLED_VALUE = 0xFFFF_FFFF
3131
DISABLED_VALUE = 0xBD23_28A8
3232

33+
# Recovery processor core enum values
34+
RECOVERY_PROCESSOR_APPLICATION = 0xBD2328A8
35+
RECOVERY_PROCESSOR_RADIOCORE = 0x1730C77F
36+
3337

3438
class ScriptError(RuntimeError): ...
3539

@@ -197,6 +201,27 @@ def main() -> None:
197201
uicr.PERIPHCONF.ADDRESS = periphconf_address
198202
uicr.PERIPHCONF.MAXCOUNT = math.floor(periphconf_size / 8)
199203

204+
# Configure RECOVERY field if enabled
205+
if kconfig.get("CONFIG_NRF_HALTIUM_UICR_RECOVERY") == "y":
206+
uicr.RECOVERY.ENABLE = ENABLED_VALUE
207+
208+
# Determine processor core from choice configuration
209+
if kconfig.get("CONFIG_NRF_HALTIUM_UICR_RECOVERY_PROCESSOR_APPLICATION") == "y":
210+
processor = RECOVERY_PROCESSOR_APPLICATION
211+
elif kconfig.get("CONFIG_NRF_HALTIUM_UICR_RECOVERY_PROCESSOR_RADIOCORE") == "y":
212+
processor = RECOVERY_PROCESSOR_RADIOCORE
213+
else:
214+
raise ScriptError("Unreachable code")
215+
uicr.RECOVERY.PROCESSOR = processor
216+
217+
# Get and parse INITSVTOR address
218+
initsvtor = int(kconfig.get("CONFIG_NRF_HALTIUM_UICR_RECOVERY_INITSVTOR"), 0)
219+
uicr.RECOVERY.INITSVTOR = initsvtor
220+
221+
# Get and parse size in 4KB blocks
222+
size4kb = int(kconfig.get("CONFIG_NRF_HALTIUM_UICR_RECOVERY_SIZE4KB"), 0)
223+
uicr.RECOVERY.SIZE4KB = size4kb
224+
200225
try:
201226
uicr_node = edt.label2node[UICR_NODELABEL]
202227
except LookupError as e:
@@ -258,7 +283,7 @@ def extract_and_combine_periphconfs(elf_files: list[argparse.FileType]) -> bytes
258283
def parse_kconfig(content: str) -> dict[str, str | None]:
259284
result = defaultdict(None)
260285
match_iter = re.finditer(
261-
r"^(?P<config>(SB_)?CONFIG_[^=\s]+)=(?P<value>[^\s#])+$", content, re.MULTILINE
286+
r"^(?P<config>(SB_)?CONFIG_[^=\s]+)=(?P<value>[^\s#]+)$", content, re.MULTILINE
262287
)
263288
for match in match_iter:
264289
result[match["config"]] = match["value"]

0 commit comments

Comments
 (0)