From 2a17786f98566bee41e5316bdb9bf1e095f39ed3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 30 Oct 2016 12:24:22 -0600 Subject: [PATCH] Xtensa/ESP32: Fix some compilation issues --- arch/xtensa/src/common/xtensa_coproc.S | 12 ++++++------ arch/xtensa/src/common/xtensa_dumpstate.c | 8 +++++++- arch/xtensa/src/common/xtensa_int_handlers.S | 2 +- arch/xtensa/src/common/xtensa_irqdispatch.c | 2 +- arch/xtensa/src/common/xtensa_vectors.S | 5 +++-- configs/esp32-core/nsh/defconfig | 2 +- configs/esp32-core/smp/defconfig | 1 - 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/arch/xtensa/src/common/xtensa_coproc.S b/arch/xtensa/src/common/xtensa_coproc.S index 2bcba0185f..c29e23a33b 100644 --- a/arch/xtensa/src/common/xtensa_coproc.S +++ b/arch/xtensa/src/common/xtensa_coproc.S @@ -256,9 +256,9 @@ xtensa_coproc_savestate: /* Restore a13-15 and return */ - 132i a13, sp, LOCAL_OFFSET(1) - 132i a14, sp, LOCAL_OFFSET(2) - 132i a15, sp, LOCAL_OFFSET(3) + l32i a13, sp, LOCAL_OFFSET(1) + l32i a14, sp, LOCAL_OFFSET(2) + l32i a15, sp, LOCAL_OFFSET(3) RET(16) @@ -443,9 +443,9 @@ xtensa_coproc_restorestate: /* Restore a13-15 and return */ - 132i a13, sp, LOCAL_OFFSET(1) - 132i a14, sp, LOCAL_OFFSET(2) - 132i a15, sp, LOCAL_OFFSET(3) + l32i a13, sp, LOCAL_OFFSET(1) + l32i a14, sp, LOCAL_OFFSET(2) + l32i a15, sp, LOCAL_OFFSET(3) RET(16) diff --git a/arch/xtensa/src/common/xtensa_dumpstate.c b/arch/xtensa/src/common/xtensa_dumpstate.c index b1afe927fc..975993af62 100644 --- a/arch/xtensa/src/common/xtensa_dumpstate.c +++ b/arch/xtensa/src/common/xtensa_dumpstate.c @@ -68,7 +68,13 @@ static inline uint32_t xtensa_getsp(void) { register uint32_t sp; -#warning Missing logic + + __asm__ __volatile__ + ( + "mov %0, sp\n" + : "=r" (sp) + ); + return sp; } diff --git a/arch/xtensa/src/common/xtensa_int_handlers.S b/arch/xtensa/src/common/xtensa_int_handlers.S index db358ff734..c8dc0c4569 100644 --- a/arch/xtensa/src/common/xtensa_int_handlers.S +++ b/arch/xtensa/src/common/xtensa_int_handlers.S @@ -284,7 +284,7 @@ _xtensa_level1_handler: /* Restore only level-specific regs (the rest were already restored) */ l32i a0, sp, (4 * REG_PS) /* Retrieve interruptee's PS */ - wsr a0, EPS_1 + wsr a0, PS l32i a0, sp, (4 * REG_PC) /* Retrieve interruptee's PC */ wsr a0, EPC_1 l32i a0, sp, (4 * REG_A0) /* Retrieve interruptee's A0 */ diff --git a/arch/xtensa/src/common/xtensa_irqdispatch.c b/arch/xtensa/src/common/xtensa_irqdispatch.c index 9ce5bba087..e2ce51f29e 100644 --- a/arch/xtensa/src/common/xtensa_irqdispatch.c +++ b/arch/xtensa/src/common/xtensa_irqdispatch.c @@ -86,7 +86,7 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) irq_dispatch(irq, regs); -#if defined(CONFIG_ARCH_FPU) || defined(CONFIG_ARCH_ADDRENV) +#if XCHAL_CP_NUM > 0 || defined(CONFIG_ARCH_ADDRENV) /* Check for a context switch. If a context switch occurred, then * CURRENT_REGS will have a different value than it did on entry. */ diff --git a/arch/xtensa/src/common/xtensa_vectors.S b/arch/xtensa/src/common/xtensa_vectors.S index 5f5c16248b..42158964e4 100644 --- a/arch/xtensa/src/common/xtensa_vectors.S +++ b/arch/xtensa/src/common/xtensa_vectors.S @@ -38,6 +38,7 @@ #include +#include #include #include @@ -272,7 +273,7 @@ _double_exception_vector: mov a0, sp /* sp == a1 */ addi sp, sp, -(4 * XCPTCONTEXT_SIZE) /* Allocate interrupt stack frame */ s32i a0, sp, (4 * REG_A1) /* Save pre-interrupt SP */ - rsr a0, EPS_1 /* Save interruptee's PS -- REVISIT */ + rsr a0, EPS /* Save interruptee's PS -- REVISIT */ s32i a0, sp, (4 * REG_PS) rsr a0, DEPC /* Save interruptee's PC */ s32i a0, sp, (4 * REG_PC) @@ -309,7 +310,7 @@ _kernel_exception_vector: mov a0, sp /* sp == a1 */ addi sp, sp, -(4 * XCPTCONTEXT_SIZE) /* Allocate interrupt stack frame */ s32i a0, sp, (4 * REG_A1) /* Save pre-interrupt SP */ - rsr a0, EPS_1 /* Save interruptee's PS */ + rsr a0, EPS /* Save interruptee's PS */ s32i a0, sp, (4 * REG_PS) rsr a0, EPC_1 /* Save interruptee's PC */ s32i a0, sp, (4 * REG_PC) diff --git a/configs/esp32-core/nsh/defconfig b/configs/esp32-core/nsh/defconfig index b163053233..96bb1c7bd3 100644 --- a/configs/esp32-core/nsh/defconfig +++ b/configs/esp32-core/nsh/defconfig @@ -75,7 +75,6 @@ CONFIG_ARCH_CHIP="esp32" # CONFIG_SERIAL_TERMIOS is not set CONFIG_ARCH_CHIP_ESP32=y CONFIG_ARCH_FAMILY_LX6=y -CONFIG_XTENSA_CALL0_ABI=y # CONFIG_XTENSA_USE_OVLY is not set CONFIG_XTENSA_CP_INITSET=0x0001 CONFIG_ESP32_UART=y @@ -203,6 +202,7 @@ CONFIG_PREALLOC_TIMERS=4 # # Tasks and Scheduling # +# CONFIG_SMP is not set # CONFIG_INIT_NONE is not set CONFIG_INIT_ENTRYPOINT=y # CONFIG_INIT_FILEPATH is not set diff --git a/configs/esp32-core/smp/defconfig b/configs/esp32-core/smp/defconfig index 104c7c89ba..403a5e3c8d 100644 --- a/configs/esp32-core/smp/defconfig +++ b/configs/esp32-core/smp/defconfig @@ -75,7 +75,6 @@ CONFIG_ARCH_CHIP="esp32" # CONFIG_SERIAL_TERMIOS is not set CONFIG_ARCH_CHIP_ESP32=y CONFIG_ARCH_FAMILY_LX6=y -CONFIG_XTENSA_CALL0_ABI=y # CONFIG_XTENSA_USE_OVLY is not set CONFIG_XTENSA_CP_INITSET=0x0001 CONFIG_ESP32_UART=y