This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 5a857ab44659fec5b4e4d4f07a2071b4e31a2cc4
Author: buxiasen <[email protected]>
AuthorDate: Sun Dec 14 17:40:01 2025 +0800

    arch/arm_m: merge ram_vector armv6/7/8-m into arm_m
    
    For v6m add NVIC_VECTAB in nvic.h temporally for compatible
    
    Signed-off-by: buxiasen <[email protected]>
---
 arch/arm/src/arm_m/CMakeLists.txt                  |   4 +
 arch/arm/src/arm_m/Make.defs                       |   4 +
 .../arm/src/{armv8-m => arm_m}/arm_ramvec_attach.c |   4 +-
 .../src/{armv7-m => arm_m}/arm_ramvec_initialize.c |   6 +-
 arch/arm/src/{armv8-m => arm_m}/ram_vectors.h      |  37 +++---
 arch/arm/src/armv6-m/CMakeLists.txt                |   4 -
 arch/arm/src/armv6-m/Make.defs                     |   4 -
 arch/arm/src/armv6-m/nvic.h                        |   2 +
 arch/arm/src/armv6-m/ram_vectors.h                 | 115 ----------------
 arch/arm/src/armv7-m/CMakeLists.txt                |   4 -
 arch/arm/src/armv7-m/Make.defs                     |   4 -
 arch/arm/src/armv7-m/arm_ramvec_attach.c           | 104 ---------------
 arch/arm/src/armv7-m/ram_vectors.h                 | 148 ---------------------
 arch/arm/src/armv8-m/CMakeLists.txt                |   4 -
 arch/arm/src/armv8-m/Make.defs                     |   4 -
 arch/arm/src/armv8-m/arm_ramvec_initialize.c       | 117 ----------------
 16 files changed, 33 insertions(+), 532 deletions(-)

diff --git a/arch/arm/src/arm_m/CMakeLists.txt 
b/arch/arm/src/arm_m/CMakeLists.txt
index f671238a856..7dd743afcf8 100644
--- a/arch/arm/src/arm_m/CMakeLists.txt
+++ b/arch/arm/src/arm_m/CMakeLists.txt
@@ -32,4 +32,8 @@ if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS)
   list(APPEND SRCS arm_vectors.c)
 endif()
 
+if(CONFIG_ARCH_RAMVECTORS)
+  list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c)
+endif()
+
 target_sources(arch PRIVATE ${SRCS})
diff --git a/arch/arm/src/arm_m/Make.defs b/arch/arm/src/arm_m/Make.defs
index b3869c90ace..0274c13cdee 100644
--- a/arch/arm/src/arm_m/Make.defs
+++ b/arch/arm/src/arm_m/Make.defs
@@ -35,3 +35,7 @@ endif
 ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y)
   CMN_CSRCS += arm_vectors.c
 endif
+
+ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
+  CMN_CSRCS += arm_ramvec_initialize.c arm_ramvec_attach.c
+endif
diff --git a/arch/arm/src/armv8-m/arm_ramvec_attach.c 
b/arch/arm/src/arm_m/arm_ramvec_attach.c
similarity index 97%
rename from arch/arm/src/armv8-m/arm_ramvec_attach.c
rename to arch/arm/src/arm_m/arm_ramvec_attach.c
index 144d2cc9429..4a2a3a88a53 100644
--- a/arch/arm/src/armv8-m/arm_ramvec_attach.c
+++ b/arch/arm/src/arm_m/arm_ramvec_attach.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/arm/src/armv8-m/arm_ramvec_attach.c
+ * arch/arm/src/arm_m/arm_ramvec_attach.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -66,7 +66,7 @@ int arm_ramvec_attach(int irq, up_vector_t vector)
 
   irqinfo("%s IRQ%d\n", vector ? "Attaching" : "Detaching", irq);
 
