Skip to content

Commit 5e1449b

Browse files
SebastianBoerlubos
authored andcommitted
[nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.TRIGGER
Add support for UICR.SECONDARY.TRIGGER configuration, which enables automatic booting of secondary firmware based on specific reset reasons. This introduces Kconfig options for configuring: - UICR.SECONDARY.TRIGGER.ENABLE - Enable/disable automatic triggers - UICR.SECONDARY.TRIGGER.RESETREAS - Bitmask of reset reasons that trigger secondary firmware boot Individual Kconfig options are provided for each reset reason: - APPLICATIONWDT0/1 - Application core watchdog timeouts - APPLICATIONLOCKUP - Application core CPU lockup - RADIOCOREWDT0/1 - Radio core watchdog timeouts - RADIOCORELOCKUP - Radio core CPU lockup Signed-off-by: Sebastian Bøe <[email protected]> (cherry picked from commit 9dc2b61)
1 parent 009778d commit 5e1449b

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

scripts/ci/check_compliance.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,13 @@ def check_no_undef_outside_kconfig(self, kconf):
13561356
"GEN_UICR_SECONDARY",
13571357
"GEN_UICR_SECONDARY_GENERATE_PERIPHCONF",
13581358
"GEN_UICR_SECONDARY_PROCESSOR_VALUE",
1359+
"GEN_UICR_SECONDARY_TRIGGER",
1360+
"GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP",
1361+
"GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0",
1362+
"GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1",
1363+
"GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP",
1364+
"GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0",
1365+
"GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1",
13591366
"GEN_UICR_SECONDARY_WDTSTART",
13601367
"GEN_UICR_SECONDARY_WDTSTART_CRV",
13611368
"GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE",

soc/nordic/common/uicr/gen_uicr.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,20 @@ def main() -> None:
487487
type=lambda s: int(s, 0),
488488
help="Processor to boot for the secondary firmware ",
489489
)
490+
parser.add_argument(
491+
"--secondary-trigger",
492+
action="store_true",
493+
help="Enable UICR.SECONDARY.TRIGGER for automatic secondary firmware boot on reset events",
494+
)
495+
parser.add_argument(
496+
"--secondary-trigger-resetreas",
497+
default=0,
498+
type=lambda s: int(s, 0),
499+
help=(
500+
"Bitmask of reset reasons that trigger secondary firmware boot "
501+
"(decimal or 0x-prefixed hex)"
502+
),
503+
)
490504
parser.add_argument(
491505
"--secondary-periphconf-address",
492506
default=None,
@@ -628,6 +642,11 @@ def main() -> None:
628642
uicr.SECONDARY.ADDRESS = args.secondary_address
629643
uicr.SECONDARY.PROCESSOR = args.secondary_processor
630644

645+
# Handle secondary TRIGGER configuration
646+
if args.secondary_trigger:
647+
uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE
648+
uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas
649+
631650
# Handle secondary periphconf if provided
632651
if args.out_secondary_periphconf_hex:
633652
secondary_periphconf_combined = extract_and_combine_periphconfs(

soc/nordic/common/uicr/gen_uicr/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,34 @@ if(CONFIG_GEN_UICR_SECONDARY)
188188
list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV})
189189
endif()
190190

191+
# Handle secondary TRIGGER configuration
192+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER)
193+
list(APPEND secondary_args --secondary-trigger)
194+
195+
# Compute RESETREAS bitmask from individual trigger configs
196+
set(resetreas_value 0)
197+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0)
198+
math(EXPR resetreas_value "${resetreas_value} + 0x001")
199+
endif()
200+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1)
201+
math(EXPR resetreas_value "${resetreas_value} + 0x002")
202+
endif()
203+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP)
204+
math(EXPR resetreas_value "${resetreas_value} + 0x008")
205+
endif()
206+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0)
207+
math(EXPR resetreas_value "${resetreas_value} + 0x020")
208+
endif()
209+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1)
210+
math(EXPR resetreas_value "${resetreas_value} + 0x040")
211+
endif()
212+
if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP)
213+
math(EXPR resetreas_value "${resetreas_value} + 0x100")
214+
endif()
215+
216+
list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value})
217+
endif()
218+
191219
if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF)
192220
# Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree
193221
compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE)

soc/nordic/common/uicr/gen_uicr/Kconfig

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,48 @@ config GEN_UICR_SECONDARY_PROCESSOR_VALUE
168168
default 0xBD2328A8 if GEN_UICR_SECONDARY_PROCESSOR_APPLICATION
169169
default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE
170170

171+
config GEN_UICR_SECONDARY_TRIGGER
172+
bool "Enable UICR.SECONDARY.TRIGGER"
173+
help
174+
When enabled, configures automatic triggers that cause IronSide SE
175+
to boot the secondary firmware instead of the primary firmware based
176+
on specific reset reasons.
177+
178+
if GEN_UICR_SECONDARY_TRIGGER
179+
180+
config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0
181+
bool "Trigger on Application domain watchdog 0 reset"
182+
help
183+
Boot secondary firmware when Application domain watchdog 0 causes a reset.
184+
185+
config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1
186+
bool "Trigger on Application domain watchdog 1 reset"
187+
help
188+
Boot secondary firmware when Application domain watchdog 1 causes a reset.
189+
190+
config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP
191+
bool "Trigger on Application domain CPU lockup reset"
192+
help
193+
Boot secondary firmware when Application domain CPU lockup causes a reset.
194+
195+
config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0
196+
bool "Trigger on Radio core watchdog 0 reset"
197+
help
198+
Boot secondary firmware when Radio core watchdog 0 causes a reset.
199+
200+
config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1
201+
bool "Trigger on Radio core watchdog 1 reset"
202+
help
203+
Boot secondary firmware when Radio core watchdog 1 causes a reset.
204+
205+
config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP
206+
bool "Trigger on Radio core CPU lockup reset"
207+
help
208+
Boot secondary firmware when Radio core CPU lockup causes a reset.
209+
210+
211+
endif # GEN_UICR_SECONDARY_TRIGGER
212+
171213
endif # GEN_UICR_SECONDARY
172214

173215
endmenu

0 commit comments

Comments
 (0)