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 e996583745021ceed2cb6728ffe30d5346a87d72
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri Oct 4 12:23:20 2024 +0200

    hw/mcu/MKW41Z4: Move NVIC_Relocate to hal_system_init
    
    NVIC_Relocate call was placed in NXP generated file.
    Now it is moved to hal_system_init function that
    is way it's done in mynewt
    
    Startup code for usbmkw41z now calls hal_system_init
    as is the case for all mynewt platforms
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 .../src/arch/cortex_m0/gcc_startup_mkw41z.s        |  2 ++
 hw/mcu/nxp/mkw41z/src/hal_system_init.c            | 28 ++++++++++++++++++++++
 hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c             |  2 --
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s 
b/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s
index e80a85ffc..73c15a58b 100644
--- a/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s
+++ b/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s
@@ -169,6 +169,8 @@ Reset_Handler:
 
     LDR     R0, =SystemInit
     BLX     R0
+    LDR     R0, =hal_system_init
+    BLX     R0
     LDR     R0, =_start
     BX      R0
     .pool
diff --git a/hw/mcu/nxp/mkw41z/src/hal_system_init.c 
b/hw/mcu/nxp/mkw41z/src/hal_system_init.c
new file mode 100644
index 000000000..2d6348b83
--- /dev/null
+++ b/hw/mcu/nxp/mkw41z/src/hal_system_init.c
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "os/mynewt.h"
+#include <mynewt_cm.h>
+
+void
+hal_system_init(void)
+{
+    /* Relocate the vector table */
+    NVIC_Relocate();
+}
diff --git a/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c 
b/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c
index 77d87b947..aebc7fe63 100644
--- a/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c
+++ b/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c
@@ -67,7 +67,6 @@
 
 #include <stdint.h>
 #include "mcu/fsl_device_registers.h"
-#include "mcu/cmsis_nvic.h"
 
 /* ----------------------------------------------------------------------------
    -- Core clock
@@ -86,7 +85,6 @@ void SystemInit (void) {
   SIM->COPC = (uint32_t)0x00u;
 #endif /* (DISABLE_WDOG) */
 
-  NVIC_Relocate();
 }
 
 /* ----------------------------------------------------------------------------

Reply via email to