-  if ((unsigned)irq < ARMV8M_VECTAB_SIZE)
+  if ((unsigned)irq < ARM_VECTAB_SIZE)
     {
       irqstate_t flags;
 
diff --git a/arch/arm/src/armv7-m/arm_ramvec_initialize.c 
b/arch/arm/src/arm_m/arm_ramvec_initialize.c
similarity index 96%
rename from arch/arm/src/armv7-m/arm_ramvec_initialize.c
rename to arch/arm/src/arm_m/arm_ramvec_initialize.c
index bd9877e3a2d..d82011ab5c4 100644
--- a/arch/arm/src/armv7-m/arm_ramvec_initialize.c
+++ b/arch/arm/src/arm_m/arm_ramvec_initialize.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/arm/src/armv7-m/arm_ramvec_initialize.c
+ * arch/arm/src/arm_m/arm_ramvec_initialize.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -61,7 +61,7 @@
  * the highest alignment possible.
  */
 
-up_vector_t g_ram_vectors[ARMV7M_VECTAB_SIZE]
+up_vector_t g_ram_vectors[ARM_VECTAB_SIZE]
   locate_data(".ram_vectors") aligned_data(VECTAB_ALIGN);
 
 /****************************************************************************
@@ -97,7 +97,7 @@ void arm_ramvec_initialize(void)
 
   irqinfo("src=%p dest=%p\n", src, dest);
 
-  for (i = 0; i < ARMV7M_VECTAB_SIZE; i++)
+  for (i = 0; i < ARM_VECTAB_SIZE; i++)
     {
       *dest++ = *src++;
     }
diff --git a/arch/arm/src/armv8-m/ram_vectors.h 
b/arch/arm/src/arm_m/ram_vectors.h
similarity index 86%
rename from arch/arm/src/armv8-m/ram_vectors.h
rename to arch/arm/src/arm_m/ram_vectors.h
index 1efce071f20..72c16189626 100644
--- a/arch/arm/src/armv8-m/ram_vectors.h
+++ b/arch/arm/src/arm_m/ram_vectors.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/arm/src/armv8-m/ram_vectors.h
+ * arch/arm/src/arm_m/ram_vectors.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __ARCH_ARM_SRC_ARMV8_M_RAM_VECTORS_H
-#define __ARCH_ARM_SRC_ARMV8_M_RAM_VECTORS_H
+#ifndef __ARCH_ARM_SRC_ARM_M_RAM_VECTORS_H
+#define __ARCH_ARM_SRC_ARM_M_RAM_VECTORS_H
 
 /****************************************************************************
  * Included Files
@@ -32,12 +32,19 @@
 
 #include "arm_internal.h"
 #include "chip.h"
+#include "nvic.h"
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define ARMV8M_VECTAB_SIZE (ARMV8M_PERIPHERAL_INTERRUPTS + 16)
+#ifdef CONFIG_ARCH_ARMV6M
+#  define ARM_VECTAB_SIZE (ARMV6M_PERIPHERAL_INTERRUPTS + NVIC_IRQ_FIRST)
+#elif defined(CONFIG_ARCH_ARMV7M)
+#  define ARM_VECTAB_SIZE (ARMV7M_PERIPHERAL_INTERRUPTS + NVIC_IRQ_FIRST)
+#elif defined(CONFIG_ARCH_ARMV8M)
+#  define ARM_VECTAB_SIZE (ARMV8M_PERIPHERAL_INTERRUPTS + NVIC_IRQ_FIRST)
+#endif
 
 /* Vector Table Offset Register (VECTAB).  This mask seems to vary among
  * ARMv8-M implementations.  It may need to be redefined in some
@@ -47,15 +54,15 @@
  */
 
 #ifndef NVIC_VECTAB_TBLOFF_MASK
-#  if ARMV8M_VECTAB_SIZE > 512
+#  if ARM_VECTAB_SIZE > 512
 #    define NVIC_VECTAB_TBLOFF_MASK     (0xfffff000)
-#  elif ARMV8M_VECTAB_SIZE > 256
+#  elif ARM_VECTAB_SIZE > 256
 #    define NVIC_VECTAB_TBLOFF_MASK     (0xfffff800)
-#  elif ARMV8M_VECTAB_SIZE > 128
+#  elif ARM_VECTAB_SIZE > 128
 #    define NVIC_VECTAB_TBLOFF_MASK     (0xfffffc00)
-#  elif ARMV8M_VECTAB_SIZE > 64
+#  elif ARM_VECTAB_SIZE > 64
 #    define NVIC_VECTAB_TBLOFF_MASK     (0xfffffe00)
-#  elif ARMV8M_VECTAB_SIZE > 32
+#  elif ARM_VECTAB_SIZE > 32
 #    define NVIC_VECTAB_TBLOFF_MASK     (0xffffff00)
 #  else
 #    define NVIC_VECTAB_TBLOFF_MASK     (0xffffff80)
@@ -80,14 +87,6 @@
 
 #ifdef CONFIG_ARCH_RAMVECTORS
 
-/* This is the size of the vector table (in 4-byte entries).  This size
- * includes the (1) the peripheral interrupts, (2) space for 15 Cortex-M
- * exceptions, and (3) IDLE stack pointer which lies at the beginning of the
- * table.
- */
-
-#define ARMV8M_VECTAB_SIZE (ARMV8M_PERIPHERAL_INTERRUPTS + 16)
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
@@ -104,7 +103,7 @@
  * the highest alignment possible.
  */
 
-extern up_vector_t g_ram_vectors[ARMV8M_VECTAB_SIZE]
+extern up_vector_t g_ram_vectors[ARM_VECTAB_SIZE]
   locate_data(".ram_vectors") aligned_data(VECTAB_ALIGN);
 
 /****************************************************************************
@@ -143,4 +142,4 @@ void exception_common(void);
 int arm_ramvec_attach(int irq, up_vector_t vector);
 
 #endif /* CONFIG_ARCH_RAMVECTORS */
-#endif /* __ARCH_ARM_SRC_ARMV8_M_RAM_VECTORS_H */
+#endif /* __ARCH_ARM_SRC_ARM_M_RAM_VECTORS_H */
diff --git a/arch/arm/src/armv6-m/CMakeLists.txt 
b/arch/arm/src/armv6-m/CMakeLists.txt
index ddc48c016e7..2cdb50aa094 100644
--- a/arch/arm/src/armv6-m/CMakeLists.txt
+++ b/arch/arm/src/armv6-m/CMakeLists.txt
@@ -34,8 +34,4 @@ if((DEFINED CONFIG_DEBUG_FEATURES AND CONFIG_DEBUG_FEATURES)
   list(APPEND SRCS arm_dumpnvic.c)
 endif()
 
-if(CONFIG_ARCH_RAMVECTORS)
-  list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c)
-endif()
-
 target_sources(arch PRIVATE ${SRCS})
diff --git a/arch/arm/src/armv6-m/Make.defs b/arch/arm/src/armv6-m/Make.defs
index 5a06a1d76a0..59618230a63 100644
--- a/arch/arm/src/armv6-m/Make.defs
+++ b/arch/arm/src/armv6-m/Make.defs
@@ -32,8 +32,4 @@ ifneq ($(filter 
y,$(CONFIG_DEBUG_FEATURES)$(CONFIG_ARM_COREDUMP_REGION)),)
   CMN_CSRCS += arm_dumpnvic.c
 endif
 
-ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
-  CMN_CSRCS += arm_ramvec_initialize.c arm_ramvec_attach.c
-endif
-
 VPATH += arm_m
diff --git a/arch/arm/src/armv6-m/nvic.h b/arch/arm/src/armv6-m/nvic.h
index 9faeeae1528..55434d8d21d 100644
--- a/arch/arm/src/armv6-m/nvic.h
+++ b/arch/arm/src/armv6-m/nvic.h
@@ -374,6 +374,8 @@
 #define SYSTICK_CALIB_SKEW             (1 << 30) /* Bit 30: TENMS value is 
exact */
 #define SYSTICK_CALIB_NOREF            (1 << 31) /* Bit 31: Device provides a 
reference clock */
 
+#define NVIC_VECTAB                    ARMV6M_SYSCON_VECTAB
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
diff --git a/arch/arm/src/armv6-m/ram_vectors.h 
b/arch/arm/src/armv6-m/ram_vectors.h
deleted file mode 100644
index 7546815e62d..00000000000
--- a/arch/arm/src/armv6-m/ram_vectors.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv6-m/ram_vectors.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV6_M_RAM_VECTORS_H
-#define __ARCH_ARM_SRC_ARMV6_M_RAM_VECTORS_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <arch/irq.h>
-
-#include "arm_internal.h"
-#include "chip.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Vector Table Offset Register (VECTAB).  This mask seems to vary among
- * ARMv6-M implementations.  It may need to be redefined in some
- * architecture-specific header file. By default, the base address of the
- * new vector table must be aligned to the size of the vector table extended
- * to the next larger power of 2.
- */
-
-#ifndef NVIC_VECTAB_TBLOFF_MASK
-#  define NVIC_VECTAB_TBLOFF_MASK     (0xffffff00)
-#endif
-
-/* Alignment ****************************************************************/
-
-#define VECTAB_ALIGN ((~NVIC_VECTAB_TBLOFF_MASK & 0xffff) + 1)
-
-#ifdef CONFIG_ARCH_RAMVECTORS
-
-/* This is the size of the vector table (in 4-byte entries).  This size
- * includes the (1) the peripheral interrupts, (2) space for 15 Cortex-M
- * exceptions, and (3) IDLE stack pointer which lies at the beginning of the
- * table.
- */
-
-#define ARMV6M_VECTAB_SIZE (32 + 16)
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/* If CONFIG_ARCH_RAMVECTORS is defined, then the ARM logic must provide
- * ARM-specific implementations of irq_initialize(), irq_attach(), and
- * irq_dispatch.  In this case, it is also assumed that the ARM vector
- * table resides in RAM, has the name g_ram_vectors, and has been
- * properly positioned and aligned in memory by the linker script.
- */
-
-extern up_vector_t g_ram_vectors[ARMV6M_VECTAB_SIZE]
-  locate_data(".ram_vectors") aligned_data(VECTAB_ALIGN);
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Name: arm_ramvec_initialize
- *
- * Description:
- *   Copy vectors to RAM an configure the NVIC to use the RAM vectors.
- *
- ****************************************************************************/
-
-void arm_ramvec_initialize(void);
-
-/****************************************************************************
- * Name: exception_common
- *
- * Description:
- *   This is the default, common vector handling entrypoint.
- *
- ****************************************************************************/
-
-void exception_common(void);
-
-/****************************************************************************
- * Name: arm_ramvec_attach
- *
- * Description:
- *   Configure the ram vector table so that IRQ number 'irq' will be
- *   dipatched by hardware to 'vector'
- *
- ****************************************************************************/
-
-int arm_ramvec_attach(int irq, up_vector_t vector);
-
-#endif /* CONFIG_ARCH_RAMVECTORS */
-#endif /* __ARCH_ARM_SRC_ARMV6_M_RAM_VECTORS_H */
diff --git a/arch/arm/src/armv7-m/CMakeLists.txt 
b/arch/arm/src/armv7-m/CMakeLists.txt
index 100efbbff98..5b849c38673 100644
--- a/arch/arm/src/armv7-m/CMakeLists.txt
+++ b/arch/arm/src/armv7-m/CMakeLists.txt
@@ -54,10 +54,6 @@ if(CONFIG_ARCH_FPU)
   list(APPEND SRCS arm_fpuconfig.c arm_fpucmp.c)
 endif()
 
-if(CONFIG_ARCH_RAMVECTORS)
-  list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c)
-endif()
-
 if(CONFIG_ARM_MPU OR CONFIG_ARM_MPU_EARLY_RESET)
   list(APPEND SRCS arm_mpu.c)
 endif()
