Xtensa ESP32: Fix several build-related issues associated with vector section

This commit is contained in:
Gregory Nutt 2016-12-15 10:08:26 -06:00
parent 4795d58e03
commit 10b9a10d2f
7 changed files with 100 additions and 69 deletions

View file

@ -63,6 +63,7 @@
#include <arch/chip/core-isa.h>
#include <arch/xtensa/xtensa_specregs.h>
#include "xtensa.h"
#include "xtensa_abi.h"
#include "chip_macros.h"
#include "xtensa_timer.h"
@ -142,6 +143,13 @@
extract_msb a4, a2 /* a4 = MSB of a2, a2 trashed */
/* Check for a timer interrupt.
*
* REVISIT: XT_TIMER_INTEN will be only one of the configured timers
* (see xtensa_timer.h). There is no mechanism here to detect other
* timer interrupts.
*/
movi a3, XT_TIMER_INTEN /* a3 = timer interrupt bit */
wsr a4, INTCLEAR /* Clear sw or edge-triggered interrupt */
beq a3, a4, 4f /* If timer interrupt then skip table */
@ -182,9 +190,13 @@
* We'll be reading the interrupt state again after this call
* so no need to preserve any registers except a7 (pointer to
* state save area).
*
* REVISIT: Here we explicitly assume that the INTERRUPT XT_TIMER_INTEN
* corresponds to TIMER0. That is probably that case, but not necessarily
* so.
*/
movi a2, XTENSA_IRQ_TIMER&level& /* Argument 1: IRQ number */
movi a2, XTENSA_IRQ_TIMER0 /* Argument 1: Timer0 IRQ number */
mov a3, a12 /* Argument 2: Top of stack = register save area */
#ifdef __XTENSA_CALL0_ABI__
call0 xtensa_irq_dispatch /* Call xtensa_int_decode */
@ -270,6 +282,7 @@
.section HANDLER_SECTION, "ax"
.type _xtensa_level1_handler, @function
.global _xtensa_level1_handler
.align 4
_xtensa_level1_handler:
@ -354,6 +367,7 @@ _xtensa_level1_handler:
#if XCHAL_EXCM_LEVEL >= 2
.section HANDLER_SECTION, "ax"
.type _xtensa_level2_handler, @function
.global _xtensa_level2_handler
.align 4
_xtensa_level2_handler:
@ -414,6 +428,7 @@ _xtensa_level2_handler:
#if XCHAL_EXCM_LEVEL >= 3
.section HANDLER_SECTION, "ax"
.type _xtensa_level3_handler, @function
.global _xtensa_level3_handler
.align 4
_xtensa_level3_handler:
@ -474,6 +489,7 @@ _xtensa_level3_handler:
#if XCHAL_EXCM_LEVEL >= 4
.section HANDLER_SECTION, "ax"
.type _xtensa_level4_handler, @function
.global _xtensa_level4_handler
.align 4
_xtensa_level4_handler:
@ -534,6 +550,7 @@ _xtensa_level4_handler:
#if XCHAL_EXCM_LEVEL >= 5
.section HANDLER_SECTION, "ax"
.type _xtensa_level5_handler, @function
.global _xtensa_level5_handler
.align 4
_xtensa_level5_handler:
@ -594,6 +611,7 @@ _xtensa_level5_handler:
#if XCHAL_EXCM_LEVEL >= 6
.section HANDLER_SECTION, "ax"
.type _xtensa_level6_handler, @function
.global _xtensa_level6_handler
.align 4
_xtensa_level6_handler:
@ -690,6 +708,7 @@ _xtensa_level6_handler:
#if XCHAL_INT_NLEVELS >=2 && XCHAL_EXCM_LEVEL < 2 && XCHAL_DEBUGLEVEL !=2
.section HANDLER_SECTION, "ax"
.type _xtensa_level2_handler, @function
.global _xtensa_level2_handler
.align 4
_xtensa_level2_handler:
@ -723,6 +742,7 @@ _xtensa_level2_handler:
#if XCHAL_INT_NLEVELS >=3 && XCHAL_EXCM_LEVEL < 3 && XCHAL_DEBUGLEVEL !=3
.section HANDLER_SECTION, "ax"
.type _xtensa_level3_handler, @function
.global _xtensa_level3_handler
.align 4
_xtensa_level3_handler:
@ -758,6 +778,7 @@ _xtensa_level3_handler:
#if XCHAL_INT_NLEVELS >=4 && XCHAL_EXCM_LEVEL < 4 && XCHAL_DEBUGLEVEL !=4
.section HANDLER_SECTION, "ax"
.type _xtensa_level4_handler, @function
.global _xtensa_level4_handler
.align 4
_xtensa_level4_handler:
@ -793,6 +814,7 @@ _xtensa_level4_handler:
#if XCHAL_INT_NLEVELS >=5 && XCHAL_EXCM_LEVEL < 5 && XCHAL_DEBUGLEVEL !=5
.section HANDLER_SECTION, "ax"
.type _xtensa_level5_handler, @function
.global _xtensa_level5_handler
.align 4
_xtensa_level5_handler:
@ -828,6 +850,7 @@ _xtensa_level5_handler:
#if XCHAL_INT_NLEVELS >=6 && XCHAL_EXCM_LEVEL < 6 && XCHAL_DEBUGLEVEL !=6
.section HANDLER_SECTION, "ax"
.type _xtensa_level6_handler, @function
.global _xtensa_level6_handler
.align 4
_xtensa_level6_handler:

