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 25bfdb1be129ba6707a036ed51c52e4459f50f1a
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri Oct 4 11:40:57 2024 +0200

    mcu/nrf: Move NVIC_Relocate to hal_system_init
    
    Function NVIC_Relocate() was called in SystemInit() which
    is in file from Nordic.
    
    Now call is moved to mynewt specific function hal_system_init
    that is called just after SystemInit finishes.
    This is done to leave file from external source as close to
    origin as possible in case of future update.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/mcu/nordic/nrf51xxx/src/hal_system.c            | 3 +++
 hw/mcu/nordic/nrf51xxx/src/system_nrf51.c          | 2 --
 hw/mcu/nordic/nrf52xxx/src/hal_system.c            | 2 ++
 hw/mcu/nordic/nrf52xxx/src/system_nrf52.c          | 2 --
 hw/mcu/nordic/nrf5340/src/hal_system.c             | 3 +++
 hw/mcu/nordic/nrf5340/src/system_nrf5340.c         | 2 --
 hw/mcu/nordic/nrf5340_net/src/hal_system.c         | 3 +++
 hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c | 2 --
 hw/mcu/nordic/nrf91xx/src/hal_system.c             | 3 +++
 hw/mcu/nordic/nrf91xx/src/system_nrf9160.c         | 2 --
 10 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_system.c 
b/hw/mcu/nordic/nrf51xxx/src/hal_system.c
index 03e2eb489..884067ebe 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_system.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_system.c
@@ -19,6 +19,7 @@
 
 #include "os/mynewt.h"
 #include <mcu/cortex_m0.h>
+#include "mynewt_cm.h"
 #include "hal/hal_system.h"
 #include <nrf51.h>
 #include <nrf51_bitfields.h>
@@ -36,6 +37,8 @@
 void
 hal_system_init(void)
 {
+    NVIC_Relocate();
+
 #if MYNEWT_VAL(MCU_DCDC_ENABLED)
     NRF_POWER->DCDCEN = 1;
 #endif
diff --git a/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c 
b/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c
index c90ed6f01..55e8de81e 100644
--- a/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c
+++ b/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c
@@ -79,8 +79,6 @@ void SystemInit(void)
     {
         NRF_MPU->DISABLEINDEBUG = MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled 
<< MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos;
     }
-
-    NVIC_Relocate();
 }
 
 
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_system.c 
b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
index 497c7b6a9..cd8e63d39 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_system.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
@@ -19,6 +19,7 @@
 
 #include "syscfg/syscfg.h"
 #include "mcu/cortex_m4.h"
+#include "mynewt_cm.h"
 #include "hal/hal_system.h"
 #include "hal/hal_debug.h"
 #include "nrf.h"
@@ -37,6 +38,7 @@
 void
 hal_system_init(void)
 {
+    NVIC_Relocate();
 
 #if MYNEWT_VAL(MCU_ICACHE_ENABLED)
     NRF_NVMC->ICACHECNF = 1;
diff --git a/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c 
b/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c
index c236e0b73..5046afd04 100644
--- a/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c
+++ b/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c
@@ -532,8 +532,6 @@ void SystemInit(void)
     nrf52_handle_approtect();
 
     SystemCoreClockUpdate();
-
-    NVIC_Relocate();
 }
 
 #ifdef NRF52
diff --git a/hw/mcu/nordic/nrf5340/src/hal_system.c 
b/hw/mcu/nordic/nrf5340/src/hal_system.c
index a1e863f32..ff9305d07 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_system.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_system.c
@@ -22,6 +22,7 @@
 #include <mcu/nrf5340_clock.h>
 #include <hal/hal_system.h>
 #include <hal/hal_debug.h>
+#include "mynewt_cm.h"
 #include <nrf.h>
 #include <nrfx_config.h>
 #include <hal/nrf_oscillators.h>
@@ -40,6 +41,8 @@
 void
 hal_system_init(void)
 {
+    NVIC_Relocate();
+
 #if MYNEWT_VAL(MCU_CACHE_ENABLED)
 #if MYNEWT_VAL(MCU_APP_SECURE) || MYNEWT_VAL(BOOT_LOADER)
     NRF_CACHE_S->ENABLE = 1;
diff --git a/hw/mcu/nordic/nrf5340/src/system_nrf5340.c 
b/hw/mcu/nordic/nrf5340/src/system_nrf5340.c
index bf01a9f45..ef8ad0d11 100644
--- a/hw/mcu/nordic/nrf5340/src/system_nrf5340.c
+++ b/hw/mcu/nordic/nrf5340/src/system_nrf5340.c
@@ -254,8 +254,6 @@ void SystemInit(void)
 
     SystemCoreClockUpdate();
 
-    NVIC_Relocate();
-
     /* Setup Cortex-M33 stack limiter to detect stack overflow in interrupts 
and bootloader code */
     __set_MSPLIM((uint32_t)__StackLimit);
 }
diff --git a/hw/mcu/nordic/nrf5340_net/src/hal_system.c 
b/hw/mcu/nordic/nrf5340_net/src/hal_system.c
index d7d1f3cb5..71322cf56 100644
--- a/hw/mcu/nordic/nrf5340_net/src/hal_system.c
+++ b/hw/mcu/nordic/nrf5340_net/src/hal_system.c
@@ -22,6 +22,7 @@
 #include <mcu/nrf5340_net_clock.h>
 #include <hal/hal_system.h>
 #include <hal/hal_debug.h>
+#include <mynewt_cm.h>
 #include <nrf.h>
 
 /**
@@ -37,6 +38,8 @@
 void
 hal_system_init(void)
 {
+    NVIC_Relocate();
+
 #if MYNEWT_VAL(MCU_ICACHE_ENABLED)
     NRF_NVMC_NS->ICACHECNF = 1;
 #endif
diff --git a/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c 
b/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c
index 2888f0e0c..bde6bf804 100644
--- a/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c
+++ b/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c
@@ -93,8 +93,6 @@ void SystemInit(void)
 
     SystemCoreClockUpdate();
 
-    NVIC_Relocate();
-
     /* Setup Cortex-M33 stack limiter to detect stack overflow in interrupts 
and bootloader code */
     __set_MSPLIM((uint32_t)__StackLimit);
 }
diff --git a/hw/mcu/nordic/nrf91xx/src/hal_system.c 
b/hw/mcu/nordic/nrf91xx/src/hal_system.c
index 66e24e87d..f370ffb04 100644
--- a/hw/mcu/nordic/nrf91xx/src/hal_system.c
+++ b/hw/mcu/nordic/nrf91xx/src/hal_system.c
@@ -21,6 +21,7 @@
 #include "mcu/cortex_m33.h"
 #include "hal/hal_system.h"
 #include "hal/hal_debug.h"
+#include "mynewt_cm.h"
 #include "nrf.h"
 #include "nrfx_config.h"
 
@@ -37,6 +38,8 @@
 void
 hal_system_init(void)
 {
+    NVIC_Relocate();
+
 #if MYNEWT_VAL(MCU_DCDC_ENABLED)
     NRF_REGULATORS->DCDCEN = 1;
 #endif
diff --git a/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c 
b/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c
index 8100a955f..615c27335 100644
--- a/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c
+++ b/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c
@@ -237,8 +237,6 @@ void SystemInit(void)
     #endif
     
     SystemCoreClockUpdate();
-
-    NVIC_Relocate();
 }
 
 

Reply via email to