diff --git a/arch/arm/src/armv7-m/Make.defs b/arch/arm/src/armv7-m/Make.defs
index 5e6f55047a9..727c61020be 100644
--- a/arch/arm/src/armv7-m/Make.defs
+++ b/arch/arm/src/armv7-m/Make.defs
@@ -48,10 +48,6 @@ ifeq ($(CONFIG_ARCH_FPU),y)
   CMN_CSRCS += arm_fpucmp.c
 endif
 
-ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
-  CMN_CSRCS += arm_ramvec_initialize.c arm_ramvec_attach.c
-endif
-
 ifneq ($(filter y,$(CONFIG_ARM_MPU) $(CONFIG_ARM_MPU_EARLY_RESET)),)
   CMN_CSRCS += arm_mpu.c
 endif
diff --git a/arch/arm/src/armv7-m/arm_ramvec_attach.c 
b/arch/arm/src/armv7-m/arm_ramvec_attach.c
deleted file mode 100644
index 595664ac215..00000000000
--- a/arch/arm/src/armv7-m/arm_ramvec_attach.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv7-m/arm_ramvec_attach.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-
-#include <nuttx/debug.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-#include <nuttx/spinlock.h>
-
-#include "ram_vectors.h"
-
-#ifdef CONFIG_ARCH_RAMVECTORS
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static spinlock_t g_ramvec_lock = SP_UNLOCKED;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/* Common exception entrypoint */
-
-void exception_common(void);
-
-/****************************************************************************
- * Name: arm_ramvec_attach
- *
- * Description:
- *   Configure the ram vector table so that IRQ number 'irq' will be
- *   dispatched by hardware to 'vector'
- *
- ****************************************************************************/
-
-int arm_ramvec_attach(int irq, up_vector_t vector)
-{
-  int ret = -EINVAL;
-
-  irqinfo("%s IRQ%d\n", vector ? "Attaching" : "Detaching", irq);
-
-  if ((unsigned)irq < ARMV7M_VECTAB_SIZE)
-    {
-      irqstate_t flags;
-
-      /* If the new vector is NULL, then the vector is being detached. In
-       * this case, disable the interrupt and direct any interrupts to the
-       * common exception handler.
-       */
-
-      flags = spin_lock_irqsave(&g_ramvec_lock);
-      if (vector == NULL)
-        {
-          /* Disable the interrupt if we can before detaching it.  We might
-           * not be able to do this for all interrupts.
-           */
-
-          up_disable_irq(irq);
-
-          /* Detaching the vector really means re-attaching it to the
-           * common exception handler.
-           */
-
-           vector = exception_common;
-        }
-
-      /* Save the new vector in the vector table */
-
-      g_ram_vectors[irq] = vector;
-      spin_unlock_irqrestore(&g_ramvec_lock, flags);
-      ret = OK;
-    }
-
-  return ret;
-}
-
-#endif /* !CONFIG_ARCH_RAMVECTORS */
diff --git a/arch/arm/src/armv7-m/ram_vectors.h 
b/arch/arm/src/armv7-m/ram_vectors.h
deleted file mode 100644
index 4f2d8edeb6d..00000000000
--- a/arch/arm/src/armv7-m/ram_vectors.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv7-m/ram_vectors.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV7_M_RAM_VECTORS_H
-#define __ARCH_ARM_SRC_ARMV7_M_RAM_VECTORS_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <arch/irq.h>
-
-#include "arm_internal.h"
-#include "chip.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef ARMV7M_PERIPHERAL_INTERRUPTS
-#  error ARMV7M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O 
interrupts to be supported
-#endif
-
-/* This is the size of the vector table (in 4-byte entries).  This size
- * includes the (1) the peripheral interrupts, (2) space for 15 Cortex-M
- * exceptions, and (3) IDLE stack pointer which lies at the beginning of the
- * table.
- */
-
-#define ARMV7M_VECTAB_SIZE (ARMV7M_PERIPHERAL_INTERRUPTS + 16)
-
-/* Vector Table Offset Register (VECTAB).  This mask seems to vary among
- * ARMv7-M implementations.  It may need to be redefined in some
- * architecture-specific header file. By default, the base address of the
- * new vector table must be aligned to the size of the vector table extended
- * to the next larger power of 2.
- */
-
-#ifndef NVIC_VECTAB_TBLOFF_MASK
-#  if ARMV7M_VECTAB_SIZE > 512
-#    define NVIC_VECTAB_TBLOFF_MASK     (0xfffff000)
-#  elif ARMV7M_VECTAB_SIZE > 256
-#    define NVIC_VECTAB_TBLOFF_MASK     (0xfffff800)
-#  elif ARMV7M_VECTAB_SIZE > 128
-#    define NVIC_VECTAB_TBLOFF_MASK     (0xfffffc00)
-#  elif ARMV7M_VECTAB_SIZE > 64
-#    define NVIC_VECTAB_TBLOFF_MASK     (0xfffffe00)
-#  elif ARMV7M_VECTAB_SIZE > 32
-#    define NVIC_VECTAB_TBLOFF_MASK     (0xffffff00)
-#  else
-#    define NVIC_VECTAB_TBLOFF_MASK     (0xffffff80)
-#  endif
-#endif
-
-/* Alignment ****************************************************************/
-
-/* Per the ARMv7M Architecture reference manual, the NVIC vector table
- * requires 7-bit address alignment (i.e, bits 0-6 of the address of the
- * vector table must be zero).  In this case alignment to a 128 byte address
- * boundary is sufficient.
- *
- * Some parts, such as the LPC17xx/LPC40xx family, require alignment to a 256
- * byte address boundary.  Any other unusual alignment requirements for the
- * vector can be specified for a given architecture be redefining
- * NVIC_VECTAB_TBLOFF_MASK in the chip-specific chip.h header file for the
- * appropriate mask.
- */
-
-#define VECTAB_ALIGN ((~NVIC_VECTAB_TBLOFF_MASK & 0xffff) + 1)
-
-#ifdef CONFIG_ARCH_RAMVECTORS
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/* If CONFIG_ARCH_RAMVECTORS is defined, then the ARM logic must provide
- * ARM-specific implementations of irq_initialize(), irq_attach(), and
- * irq_dispatch.  In this case, it is also assumed that the ARM vector
- * table resides in RAM, has the name g_ram_vectors, and has been
- * properly positioned and aligned in memory by the linker script.
- *
- * REVISIT: Can this alignment requirement vary from core-to-core?  Yes, it
- * depends on the number of vectors supported by the MCU. The safest thing
- * to do is to put the vector table at the beginning of RAM in order to force
- * the highest alignment possible.
- */
-
-extern up_vector_t g_ram_vectors[ARMV7M_VECTAB_SIZE]
-  locate_data(".ram_vectors") aligned_data(VECTAB_ALIGN);
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Name: arm_ramvec_initialize
- *
- * Description:
- *   Copy vectors to RAM an configure the NVIC to use the RAM vectors.
- *
- ****************************************************************************/
-
-void arm_ramvec_initialize(void);
-
-/****************************************************************************
- * Name: exception_common
- *
- * Description:
- *   This is the default, common vector handling entrypoint.
- *
- ****************************************************************************/
-
-void exception_common(void);
-
-/****************************************************************************
- * Name: arm_ramvec_attach
- *
- * Description:
- *   Configure the ram vector table so that IRQ number 'irq' will be
- *   dipatched by hardware to 'vector'
- *
- ****************************************************************************/
-
-int arm_ramvec_attach(int irq, up_vector_t vector);
-
-#endif /* CONFIG_ARCH_RAMVECTORS */
-#endif /* __ARCH_ARM_SRC_ARMV7_M_RAM_VECTORS_H */
diff --git a/arch/arm/src/armv8-m/CMakeLists.txt 
b/arch/arm/src/armv8-m/CMakeLists.txt
index e2ce8661311..6f11296fdbe 100644
--- a/arch/arm/src/armv8-m/CMakeLists.txt
+++ b/arch/arm/src/armv8-m/CMakeLists.txt
@@ -59,10 +59,6 @@ if(CONFIG_ARM_PACBTI)
   list(APPEND SRCS arm_pacbticonfig.c)
 endif()
 
