mcu/nrf5340: Enable cache only from secure code
This is allowed only from secure code (either application running
in secure mode, or bootloader).
@@ -38,8 +38,10 @@ void
hal_system_init(void)
{
#if MYNEWT_VAL(MCU_CACHE_ENABLED)
+#if MYNEWT_VAL(MCU_APP_SECURE) || MYNEWT_VAL(BOOT_LOADER)
NRF_CACHE_S->ENABLE = 1;
#endif
+#endif
#if MYNEWT_VAL(MCU_DCDC_ENABLED)
NRF_REGULATORS->VREGMAIN.DCDCEN = 1;
