This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8e5d326ec2f462dc37a9b1142bcc2f6501812f44 Author: hujun5 <[email protected]> AuthorDate: Tue Nov 24 21:28:23 2026 +0800 arm_m: merge arm_exception.S & arm_vector.c Before arm_doirq, use r1 as saved reg base. After arm_doirq, use r0 as restore reg base. The reg usage are unified between armv6/7/8-m Signed-off-by: buxiasen <[email protected]> Signed-off-by: hujun5 <[email protected]> --- arch/arm/src/arm_m/CMakeLists.txt | 6 +- arch/arm/src/arm_m/Make.defs | 6 +- arch/arm/src/{armv8-m => arm_m}/arm_exception.S | 131 +++++++++--- arch/arm/src/{armv6-m => arm_m}/arm_vectors.c | 18 +- arch/arm/src/{armv7-m => arm_m}/ghs_compat.S | 2 +- arch/arm/src/armv6-m/CMakeLists.txt | 5 - arch/arm/src/armv6-m/Make.defs | 6 - arch/arm/src/armv6-m/arm_exception.S | 247 ---------------------- arch/arm/src/armv7-m/CMakeLists.txt | 5 - arch/arm/src/armv7-m/Make.defs | 6 - arch/arm/src/armv7-m/arm_exception.S | 267 ------------------------ arch/arm/src/armv7-m/arm_vectors.c | 115 ---------- arch/arm/src/armv8-m/CMakeLists.txt | 5 - arch/arm/src/armv8-m/Make.defs | 6 - arch/arm/src/armv8-m/arm_vectors.c | 127 ----------- 15 files changed, 125 insertions(+), 827 deletions(-) diff --git a/arch/arm/src/arm_m/CMakeLists.txt b/arch/arm/src/arm_m/CMakeLists.txt index 069421481b2..f671238a856 100644 --- a/arch/arm/src/arm_m/CMakeLists.txt +++ b/arch/arm/src/arm_m/CMakeLists.txt @@ -18,7 +18,7 @@ # # ############################################################################## -list(APPEND SRCS arm_saveusercontext.S arm_tcbinfo.c) +list(APPEND SRCS arm_exception.S arm_saveusercontext.S arm_tcbinfo.c) if(CONFIG_ENABLE_ALL_SIGNALS) list(APPEND SRCS arm_sigdeliver.c arm_schedulesigaction.c) @@ -28,4 +28,8 @@ if(CONFIG_LIB_SYSCALL) list(APPEND SRCS arm_dispatch_syscall.S) endif() +if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) + list(APPEND SRCS arm_vectors.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 49d5d78384f..b3869c90ace 100644 --- a/arch/arm/src/arm_m/Make.defs +++ b/arch/arm/src/arm_m/Make.defs @@ -20,7 +20,7 @@ # Common ARM_M files -CMN_ASRCS += arm_saveusercontext.S +CMN_ASRCS += arm_exception.S arm_saveusercontext.S ifeq ($(CONFIG_LIB_SYSCALL),y) CMN_ASRCS += arm_dispatch_syscall.S @@ -31,3 +31,7 @@ CMN_CSRCS += arm_tcbinfo.c ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c endif + +ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) + CMN_CSRCS += arm_vectors.c +endif diff --git a/arch/arm/src/armv8-m/arm_exception.S b/arch/arm/src/arm_m/arm_exception.S similarity index 73% rename from arch/arm/src/armv8-m/arm_exception.S rename to arch/arm/src/arm_m/arm_exception.S index 00dee5079ba..417413af936 100644 --- a/arch/arm/src/armv8-m/arm_exception.S +++ b/arch/arm/src/arm_m/arm_exception.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv8-m/arm_exception.S + * arch/arm/src/arm_m/arm_exception.S * * SPDX-License-Identifier: BSD-3-Clause * SPDX-FileCopyrightText: 2009-2013, 2015-2016, 2018 Gregory Nutt. @@ -46,6 +46,7 @@ #include "chip.h" #include "exc_return.h" +#include "ghs_compat.S" #include "psr.h" /**************************************************************************** @@ -80,9 +81,12 @@ ****************************************************************************/ .globl exception_common - +#ifdef __ghs__ + .thumb2 +#else .syntax unified .thumb +#endif .file "arm_exception.S" /**************************************************************************** @@ -111,43 +115,59 @@ */ .text + .align 2 + .section .text.exception_common, "ax" +#ifdef __ghs__ + .type exception_common, $function +#else .thumb_func + .syntax unified .type exception_common, function +#endif exception_common: .cfi_sections .debug_frame .cfi_startproc mrs r12, control /* R12=control */ +#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE + mov r3, #0x0 +#endif /* Complete the context save */ /* The EXC_RETURN value tells us whether the context is on the MSP or PSP */ - tst r14, #EXC_RETURN_PROCESS_STACK /* Nonzero if context on process stack */ - beq 1f /* Branch if context already on the MSP */ + mov r0, r14 /* Copy EXC_RETURN */ + lsls r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ + bpl 1f /* Test bit 31 */ mrs r1, psp /* R1=The process stack pointer (PSP) */ +#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE + mrs r0, psplim + msr psplim, r3 +#endif b 2f 1: mrs r1, msp /* R1=The main stack pointer (MSP) */ - sub r2, r1, #SW_XCPT_SIZE /* Reserve the stack space */ - msr msp, r2 + mov r0, r1 /* Keep r1 not changed for push */ + subs r0, #SW_XCPT_SIZE /* Reserve MSP for SW_XCPT_SIZE */ + msr msp, r0 /* Reserved stack space */ +#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE + mrs r0, msplim + msr msplim, r3 +#endif isb sy 2: mov r2, r1 /* R2=Copy of the main/process stack pointer */ - add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ + adds r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ /* (ignoring the xPSR[9] alignment bit) */ #ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE - mov r3, #0x0 - - ittee eq - mrseq r0, msplim - msreq msplim, r3 - mrsne r0, psplim - msrne psplim, r3 - stmdb r1!, {r0, r3} #endif +#ifdef CONFIG_ARCH_ARMV6M + mrs r3, primask /* R3=Current PRIMASK setting */ +#else mrs r3, basepri /* R3=Current BASEPRI setting */ +#endif /* CONFIG_ARCH_ARMV6M */ #ifdef CONFIG_ARCH_FPU @@ -179,7 +199,23 @@ exception_common: #endif #endif +#ifdef CONFIG_ARCH_ARMV6M + subs r1, #(4*SW_INT_REGS) /* Move cursor to base, for save low regs first */ + mov r0, r1 /* Copy the context array pointer */ + stmia r0!, {r2-r7} /* Save the SP, PRIMASK, and R4-R7 in the context array */ + + /* Save R8-R11 control and the EXEC_RETURN value in the context array */ + + mov r2, r8 /* Copy high registers to low */ + mov r3, r9 + mov r4, r10 + mov r5, r11 + mrs r6, control /* R6=control */ + mov r7, r14 + stmia r0!, {r2-r7} /* Save the high registers r8-r11 control and r14 */ +#else stmdb r1!, {r2-r12,r14} /* Save the remaining registers plus the SP/PRIMASK values */ +#endif /* CONFIG_ARCH_ARMV6M */ /* There are two arguments to arm_doirq: * @@ -187,7 +223,7 @@ exception_common: * R1 = The top of the stack points to the saved state */ - mrs r0, ipsr + mrs r0, ipsr /* R0=exception number */ #if CONFIG_ARCH_INTERRUPTSTACK < 7 /* If CONFIG_ARCH_INTERRUPTSTACK is not defined, we will reuse the @@ -200,15 +236,20 @@ exception_common: * signal context (reference: arm_schedulesigaction.c): * ---------------------- * | IRQ XCP context | - * ------------------- + * ---------------------- * | Signal XCP context | * ---------------------- <- SP * also the sp should be restore after arm_doirq() */ - tst r14, #EXC_RETURN_THREAD_MODE /* Nonzero if context on thread mode */ - beq 3f /* Branch if context already on the handle mode */ + + mov r2, r14 + lsls r2, #(31 - EXC_RETURN_THREAD_BITNO) /* Move to bit 31 */ + bpl 3f /* Test bit 31 */ #ifdef CONFIG_ENABLE_ALL_SIGNALS - sub r2, r1, #XCPTCONTEXT_SIZE /* Reserve signal context */ + mov r2, r1 + subs r2, #XCPTCONTEXT_SIZE /* Reserve signal context */ + movs r4, #7 + bics r2, r4 /* Get the stack pointer with 8-byte alignment */ mov sp, r2 /* Instantiate the aligned stack */ #endif 3: @@ -224,7 +265,29 @@ exception_common: * array to use for the interrupt return. */ +#ifdef CONFIG_ARCH_ARMV6M + /* Recover R8-R11 and EXEC_RETURN (5 registers) */ + + movs r2, #(4*REG_R8) /* R2=Offset to R8 storage */ + adds r1, r0, r2 /* R1=Address of R8 storage */ + ldmia r1!, {r2-r7} /* Recover R8-R11 control and R14 (6 registers)*/ + mov r8, r2 /* Move to position in high registers */ + mov r9, r3 + mov r10, r4 + mov r11, r5 + msr control, r6 + mov r14, r7 /* EXEC_RETURN */ + + /* Recover SP (R2), PRIMASK (R3), and R4-R7. Determine the value of + * the stack pointer as it was on entry to the exception handler. + */ + + movs r1, #(4*REG_R8) /* Already restored offset */ + ldmia r0!, {r2-r7} /* Recover R4-R7 + 2 temp values */ + adds r0, r0, r1 /* Fix already restored R8-R11 and R14 popped address */ +#else ldmia r0!, {r2-r12,r14} /* Recover R4-R12, r14 + 2 temp values */ +#endif /* CONFIG_ARCH_ARMV6M */ #ifdef CONFIG_ARCH_FPU /* Switched-in task including volatile FP registers ? */ @@ -242,22 +305,30 @@ exception_common: /* The EXC_RETURN value tells us whether we are returning on the MSP or PSP */ - tst r14, #EXC_RETURN_PROCESS_STACK /* Nonzero if context on process stack */ + mov r2, r14 /* Copy EXC_RETURN */ + lsls r2, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ + bmi 4f /* Test bit 31 */ + msr msp, r0 /* R1=The main stack pointer */ #ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE - itete eq - msreq msplim, r1 - msrne psplim, r1 -#else - ite eq /* Next two instructions conditional */ + msr msplim, r1 +#endif + b 5f +4: + msr psp, r0 /* R1=The process stack pointer */ +#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE + msr psplim, r1 #endif - msreq msp, r0 /* R0=The main stack pointer */ - msrne psp, r0 /* R0=The process stack pointer */ +5: + isb sy /* Restore the interrupt state */ +#ifdef CONFIG_ARCH_ARMV6M + msr primask, r3 /* Restore interrupts priority masking*/ +#else msr basepri, r3 /* Restore interrupts priority masking */ - - msr control, r12 + msr control, r12 /* Restore control */ +#endif /* CONFIG_ARCH_ARMV6M */ /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) select the correct stack. diff --git a/arch/arm/src/armv6-m/arm_vectors.c b/arch/arm/src/arm_m/arm_vectors.c similarity index 87% rename from arch/arm/src/armv6-m/arm_vectors.c rename to arch/arm/src/arm_m/arm_vectors.c index fb886959d6a..0ab91fd62ec 100644 --- a/arch/arm/src/armv6-m/arm_vectors.c +++ b/arch/arm/src/arm_m/arm_vectors.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv6-m/arm_vectors.c + * arch/arm/src/arm_m/arm_vectors.c * * SPDX-License-Identifier: BSD-3-Clause * SPDX-FileCopyrightText: 2013 Gregory Nutt. All rights reserved. @@ -50,6 +50,14 @@ * Pre-processor Definitions ****************************************************************************/ +#ifdef CONFIG_ARCH_ARMV6M +# define ARM_PERIPHERAL_INTERRUPTS ARMV6M_PERIPHERAL_INTERRUPTS +#elif defined(CONFIG_ARCH_ARMV7M) +# define ARM_PERIPHERAL_INTERRUPTS ARMV7M_PERIPHERAL_INTERRUPTS +#elif defined(CONFIG_ARCH_ARMV8M) +# define ARM_PERIPHERAL_INTERRUPTS ARMV8M_PERIPHERAL_INTERRUPTS +#endif + /* The base of the IDLE stack. Boards may override this to place the * IDLE stack at a specific address; defaults to the end of .bss. */ @@ -60,8 +68,8 @@ #define IDLE_STACK (IDLE_STACK_BASE + CONFIG_IDLETHREAD_STACKSIZE) -#ifndef ARMV6M_PERIPHERAL_INTERRUPTS -# error ARMV6M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O interrupts to be supported +#ifndef ARM_PERIPHERAL_INTERRUPTS +# error ARM_PERIPHERAL_INTERRUPTS must be defined to the number of I/O interrupts to be supported #endif /**************************************************************************** @@ -95,7 +103,7 @@ extern void exception_direct(void); * Public data ****************************************************************************/ -/* The v6m vector table consists of an array of function pointers, with the +/* The arm_m vector table consists of an array of function pointers, with the * first slot (vector zero) used to hold the initial stack pointer. * * As all exceptions (interrupts) are routed via exception_common, we just @@ -118,6 +126,6 @@ const void * const _vectors[] locate_data(".vectors") /* Vectors 2 - n point directly at the generic handler */ [2 ... NVIC_IRQ_PENDSV] = &exception_common, - [(NVIC_IRQ_PENDSV + 1) ... (15 + ARMV6M_PERIPHERAL_INTERRUPTS)] + [(NVIC_IRQ_PENDSV + 1) ... (15 + ARM_PERIPHERAL_INTERRUPTS)] = &exception_direct }; diff --git a/arch/arm/src/armv7-m/ghs_compat.S b/arch/arm/src/arm_m/ghs_compat.S similarity index 97% rename from arch/arm/src/armv7-m/ghs_compat.S rename to arch/arm/src/arm_m/ghs_compat.S index 74688879499..9fe3a2e141a 100644 --- a/arch/arm/src/armv7-m/ghs_compat.S +++ b/arch/arm/src/arm_m/ghs_compat.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7-m/ghs_compat.S + * arch/arm/src/arm_m/ghs_compat.S * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/arch/arm/src/armv6-m/CMakeLists.txt b/arch/arm/src/armv6-m/CMakeLists.txt index f36c8a978e6..ddc48c016e7 100644 --- a/arch/arm/src/armv6-m/CMakeLists.txt +++ b/arch/arm/src/armv6-m/CMakeLists.txt @@ -21,7 +21,6 @@ # ############################################################################## set(SRCS - arm_exception.S arm_cpuinfo.c arm_doirq.c arm_hardfault.c @@ -30,10 +29,6 @@ set(SRCS arm_systemreset.c arm_trigger_irq.c) -if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) - list(APPEND SRCS arm_vectors.c) -endif() - if((DEFINED CONFIG_DEBUG_FEATURES AND CONFIG_DEBUG_FEATURES) OR (DEFINED CONFIG_ARM_COREDUMP_REGION AND CONFIG_ARM_COREDUMP_REGION)) list(APPEND SRCS arm_dumpnvic.c) diff --git a/arch/arm/src/armv6-m/Make.defs b/arch/arm/src/armv6-m/Make.defs index a418e65d13b..5a06a1d76a0 100644 --- a/arch/arm/src/armv6-m/Make.defs +++ b/arch/arm/src/armv6-m/Make.defs @@ -25,15 +25,9 @@ include common/Make.defs include arm_m/Make.defs -CMN_ASRCS += arm_exception.S - CMN_CSRCS += arm_cpuinfo.c arm_doirq.c arm_hardfault.c arm_initialstate.c CMN_CSRCS += arm_svcall.c arm_systemreset.c arm_trigger_irq.c -ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) - CMN_CSRCS += arm_vectors.c -endif - ifneq ($(filter y,$(CONFIG_DEBUG_FEATURES)$(CONFIG_ARM_COREDUMP_REGION)),) CMN_CSRCS += arm_dumpnvic.c endif diff --git a/arch/arm/src/armv6-m/arm_exception.S b/arch/arm/src/armv6-m/arm_exception.S deleted file mode 100644 index 6577467d187..00000000000 --- a/arch/arm/src/armv6-m/arm_exception.S +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv6-m/arm_exception.S - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2013 Gregory Nutt. All rights reserved. - * SPDX-FileCopyrightText: 2012 Michael Smith. All rights reserved. - * SPDX-FileContributor: Gregory Nutt <[email protected]> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <arch/irq.h> - -#ifdef CONFIG_SMP -# include "chip.h" -#endif - -#include "exc_return.h" - -/**************************************************************************** - * Public Symbols - ****************************************************************************/ - - .globl exception_common - .file "arm_exception.S" - -/**************************************************************************** - * .text - ****************************************************************************/ - -/* Common exception handling logic. On entry here, the return stack is on either - * the PSP or the MSP and looks like the following: - * - * REG_XPSR - * REG_R15 - * REG_R14 - * REG_R12 - * REG_R3 - * REG_R2 - * REG_R1 - * MSP->REG_R0 - * - * And - * IPSR contains the IRQ number - * R14 Contains the EXC_RETURN value - * We are in handler mode and the current SP is the MSP - */ - - .text - .align 2 - .code 16 - .thumb_func - .syntax unified - .type exception_common, function -exception_common: - .cfi_sections .debug_frame - .cfi_startproc - /* Complete the context save */ - - /* Get the current stack pointer. The EXC_RETURN value tells us whether - * the context is on the MSP or PSP. - */ - - mov r0, r14 /* Copy high register to low register */ - lsls r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ - bmi 1f /* Test bit 31 */ - mrs r1, msp /* R1=The main stack pointer */ - subs r1, #SW_XCPT_SIZE /* R1=Beginning of context array on the stack */ - msr msp, r1 /* Reserved stack space */ - isb sy - b 2f - -1: - mrs r1, psp /* R1=The process stack pointer */ - subs r1, #SW_XCPT_SIZE /* R1=Beginning of context array on the stack */ - - /* R1 is the current stack pointer. HW_XCPT_REGS were pushed onto the stack - * when the interrupt was taken so (R1)+HW_XCPT_SIZE is the value of the - * stack pointer before the interrupt. The total size of the context save - * area is XCPTCONTEXT_SIZE = SW_XCPT_SIZE + HW_XCPT_SIZE so (R1)-SW_XCPT_SIZE - * is the address of the beginning of the context save area. - */ - -2: - /* Save SP, PRIMASK, and R4-R7 in the context array */ - - movs r2, #XCPTCONTEXT_SIZE /* R2=Size of the context array */ - add r2, r1 /* R2=MSP/PSP before the interrupt was taken */ - /* (ignoring the xPSR[9] alignment bit) */ - mrs r3, primask /* R3=Current PRIMASK setting */ - mov r0, r1 /* Copy the context array pointer */ - stmia r0!, {r2-r7} /* Save the SP, PRIMASK, and R4-R7 in the context array */ - - /* Save R8-R11 control and the EXEC_RETURN value in the context array */ - - mov r2, r8 /* Copy high registers to low */ - mov r3, r9 - mov r4, r10 - mov r5, r11 - mrs r6, control /* R6=control */ - mov r7, r14 - stmia r0!, {r2-r7} /* Save the high registers r8-r11 control and r14 */ - - /* Get the exception number in R0=IRQ, R1=register save area on stack */ - - mrs r0, ipsr /* R0=exception number */ - - /* If CONFIG_ARCH_INTERRUPTSTACK is defined, we will use a special interrupt - * stack pointer. The way that this is done here prohibits nested interrupts! - * Otherwise, we will use the stack that was current when the interrupt was taken. - */ - -#if CONFIG_ARCH_INTERRUPTSTACK < 3 - /* If the interrupt stack is disabled, reserve xcpcontext to ensure - * that signal processing can have a separate xcpcontext to handle - * signal context (reference: arm_schedulesigaction.c): - * ---------------------- - * | IRQ XCP context | - * ---------------------- - * | Signal XCP context | - * ---------------------- <- SP - * also the sp should be restore after arm_doirq() - */ - - mov r2, r14 - lsls r2, #(31 - EXC_RETURN_THREAD_BITNO) /* Move to bit 31 */ - bpl 3f /* Test bit 31 */ - mov r2, r1 /* Reserve signal context */ -#ifdef CONFIG_ENABLE_ALL_SIGNALS - subs r2, r2, #XCPTCONTEXT_SIZE -#endif - msr msp, r2 /* We are using the main stack pointer */ - isb sy -3: -#endif - mov fp, r1 - .cfi_def_cfa fp, 0 /* Register in fp, so we just set fp as frame */ - .cfi_offset pc, REG_PC * 4 - .cfi_offset sp, REG_SP * 4 - .cfi_offset lr, REG_LR * 4 - bl arm_doirq /* R0=IRQ, R1=register save area on stack */ - - /* On return from arm_doirq, R0 will hold a pointer to register context - * array to use for the interrupt return. - */ - - /* Recover R8-R11 and EXEC_RETURN (5 registers) */ - - movs r2, #(4*REG_R8) /* R2=Offset to R8 storage */ - adds r1, r0, r2 /* R1=Address of R8 storage */ - ldmia r1!, {r2-r7} /* Recover R8-R11 control and R14 (6 registers)*/ - mov r8, r2 /* Move to position in high registers */ - mov r9, r3 - mov r10, r4 - mov r11, r5 - msr control, r6 - mov r14, r7 /* EXEC_RETURN */ - - /* Recover SP (R2), PRIMASK (R3), and R4-R7. Determine the value of - * the stack pointer as it was on entry to the exception handler. - */ - - ldmia r0!, {r2-r7} /* Recover R4-R7 + 2 temp values */ - movs r1, #HW_XCPT_SIZE /* R1=Size of hardware-saved portion of the context array */ - subs r1, r2, r1 /* R1=Value of MSP/PSP on exception entry */ - - /* Restore the stack pointer. The EXC_RETURN value tells us whether the - * context is on the MSP or PSP. - */ - - mov r0, r14 /* Copy high register to low register */ - lsls r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ - bmi 4f /* Test bit 31 */ - msr msp, r1 /* R1=The main stack pointer */ - isb sy - b 5f - -4: - msr psp, r1 /* R1=The process stack pointer */ - isb sy - -5: - - /* Restore the interrupt state */ - - msr primask, r3 /* Restore interrupts priority masking*/ - - /* Always return with R14 containing the special value that will: (1) - * return to thread mode, and (2) select the correct stack. - */ - - bx r14 /* And return */ - .cfi_endproc - .size exception_common, .-exception_common - -/**************************************************************************** - * Name: g_intstackalloc/g_intstacktop - * - * Description: - * Shouldn't happen - * - ****************************************************************************/ - -#if CONFIG_ARCH_INTERRUPTSTACK > 3 - .bss - .global g_intstackalloc - .global g_intstacktop - .balign 4 -g_intstackalloc: - .skip (CONFIG_ARCH_INTERRUPTSTACK & ~3) -g_intstacktop: - .size g_intstackalloc, .-g_intstackalloc -#endif - - .end diff --git a/arch/arm/src/armv7-m/CMakeLists.txt b/arch/arm/src/armv7-m/CMakeLists.txt index d551869a646..100efbbff98 100644 --- a/arch/arm/src/armv7-m/CMakeLists.txt +++ b/arch/arm/src/armv7-m/CMakeLists.txt @@ -23,7 +23,6 @@ # TODO: do not use config to detect this set(SRCS - arm_exception.S arm_busfault.c arm_cache.c arm_cpuinfo.c @@ -39,10 +38,6 @@ set(SRCS arm_usagefault.c arm_dbgmonitor.c) -if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) - list(APPEND SRCS arm_vectors.c) -endif() - if(CONFIG_ARMV7M_SYSTICK) list(APPEND SRCS arm_systick.c) endif() diff --git a/arch/arm/src/armv7-m/Make.defs b/arch/arm/src/armv7-m/Make.defs index 3529c64e3bb..5e6f55047a9 100644 --- a/arch/arm/src/armv7-m/Make.defs +++ b/arch/arm/src/armv7-m/Make.defs @@ -25,18 +25,12 @@ include common/Make.defs include arm_m/Make.defs -CMN_ASRCS += arm_exception.S - CMN_CSRCS += arm_busfault.c arm_cache.c arm_cpuinfo.c arm_doirq.c CMN_CSRCS += arm_hardfault.c arm_initialstate.c arm_itm.c CMN_CSRCS += arm_memfault.c arm_perf.c CMN_CSRCS += arm_svcall.c arm_systemreset.c CMN_CSRCS += arm_trigger_irq.c arm_usagefault.c arm_dbgmonitor.c -ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) - CMN_CSRCS += arm_vectors.c -endif - ifeq ($(CONFIG_ARMV7M_SYSTICK),y) CMN_CSRCS += arm_systick.c endif diff --git a/arch/arm/src/armv7-m/arm_exception.S b/arch/arm/src/armv7-m/arm_exception.S deleted file mode 100644 index 5e3b63f5eaa..00000000000 --- a/arch/arm/src/armv7-m/arm_exception.S +++ /dev/null @@ -1,267 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv7-m/arm_exception.S - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2009-2013, 2015-2016, 2018 Gregory Nutt. - * SPDX-FileCopyrightText: 2012 Michael Smith. All rights reserved. - * SPDX-FileContributor: Gregory Nutt <[email protected]> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <arch/irq.h> -#include <arch/arm_m/nvicpri.h> - -#include "chip.h" -#include "exc_return.h" -#include "ghs_compat.S" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifdef CONFIG_ARCH_HIPRI_INTERRUPT - /* In protected mode without an interrupt stack, this interrupt handler will set the - * MSP to the stack pointer of the interrupted thread. If the interrupted thread - * was a privileged thread, that will be the MSP otherwise it will be the PSP. If - * the PSP is used, then the value of the MSP will be invalid when the interrupt - * handler returns because it will be a pointer to an old position in the - * unprivileged stack. Then when the high priority interrupt occurs and uses this - * stale MSP, there will most likely be a system failure. - * - * If the interrupt stack is selected, on the other hand, then the interrupt - * handler will always set the MSP to the interrupt stack. So when the high - * priority interrupt occurs, it will either use the MSP of the last privileged - * thread to run or, in the case of the nested interrupt, the interrupt stack if - * no privileged task has run. - */ - -# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 8 -# error Interrupt stack must be used with high priority interrupts in protected mode -# endif -#endif - -/**************************************************************************** - * Public Symbols - ****************************************************************************/ - - .globl exception_common -#ifdef __ghs__ - .thumb2 -#else - .syntax unified - .thumb -#endif - .file "arm_exception.S" - -/**************************************************************************** - * .text - ****************************************************************************/ - -/* Common exception handling logic. On entry here, the return stack is on either - * the PSP or the MSP and looks like the following: - * - * REG_XPSR - * REG_R15 - * REG_R14 - * REG_R12 - * REG_R3 - * REG_R2 - * REG_R1 - * MSP->REG_R0 - * - * And - * IPSR contains the IRQ number - * R14 Contains the EXC_RETURN value - * We are in handler mode and the current SP is the MSP - * - * If CONFIG_ARCH_FPU is defined, the volatile FP registers and FPSCR are on the - * return stack immediately above REG_XPSR. - */ - - .text - .section .text.exception_common, "ax" -#ifdef __ghs__ - .type exception_common, $function -#else - .thumb_func - .type exception_common, function -#endif -exception_common: - .cfi_sections .debug_frame - .cfi_startproc - mrs r0, ipsr /* R0=exception number */ - mrs r12, control /* R12=control */ - - /* Complete the context save */ - - /* The EXC_RETURN value tells us whether the context is on the MSP or PSP */ - - tst r14, #EXC_RETURN_PROCESS_STACK /* nonzero if context on process stack */ - beq 1f /* Branch if context already on the MSP */ - mrs r1, psp /* R1=The process stack pointer (PSP) */ - b 2f -1: - mrs r1, msp /* R1=The main stack pointer (MSP) */ - sub r2, r1, #SW_XCPT_SIZE /* Reserved stack space */ - msr msp, r2 - isb sy - -2: - mov r2, r1 /* R2=Copy of the main/process stack pointer */ - add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ - /* (ignoring the xPSR[9] alignment bit) */ - - mrs r3, basepri /* R3=Current BASEPRI setting */ - -#ifdef CONFIG_ARCH_FPU - - /* Save the non-volatile FP registers here. - * - * This routine is the only point where we can save these registers; either before - * or after calling arm_doirq. The compiler is free to use them at any time as long - * as they are restored before returning, so we can't assume that we can get at the - * true values of these registers in any routine called from here. - * - * REVISIT: we could do all this saving lazily on the context switch side if we knew - * where to put the registers. - */ - - /* Switched-out task including volatile FP registers ? */ - - tst r14, #EXC_RETURN_STD_CONTEXT - ite eq - vstmdbeq r1!, {s16-s31} /* Save the non-volatile FP context */ - subne r1, #(4*SW_FPU_REGS) -#endif - - stmdb r1!, {r2-r12,r14} /* Save the remaining registers plus the SP/PRIMASK values */ - - /* There are two arguments to arm_doirq: - * - * R0 = The IRQ number - * R1 = The top of the stack points to the saved state - */ - -#if CONFIG_ARCH_INTERRUPTSTACK < 7 - /* If CONFIG_ARCH_INTERRUPTSTACK is not defined, we will reuse the - * interrupted thread's stack. That may mean using either MSP or PSP - * stack for interrupt level processing (in kernel mode). - */ - - /* If the interrupt stack is disabled, reserve xcpcontext to ensure - * that signal processing can have a separate xcpcontext to handle - * signal context (reference: arm_schedulesigaction.c): - * ---------------------- - * | IRQ XCP context | - * ------------------- - * | Signal XCP context | - * ---------------------- <- SP - * also the sp should be restore after arm_doirq() - */ - - tst r14, #EXC_RETURN_THREAD_MODE /* Nonzero if context on thread mode */ - beq 3f /* Branch if context already on the handle mode */ - sub r2, r1, #XCPTCONTEXT_SIZE /* Reserve signal context */ - bic r2, r2, #7 /* Get the stack pointer with 8-byte alignment */ - mov sp, r2 /* Instantiate the aligned stack */ -3: -#endif - mov fp, r1 - .cfi_def_cfa r4, 0 /* Register in fp, so we just set fp as frame */ - .cfi_offset pc, REG_PC * 4 - .cfi_offset sp, REG_SP * 4 - .cfi_offset lr, REG_LR * 4 - bl arm_doirq /* R0=IRQ, R1=register save (msp) */ - - /* On return from arm_doirq, R0 will hold a pointer to register context - * array to use for the interrupt return. - */ - - ldmia r0!, {r2-r12,r14} /* Recover R4-R12, r14 + 2 temp values */ -#ifdef CONFIG_ARCH_FPU - /* Switched-in task including volatile FP registers ? */ - - tst r14, #EXC_RETURN_STD_CONTEXT - ite eq - vldmiaeq r0!, {s16-s31} /* Recover S16-S31 */ - addne r0, #(4*SW_FPU_REGS) -#endif - - /* The EXC_RETURN value tells us whether we are returning on the MSP or PSP - */ - - tst r14, #EXC_RETURN_PROCESS_STACK /* Nonzero if context on process stack */ - ite eq /* Next two instructions conditional */ - msreq msp, r0 /* R0=The main stack pointer */ - msrne psp, r0 /* R0=The process stack pointer */ - - /* Restore the interrupt state */ - - msr basepri, r3 /* Restore interrupts priority masking */ - - msr control, r12 /* Restore control */ - - /* Always return with R14 containing the special value that will: (1) - * return to thread mode, and (2) select the correct stack. - */ - - bx r14 /* And return */ - .cfi_endproc - - .size exception_common, .-exception_common - -/**************************************************************************** - * Name: g_intstackalloc/g_intstacktop - * - * Description: - * Shouldn't happen - * - ****************************************************************************/ - -#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 - .bss - .global g_intstackalloc - .global g_intstacktop - .balign 8 -g_intstackalloc: - .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7) -g_intstacktop: - .size g_intstackalloc, .-g_intstackalloc -#endif - - .end diff --git a/arch/arm/src/armv7-m/arm_vectors.c b/arch/arm/src/armv7-m/arm_vectors.c deleted file mode 100644 index e19227df2d1..00000000000 --- a/arch/arm/src/armv7-m/arm_vectors.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv7-m/arm_vectors.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2012 Michael Smith. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include "chip.h" -#include "arm_internal.h" -#include "ram_vectors.h" -#include "nvic.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* The base of the IDLE stack. Boards may override this to place the - * IDLE stack at a specific address; defaults to the end of .bss. - */ - -#ifndef IDLE_STACK_BASE -# define IDLE_STACK_BASE _ebss -#endif - -#define IDLE_STACK (IDLE_STACK_BASE + CONFIG_IDLETHREAD_STACKSIZE) - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* Chip-specific entrypoint */ - -extern void __start(void); - -static void noinstrument_function start(void) -{ - /* Zero lr to mark the end of backtrace */ - - asm volatile ("mov lr, #0\n\t" - "b __start\n\t"); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/* Common exception entrypoint */ - -extern void exception_common(void); -extern void exception_direct(void); - -/**************************************************************************** - * Public data - ****************************************************************************/ - -/* The v7m vector table consists of an array of function pointers, with the - * first slot (vector zero) used to hold the initial stack pointer. - * - * As all exceptions (interrupts) are routed via exception_common, we just - * need to fill this array with pointers to it. - * - * Note that the [ ... ] designated initializer is a GCC extension. - */ - -const void * const _vectors[] locate_data(".vectors") - aligned_data(VECTAB_ALIGN) = -{ - /* Initial stack */ - - IDLE_STACK, - - /* Reset exception handler */ - - start, - - /* Vectors 2 - n point directly at the generic handler */ - - [2 ... NVIC_IRQ_PENDSV] = &exception_common, - [(NVIC_IRQ_PENDSV + 1) ... (15 + ARMV7M_PERIPHERAL_INTERRUPTS)] - = &exception_direct -}; diff --git a/arch/arm/src/armv8-m/CMakeLists.txt b/arch/arm/src/armv8-m/CMakeLists.txt index 57c9b82a74f..e2ce8661311 100644 --- a/arch/arm/src/armv8-m/CMakeLists.txt +++ b/arch/arm/src/armv8-m/CMakeLists.txt @@ -21,7 +21,6 @@ # ############################################################################## set(SRCS - arm_exception.S arm_busfault.c arm_dbgmonitor.c arm_cache.c @@ -40,10 +39,6 @@ set(SRCS arm_trigger_irq.c arm_usagefault.c) -if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) - list(APPEND SRCS arm_vectors.c) -endif() - if(CONFIG_ARMV8M_SYSTICK) list(APPEND SRCS arm_systick.c) endif() diff --git a/arch/arm/src/armv8-m/Make.defs b/arch/arm/src/armv8-m/Make.defs index c534d923ad1..a6967f0c839 100644 --- a/arch/arm/src/armv8-m/Make.defs +++ b/arch/arm/src/armv8-m/Make.defs @@ -25,8 +25,6 @@ include common/Make.defs include arm_m/Make.defs -CMN_ASRCS += arm_exception.S - CMN_CSRCS += arm_busfault.c arm_cache.c arm_cpuinfo.c arm_doirq.c CMN_CSRCS += arm_hardfault.c arm_initialstate.c arm_itm.c CMN_CSRCS += arm_memfault.c arm_perf.c arm_sau.c @@ -35,10 +33,6 @@ CMN_CSRCS += arm_svcall.c CMN_CSRCS += arm_systemreset.c CMN_CSRCS += arm_trigger_irq.c arm_usagefault.c arm_dbgmonitor.c -ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) - CMN_CSRCS += arm_vectors.c -endif - ifeq ($(CONFIG_ARMV8M_SYSTICK),y) CMN_CSRCS += arm_systick.c endif diff --git a/arch/arm/src/armv8-m/arm_vectors.c b/arch/arm/src/armv8-m/arm_vectors.c deleted file mode 100644 index 5800556f0a4..00000000000 --- a/arch/arm/src/armv8-m/arm_vectors.c +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv8-m/arm_vectors.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2012 Michael Smith. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include "chip.h" -#include "arm_internal.h" -#include "ram_vectors.h" -#include "nvic.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* The base of the IDLE stack. Boards may override this to place the - * IDLE stack at a specific address; defaults to the end of .bss. - */ - -#ifndef IDLE_STACK_BASE -# define IDLE_STACK_BASE _ebss -#endif - -#define IDLE_STACK (IDLE_STACK_BASE + CONFIG_IDLETHREAD_STACKSIZE) - -#ifndef ARMV8M_PERIPHERAL_INTERRUPTS -# error ARMV8M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O interrupts to be supported -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* Chip-specific entrypoint */ - -extern void __start(void); - -static void noinstrument_function start(void) -{ - /* Zero lr to mark the end of backtrace */ - - asm volatile ("mov lr, #0\n\t" - "b __start\n\t"); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/* Common exception entrypoint */ - -extern void exception_common(void); -extern void exception_direct(void); - -/**************************************************************************** - * Public data - ****************************************************************************/ - -/* The v8m vector table consists of an array of function pointers, with the - * first slot (vector zero) used to hold the initial stack pointer. - * - * As all exceptions (interrupts) are routed via exception_common, we just - * need to fill this array with pointers to it. - * - * Note that the [ ... ] designated initializer is a GCC extension. - */ - -const void * const _vectors[] locate_data(".vectors") - aligned_data(VECTAB_ALIGN) = -{ - /* Initial stack */ - - IDLE_STACK, - - /* Reset exception handler */ - - start, - - /* Vectors 2 - n point directly at the generic handler. - * Reserved slots (7 in Non-Secure, 8-10, and 13) are left unassigned, - * which C guarantees to be zero-initialized (NULL). - */ - - [NVIC_IRQ_NMI ... NVIC_IRQ_USAGEFAULT] = &exception_common, -#if defined(CONFIG_ARCH_TRUSTZONE_SECURE) - [NVIC_IRQ_SECUREFAULT] = &exception_common, -#endif - [NVIC_IRQ_SVCALL ... NVIC_IRQ_DBGMONITOR] = &exception_common, - [NVIC_IRQ_PENDSV] = &exception_common, - [NVIC_IRQ_SYSTICK ... (15 + ARMV8M_PERIPHERAL_INTERRUPTS)] - = &exception_direct -};
