Skip to content

Commit 72e3bfe

Browse files
ananglcfriedt
authored andcommitted
soc: nordic_nrf: Add Kconfig options for APPROTECT handling
Add Kconfig options that allow users to select the way the APPROTECT mechanism is handled in the SystemInit() function. Signed-off-by: Andrzej Głąbek <[email protected]> Signed-off-by: Martí Bolívar <[email protected]>
1 parent bdae939 commit 72e3bfe

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

modules/hal_nordic/nrfx/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APP
2727
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK)
2828
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA)
2929

30+
zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK
31+
ENABLE_APPROTECT)
32+
zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_USER_HANDLING
33+
ENABLE_APPROTECT_USER_HANDLING)
34+
zephyr_compile_definitions_ifdef(CONFIG_NRF_SECURE_APPROTECT_LOCK
35+
ENABLE_SECURE_APPROTECT)
36+
zephyr_compile_definitions_ifdef(CONFIG_NRF_SECURE_APPROTECT_USER_HANDLING
37+
ENABLE_SECURE_APPROTECT_USER_HANDLING)
38+
3039
# Connect Kconfig compilation option for Non-Secure software with option required by MDK/nrfx
3140
zephyr_compile_definitions_ifdef(CONFIG_ARM_NONSECURE_FIRMWARE NRF_TRUSTZONE_NONSECURE)
3241
zephyr_compile_definitions_ifdef(CONFIG_LOG_BACKEND_SWO ENABLE_SWO)

soc/arm/nordic_nrf/Kconfig

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,71 @@ config NFCT_PINS_AS_GPIOS
5252
NFC pins in nRF52 series: P0.09 and P0.10
5353
NFC pins in nRF5340: P0.02 and P0.03
5454

55+
choice NRF_APPROTECT_HANDLING
56+
bool "APPROTECT handling"
57+
depends on SOC_SERIES_NRF52X || SOC_NRF5340_CPUNET || \
58+
(SOC_NRF5340_CPUAPP && !TRUSTED_EXECUTION_NONSECURE)
59+
default NRF_APPROTECT_USE_UICR
60+
help
61+
Specifies how the SystemInit() function should handle the APPROTECT
62+
mechanism.
63+
64+
config NRF_APPROTECT_USE_UICR
65+
bool "Use UICR"
66+
help
67+
When this option is selected, the SystemInit() function loads the
68+
firmware branch state of the APPROTECT mechanism from UICR, so if
69+
UICR->APPROTECT is disabled, CTRLAP->APPROTECT will be disabled.
70+
71+
config NRF_APPROTECT_LOCK
72+
bool "Lock"
73+
help
74+
When this option is selected, the SystemInit() function locks
75+
the firmware branch of the APPROTECT mechanism, preventing it
76+
from being opened.
77+
78+
config NRF_APPROTECT_USER_HANDLING
79+
bool "Allow user handling"
80+
depends on !SOC_SERIES_NRF52X
81+
help
82+
When this option is selected, the SystemInit() function does not
83+
touch the APPROTECT mechanism, allowing the user code to handle it
84+
at later stages, for example, to implement authenticated debug.
85+
86+
endchoice
87+
88+
choice NRF_SECURE_APPROTECT_HANDLING
89+
bool "Secure APPROTECT handling"
90+
depends on (SOC_NRF5340_CPUAPP && !TRUSTED_EXECUTION_NONSECURE)
91+
default NRF_SECURE_APPROTECT_USE_UICR
92+
help
93+
Specifies how the SystemInit() function should handle the secure
94+
APPROTECT mechanism.
95+
96+
config NRF_SECURE_APPROTECT_USE_UICR
97+
bool "Use UICR"
98+
help
99+
When this option is selected, the SystemInit() function loads the
100+
firmware branch state of the secure APPROTECT mechanism from UICR,
101+
so if UICR->SECUREAPPROTECT is disabled, CTRLAP->SECUREAPPROTECT
102+
will be disabled.
103+
104+
config NRF_SECURE_APPROTECT_LOCK
105+
bool "Lock"
106+
help
107+
When this option is selected, the SystemInit() function locks the
108+
firmware branch of the secure APPROTECT mechanism, preventing it
109+
from being opened.
110+
111+
config NRF_SECURE_APPROTECT_USER_HANDLING
112+
bool "Allow user handling"
113+
depends on !SOC_SERIES_NRF52X
114+
help
115+
When this option is selected, the SystemInit() function does not
116+
touch the secure APPROTECT mechanism, allowing the user code to
117+
handle it at later stages, for example, to implement authenticated
118+
debug.
119+
120+
endchoice
121+
55122
endif # SOC_FAMILY_NRF

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ manifest:
7878
groups:
7979
- hal
8080
- name: hal_nordic
81-
revision: 00fd2aa97a22ea1052d9dabe1b18ab396daab93a
81+
revision: a6e5299041f152da5ae0ab17b2e44e088bb96d6d
8282
path: modules/hal/nordic
8383
groups:
8484
- hal

0 commit comments

Comments
 (0)