View file

@ -59,10 +59,13 @@
****************************************************************************/
#include <nuttx/config.h>
#include <arch/irq.h>
#include <arch/xtensa/core.h>
#include <arch/xtensa/xtensa_specregs.h>
#include "chip_macros.h"
/****************************************************************************
* Public Functions
****************************************************************************/

View file

@ -59,10 +59,13 @@
****************************************************************************/
#include <nuttx/config.h>
#include <arch/irq.h>
#include <arch/xtensa/core.h>
#include <arch/xtensa/xtensa_specregs.h>
#include "chip_macros.h"
/****************************************************************************
* Assembly Language Macros
****************************************************************************/
@ -158,6 +161,7 @@ _xtensa_to_coproc_handler:
****************************************************************************/
.type _xtensa_user_handler, @function
.global _xtensa_user_handler
.align 4
_xtensa_user_handler:
@ -254,6 +258,7 @@ _xtensa_user_handler:
.section HANDLER_SECTION, "ax"
.type _xtensa_syscall_handler, @function
.align 4
_xtensa_syscall_handler:
/* Allocate stack frame and save A0, A1, and PS */

View file

@ -42,6 +42,7 @@
#include <arch/chip/core-isa.h>
#include <arch/xtensa/xtensa_specregs.h>
#include "xtensa.h"
#include "xtensa_abi.h"
/****************************************************************************
@ -226,10 +227,10 @@ _xtensa_nmi_vector:
****************************************************************************/
#if XCHAL_HAVE_DEBUG
.begin literal_prefix .debug_exception_vector
.section .debug_exception_vector.text, "ax"
.global _debug_exception_vector
.align 4
.begin literal_prefix .debug_exception_vector
.section .debug_exception_vector.text, "ax"
.global _debug_exception_vector
.align 4
_debug_exception_vector:
@ -261,10 +262,10 @@ _debug_exception_vector:
****************************************************************************/
#ifdef XCHAL_DOUBLEEXC_VECTOR_VADDR
.begin literal_prefix .double_exception_vector
.section .double_exception_vector.text, "ax"
.global _double_exception_vector
.align 4
.begin literal_prefix .double_exception_vector
.section .double_exception_vector.text, "ax"
.global _double_exception_vector
.align 4
_double_exception_vector:
@ -286,7 +287,7 @@ _double_exception_vector:
movi a2, XTENSA_DOUBLE_EXCEPTION /* Address of state save on stack */
call0 _xtensa_panic /* Does not return */
.end literal_prefix
.end literal_prefix
#endif /* XCHAL_DOUBLEEXC_VECTOR_VADDR */
@ -298,10 +299,10 @@ _double_exception_vector:
*
****************************************************************************/
.begin literal_prefix .kernel_exception_vector
.section .kernel_exception_vector.text, "ax"
.global _kernel_exception_vector
.align 4
.begin literal_prefix .kernel_exception_vector
.section .kernel_exception_vector.text, "ax"
.global _kernel_exception_vector
.align 4
_kernel_exception_vector:
@ -333,15 +334,15 @@ _kernel_exception_vector:
*
****************************************************************************/
.begin literal_prefix .user_exception_vector
.section .user_exception_vector.text, "ax"
.global _user_exception_vector
.type _user_exception_vector, @function
.align 4
.begin literal_prefix .user_exception_vector
.section .user_exception_vector.text, "ax"
.global _user_exception_vector
.type _user_exception_vector, @function
.align 4
_user_exception_vector:
wsr a0, EXCSAVE_1 /* Preserve a0 */
call0 xtensa_user_handler /* And jump to user exception handler */
call0 _xtensa_user_handler /* And jump to user exception handler */
.end literal_prefix

