diff --git a/lib/fprotect/fprotect_spu.c b/lib/fprotect/fprotect_spu.c index d2aafd5b9..811358d10 100644 --- a/lib/fprotect/fprotect_spu.c +++ b/lib/fprotect/fprotect_spu.c @@ -12,7 +12,12 @@ #include +#if defined(CONFIG_SOC_NRF5340_CPUAPP) \ + && defined(CONFIG_NRF5340_CPUAPP_ERRATUM19) +#define SPU_BLOCK_SIZE (nrf53_errata_19() ? 32*1024 : 16*1024) +#else #define SPU_BLOCK_SIZE CONFIG_FPROTECT_BLOCK_SIZE +#endif int fprotect_area(uint32_t start, size_t length) { diff --git a/subsys/spm/spm_internal.h b/subsys/spm/spm_internal.h index 426fe6e38..3d25b43fb 100644 --- a/subsys/spm/spm_internal.h +++ b/subsys/spm/spm_internal.h @@ -31,6 +31,15 @@ extern "C" { / RAM_SECURE_ATTRIBUTION_REGION_SIZE) /* SPU FLASH regions */ +#if (defined(CONFIG_SOC_NRF5340_CPUAPP) \ + && defined(CONFIG_NRF5340_CPUAPP_ERRATUM19)) + +#define FLASH_SECURE_ATTRIBUTION_REGION_SIZE \ + (nrf53_errata_19() ? 32*1024 : 16*1024) +#define NUM_FLASH_SECURE_ATTRIBUTION_REGIONS (nrf53_errata_19() ? 32 : 64) +#else + + #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) #define SOC_NV_FLASH_SIZE DT_REG_SIZE(SOC_NV_FLASH_NODE) @@ -38,6 +47,8 @@ extern "C" { #define NUM_FLASH_SECURE_ATTRIBUTION_REGIONS (SOC_NV_FLASH_SIZE \ / FLASH_SECURE_ATTRIBUTION_REGION_SIZE) +#endif + /* Minimum size of Non-Secure Callable regions. */ #define FLASH_NSC_MIN_SIZE 32