-if(CONFIG_ARCH_RAMVECTORS)
-  list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c)
-endif()
-
 if(CONFIG_ARM_MPU OR CONFIG_ARM_MPU_EARLY_RESET)
   list(APPEND SRCS arm_mpu.c)
 endif()
diff --git a/arch/arm/src/armv8-m/Make.defs b/arch/arm/src/armv8-m/Make.defs
index a6967f0c839..c4cea5a65f5 100644
--- a/arch/arm/src/armv8-m/Make.defs
+++ b/arch/arm/src/armv8-m/Make.defs
@@ -54,10 +54,6 @@ ifeq ($(CONFIG_ARM_PACBTI),y)
   CMN_CSRCS += arm_pacbticonfig.c
 endif
 
-ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
-  CMN_CSRCS += arm_ramvec_initialize.c arm_ramvec_attach.c
-endif
-
 ifneq ($(filter y,$(CONFIG_ARM_MPU) $(CONFIG_ARM_MPU_EARLY_RESET)),)
   CMN_CSRCS += arm_mpu.c
 endif
diff --git a/arch/arm/src/armv8-m/arm_ramvec_initialize.c 
b/arch/arm/src/armv8-m/arm_ramvec_initialize.c
deleted file mode 100644
index de0871e87be..00000000000
--- a/arch/arm/src/armv8-m/arm_ramvec_initialize.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv8-m/arm_ramvec_initialize.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/irq.h>
-
-#include "nvic.h"
-#include "ram_vectors.h"
-
-#include "chip.h"             /* May redefine VECTAB fields */
-#include "arm_internal.h"
-
-#ifdef CONFIG_ARCH_RAMVECTORS
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/* If CONFIG_ARCH_RAMVECTORS is defined, then the ARM logic must provide
- * ARM-specific implementations of arm_ramvec_initialize(), irq_attach(), and
- * irq_dispatch.  In this case, it is also assumed that the ARM vector
- * table resides in RAM, has the name g_ram_vectors, and has been
- * properly positioned and aligned in memory by the linker script.
- *
- * REVISIT: Can this alignment requirement vary from core-to-core?  Yes, it
- * depends on the number of vectors supported by the MCU. The safest thing
- * to do is to put the vector table at the beginning of RAM in order to force
- * the highest alignment possible.
- */
-
-up_vector_t g_ram_vectors[ARMV8M_VECTAB_SIZE]
-  locate_data(".ram_vectors") aligned_data(VECTAB_ALIGN);
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: arm_ramvec_initialize
- *
- * Description:
- *   Copy vectors to RAM an configure the NVIC to use the RAM vectors.
- *
- ****************************************************************************/
-
-void arm_ramvec_initialize(void)
-{
-  const up_vector_t *src;
-  up_vector_t *dest;
-  int i;
-
-  /* The vector table must be aligned */
-
-  DEBUGASSERT(((uint32_t)g_ram_vectors & ~NVIC_VECTAB_TBLOFF_MASK) == 0);
-
-  /* Copy the ROM vector table at address zero to RAM vector table.
-   *
-   * This must be done BEFORE the MPU is enable if the MPU is being used to
-   * protect against NULL pointer references.
-   */
-
-  src  = (const up_vector_t *)getreg32(NVIC_VECTAB);
-  dest = g_ram_vectors;
-
-  irqinfo("src=%p dest=%p\n", src, dest);
-
-  for (i = 0; i < ARMV8M_VECTAB_SIZE; i++)
-    {
-      *dest++ = *src++;
-    }
-
-  /* Now configure the NVIC to use the new vector table. */
-
-  putreg32((uint32_t)g_ram_vectors, NVIC_VECTAB);
-
-  /* The number bits required to align the RAM vector table seem to vary
-   * from part-to-part.  The following assertion will catch the case where
-   * the table alignment is insufficient.
-   */
-
-  irqinfo("NVIC_VECTAB=%08" PRIx32 "\n", getreg32(NVIC_VECTAB));
-  DEBUGASSERT(getreg32(NVIC_VECTAB) == (uint32_t)g_ram_vectors);
-}
-
-#endif /* !CONFIG_ARCH_RAMVECTORS */

Reply via email to