arch/nrf53: support for APPROTECT, and disable it at default for now
This commit is contained in:
parent
ad4af9b9c9
commit
49446c8e76
@ -61,6 +61,10 @@ endif # NRF53_NET_BOOT
|
||||
|
||||
endif # NRF53_APPCORE
|
||||
|
||||
config NRF53_ENABLE_APPROTECT
|
||||
bool "NRF53 enable APPROTECT"
|
||||
default n
|
||||
|
||||
# Peripheral Selection
|
||||
|
||||
config NRF53_UART
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "nrf53_clockconfig.h"
|
||||
#include "hardware/nrf53_utils.h"
|
||||
#include "hardware/nrf53_uicr.h"
|
||||
#include "hardware/nrf53_ctrlap.h"
|
||||
#include "nrf53_lowputc.h"
|
||||
#include "nrf53_start.h"
|
||||
#include "nrf53_cpunet.h"
|
||||
@ -71,6 +73,33 @@
|
||||
void __start(void) noinstrument_function;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf53_approtect
|
||||
****************************************************************************/
|
||||
|
||||
void nrf53_approtect(void)
|
||||
{
|
||||
#ifdef CONFIG_NRF53_ENABLE_APPROTECT
|
||||
/* Lock APPROTECT.DISABLE */
|
||||
|
||||
putreg32(CTRLAP_APPROTECTLOCK_LOCKED, NRF53_CTRLAP_APPROTECTLOCK);
|
||||
#else
|
||||
uint32_t regval = 0;
|
||||
|
||||
/* Load APPROTECT from UICR */
|
||||
|
||||
regval = getreg32(NRF53_UICR_APPROTECT);
|
||||
putreg32(regval, NRF53_CTRLAP_APPROTECTDISABLE);
|
||||
|
||||
# ifdef CONFIG_NRF53_APPCORE
|
||||
/* Load SECUREAPPROTECT from UICR only for the App core */
|
||||
|
||||
regval = getreg32(NRF53_UICR_SECUREAPPROTECT);
|
||||
putreg32(regval, NRF53_CTRLAP_SECUREREADPROTECTDISABLE);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -99,6 +128,10 @@ void __start(void)
|
||||
|
||||
__asm__ __volatile__ ("\tcpsid i\n");
|
||||
|
||||
/* Handle APPROTECT configuration */
|
||||
|
||||
nrf53_approtect();
|
||||
|
||||
#ifdef CONFIG_NRF53_NET_BOOT
|
||||
/* Boot CPU NET before console init */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user