View file

@ -35,14 +35,13 @@
# The start-up, "head", file. May be either a .S or a .c file.
HEAD_ASRC =
HEAD_CSRC = esp32_start.c
HEAD_ASRC = xtensa_vectors.S xtensa_window_vector.S xtensa_windowspill.S
HEAD_ASRC += xtensa_int_handlers.S xtensa_user_handler.S
HEAD_CSRC = esp32_start.c
# Common XTENSA files (arch/xtensa/src/common)
CMN_ASRCS = xtensa_context.S xtensa_coproc.S xtensa_cpuint.S
CMN_ASRCS += xtensa_int_handlers.S xtensa_panic.S xtensa_user_handler.S
CMN_ASRCS += xtensa_vectors.S xtensa_windowspill.S
CMN_ASRCS = xtensa_context.S xtensa_coproc.S xtensa_cpuint.S xtensa_panic.S
CMN_CSRCS = xtensa_assert.c xtensa_blocktask.c xtensa_copystate.c
CMN_CSRCS += xtensa_cpenable.c xtensa_createstack.c xtensa_exit.c xtensa_idle.c

View file

@ -19,25 +19,25 @@ SECTIONS
/* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */
. = 0x0;
KEEP(*(.window_vectors.text));
KEEP (*(.window_vectors.text));
. = 0x180;
KEEP(*(.xtensa_level2_vector.text));
KEEP (*(.xtensa_level2_vector.text));
. = 0x1c0;
KEEP(*(.xtensa_level3_vector.text));
KEEP (*(.xtensa_level3_vector.text));
. = 0x200;
KEEP(*(.xtensa_level4_vector.text));
KEEP (*(.xtensa_level4_vector.text));
. = 0x240;
KEEP(*(.xtensa_level5_vector.text));
KEEP (*(.xtensa_level5_vector.text));
. = 0x280;
KEEP(*(.debug_exception_vector.text));
KEEP (*(.debug_exception_vector.text));
. = 0x2c0;
KEEP(*(.nmi_vector.text));
KEEP (*(.nmi_vector.text));
. = 0x300;
KEEP(*(.kernel_exception_vector.text));
KEEP (*(.kernel_exception_vector.text));
. = 0x340;
KEEP(*(.user_exception_vector.text));
KEEP (*(.user_exception_vector.text));
. = 0x3c0;
KEEP(*(.double_exception_vector.text));
KEEP (*(.double_exception_vector.text));
. = 0x400;
*(.*_vector.literal)
@ -78,7 +78,7 @@ SECTIONS
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
*(.dynbss)
KEEP(*(.bss))
KEEP (*(.bss))
*(.bss.*)
*(.share.mem)
*(.gnu.linkonce.b.*)
@ -96,17 +96,17 @@ SECTIONS
/* .data initialized on power-up in ROMed configurations. */
_sdata = ABSOLUTE(.);
KEEP(*(.data))
KEEP(*(.data.*))
KEEP(*(.gnu.linkonce.d.*))
KEEP(*(.data1))
KEEP(*(.sdata))
KEEP(*(.sdata.*))
KEEP(*(.gnu.linkonce.s.*))
KEEP(*(.sdata2))
KEEP(*(.sdata2.*))
KEEP(*(.gnu.linkonce.s2.*))
KEEP(*(.jcr))
KEEP (*(.data))
KEEP (*(.data.*))
KEEP (*(.gnu.linkonce.d.*))
KEEP (*(.data1))
KEEP (*(.sdata))
KEEP (*(.sdata.*))
KEEP (*(.gnu.linkonce.s.*))
KEEP (*(.sdata2))
KEEP (*(.sdata2.*))
KEEP (*(.gnu.linkonce.s2.*))
KEEP (*(.jcr))
*(.dram1 .dram1.*)
_edata = ABSOLUTE(.);
. = ALIGN(4);

