Skip to content

Commit 6c9b26c

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 dc45b2a commit 6c9b26c

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
@@ -1306,6 +1306,13 @@ def check_no_undef_outside_kconfig(self, kconf):
13061306
"GEN_UICR_SECONDARY",
13071307
"GEN_UICR_SECONDARY_GENERATE_PERIPHCONF",
13081308
"GEN_UICR_SECONDARY_PROCESSOR_VALUE",
1309+
"GEN_UICR_SECONDARY_TRIGGER",
1310+
"GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP",
1311+
"GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0",
1312+
"GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1",
1313+
"GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP",
1314+
"GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0",
1315+
"GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1",
13091316
"GEN_UICR_SECONDARY_WDTSTART",
13101317
"GEN_UICR_SECONDARY_WDTSTART_CRV",
13111318
"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
@@ -166,6 +166,48 @@ config GEN_UICR_SECONDARY_PROCESSOR_VALUE
166166
default 0xBD2328A8 if GEN_UICR_SECONDARY_PROCESSOR_APPLICATION
167167
default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE
168168

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

171213
endmenu

0 commit comments

Comments
 (0)