You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/10/26 17:04:19 UTC
[mynewt-core] 08/10: hw/ipc_nrf5340: Allow non-secure execution
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 0de28dec7b33921abb823ff806fcca54c9d08785
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Oct 20 16:18:45 2021 +0200
hw/ipc_nrf5340: Allow non-secure execution
Code was using NRF_RESET_S.
Now it uses NRF_RESET which can be non-secure.
In case of secure execution net core gains access to app core RAM.
In case of non-secure execution RAM is non-secure so no permission
change is needed (it would be not possible anyway since NRF_SPU_S is
secure only peripheral).
---
hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c b/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
index 1690955..e1a3ee5 100644
--- a/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
+++ b/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
@@ -22,6 +22,10 @@
#include <ipc_nrf5340/ipc_nrf5340.h>
#include <ipc_nrf5340/ipc_nrf5340_priv.h>
#include <nrfx.h>
+#include <hal/hal_gpio.h>
+#include <bsp.h>
+#include <nrf_mutex.h>
+
#if MYNEWT_VAL(IPC_NRF5340_NET_GPIO)
#include <mcu/nrf5340_hal.h>
#include <bsp/bsp.h>
@@ -219,7 +223,7 @@ ipc_nrf5340_init(void)
#endif
/* Make sure network core if off when we set up IPC */
- NRF_RESET_S->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Hold;
+ NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Hold;
memset(shms, 0, sizeof(shms));
for (i = 0; i < IPC_MAX_CHANS; ++i) {
@@ -252,11 +256,13 @@ ipc_nrf5340_init(void)
ipc_nrf5340_init_nrf_ipc();
- /* this allows netcore to access appcore RAM */
- NRF_SPU_S->EXTDOMAIN[0].PERM = SPU_EXTDOMAIN_PERM_SECATTR_Secure << SPU_EXTDOMAIN_PERM_SECATTR_Pos;
+ if (MYNEWT_VAL(MCU_APP_SECURE)) {
+ /* this allows netcore to access appcore RAM */
+ NRF_SPU_S->EXTDOMAIN[0].PERM = SPU_EXTDOMAIN_PERM_SECATTR_Secure << SPU_EXTDOMAIN_PERM_SECATTR_Pos;
+ }
/* Start Network Core */
- NRF_RESET_S->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release;
+ NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release;
#if MYNEWT_VAL(NRF5340_EMBED_NET_CORE)
/*