View file

@ -19,25 +19,25 @@ SECTIONS
/* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */
. = 0x0;
KEEP(*(.window_vectors.text));
KEEP (*(.window_vectors.text));
. = 0x180;
KEEP(*(.xtensa_level2_vector.text));
KEEP (*(.xtensa_level2_vector.text));
. = 0x1c0;
KEEP(*(.xtensa_level3_vector.text));
KEEP (*(.xtensa_level3_vector.text));
. = 0x200;
KEEP(*(.xtensa_level4_vector.text));
KEEP (*(.xtensa_level4_vector.text));
. = 0x240;
KEEP(*(.xtensa_level5_vector.text));
KEEP (*(.xtensa_level5_vector.text));
. = 0x280;
KEEP(*(.debug_exception_vector.text));
KEEP (*(.debug_exception_vector.text));
. = 0x2c0;
KEEP(*(.nmi_vector.text));
KEEP (*(.nmi_vector.text));
. = 0x300;
KEEP(*(.kernel_exception_vector.text));
KEEP (*(.kernel_exception_vector.text));
. = 0x340;
KEEP(*(.user_exception_vector.text));
KEEP (*(.user_exception_vector.text));
. = 0x3c0;
KEEP(*(.double_exception_vector.text));
KEEP (*(.double_exception_vector.text));
. = 0x400;
*(.*_vector.literal)
@ -89,7 +89,7 @@ SECTIONS
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
*(.dynbss)
KEEP(*(.bss))
KEEP (*(.bss))
*(.bss.*)
*(.share.mem)
*(.gnu.linkonce.b.*)
@ -107,17 +107,17 @@ SECTIONS
/* .data initialized on power-up in ROMed configurations. */
_sdata = ABSOLUTE(.);
KEEP(*(.data))
KEEP(*(.data.*))
KEEP(*(.gnu.linkonce.d.*))
KEEP(*(.data1))
KEEP(*(.sdata))
KEEP(*(.sdata.*))
KEEP(*(.gnu.linkonce.s.*))
KEEP(*(.sdata2))
KEEP(*(.sdata2.*))
KEEP(*(.gnu.linkonce.s2.*))
KEEP(*(.jcr))
KEEP (*(.data))
KEEP (*(.data.*))
KEEP (*(.gnu.linkonce.d.*))
KEEP (*(.data1))
KEEP (*(.sdata))
KEEP (*(.sdata.*))
KEEP (*(.gnu.linkonce.s.*))
KEEP (*(.sdata2))
KEEP (*(.sdata2.*))
KEEP (*(.gnu.linkonce.s2.*))
KEEP (*(.jcr))
*(.dram1 .dram1.*)
_edata = ABSOLUTE(.);
. = ALIGN(4);