Xtensa ESP32: Clean-up and fixes from last commits

This commit is contained in:
Gregory Nutt 2016-12-19 13:57:37 -06:00
parent 097f09cb02
commit e61549d8b9
3 changed files with 42 additions and 52 deletions

View File

@ -225,34 +225,14 @@ xtensa_coproc_savestate:
#ifdef __XTENSA_CALL0_ABI__
/* Need to preserve a8-11. _xtensa_coproc_savestate modifies a2-a7,
* a13-a15. So no registers need be saved.
* a13-a15. a12-a15 are callee saved registers so a13-a14 must be
* preserved.
*/
ENTRY(16)
s32i a0, sp, LOCAL_OFFSET(1) /* Save return address */
/* Call _xtensa_coproc_savestate() with A2=address of co-processor
* save area.
*/
call0 _xtensa_coproc_savestate
l32i a0, sp, LOCAL_OFFSET(1) /* Recover return address */
RET(16)
#else
ENTRY(32)
/* Need to preserve a8-15. _xtensa_coproc_savestate modifies a2-a7,
* a13-a15. So a13-a15 may need to be preserved.
*/
s32i a0, sp, LOCAL_OFFSET(1) /* Save return address */
#if 0
s32i a13, sp, LOCAL_OFFSET(2) /* Save clobbered registers */
s32i a14, sp, LOCAL_OFFSET(3)
s32i a15, sp, LOCAL_OFFSET(4)
#endif
s32i a13, sp, LOCAL_OFFSET(1) /* Save clobbered registers */
s32i a14, sp, LOCAL_OFFSET(2)
s32i a15, sp, LOCAL_OFFSET(3)
/* Call _xtensa_coproc_savestate() with A2=address of co-processor
* save area.
@ -262,14 +242,29 @@ xtensa_coproc_savestate:
/* Restore a13-15 and return */
l32i a0, sp, LOCAL_OFFSET(1) /* Recover return address */
#if 0
l32i a13, sp, LOCAL_OFFSET(2) /* Restore clobbered registers */
l32i a14, sp, LOCAL_OFFSET(3)
l32i a15, sp, LOCAL_OFFSET(4)
#endif
l32i a13, sp, LOCAL_OFFSET(1) /* Restore clobbered registers */
l32i a14, sp, LOCAL_OFFSET(2)
l32i a15, sp, LOCAL_OFFSET(3)
RET(16)
RET(32)
#else
/* Need to preserve a8-15. _xtensa_coproc_savestate modifies a2-a7,
* a13-a15. So a13-a15 may need to be preserved.
*/
ENTRY(32 /*16*/) /* REVISIT: Why 32? */
s32i a0, sp, LOCAL_OFFSET(1) /* Save return address */
/* Call _xtensa_coproc_savestate() with A2=address of co-processor
* save area.
*/
call0 _xtensa_coproc_savestate
/* Restore a0 and return */
l32i a0, sp, LOCAL_OFFSET(1) /* Recover return address */
RET(32 /*16*/) /* REVISIT: Why 32? */
#endif
@ -429,11 +424,14 @@ xtensa_coproc_restorestate:
#ifdef __XTENSA_CALL0_ABI__
/* Need to preserve a8-11. _xtensa_coproc_restorestate modifies a2-a7,
* a13-a15. So no registers need be saved.
* a13-a15. a12-a15 are callee saved registers so a13-a14 must be
* preserved.
*/
ENTRY(16)
s32i a0, sp, LOCAL_OFFSET(1) /* Save return address */
s32i a13, sp, LOCAL_OFFSET(1) /* Save clobbered values */
s32i a14, sp, LOCAL_OFFSET(2)
s32i a15, sp, LOCAL_OFFSET(3)
/* Call _xtensa_coproc_restorestate() with A2=address of co-processor
* save area. Registers a0, a2-a7, a13-a15 have been trashed.
@ -441,22 +439,20 @@ xtensa_coproc_restorestate:
call0 _xtensa_coproc_restorestate
l32i a0, sp, LOCAL_OFFSET(1) /* Recover return address */
/* Restore a13-a15 and return */
l32i a13, sp, LOCAL_OFFSET(1) /* Restore clobbered registers */
l32i a14, sp, LOCAL_OFFSET(2)
l32i a15, sp, LOCAL_OFFSET(3)
RET(16)
#else
ENTRY(32)
/* Need to preserve a8-15. _xtensa_coproc_savestate modifies a2-a7,
* a13-a15. So a13-a15 may need to be preserved.
*/
ENTRY(32 /*16*/) /* REVISIT: Why 32? */
s32i a0, sp, LOCAL_OFFSET(1) /* Save return address */
#if 0
s32i a13, sp, LOCAL_OFFSET(2) /* Save clobbered values */
s32i a14, sp, LOCAL_OFFSET(3)
s32i a15, sp, LOCAL_OFFSET(4)
#endif
/* Call _xtensa_coproc_restorestate() with A2=address of co-processor
* save area. Registers a0, a2-a7, a13-a15 have been trashed.
@ -464,16 +460,10 @@ xtensa_coproc_restorestate:
call0 _xtensa_coproc_restorestate
/* Restore a13-15 and return */
/* Restore a0 and return */
l32i a0, sp, LOCAL_OFFSET(1) /* Recover return address */
#if 0
l32i a13, sp, LOCAL_OFFSET(2) /* Restore clobbered registers */
l32i a14, sp, LOCAL_OFFSET(3)
l32i a15, sp, LOCAL_OFFSET(4)
#endif
RET(32)
RET(32 /*16*/) /* REVISIT: Why 32? */
#endif

View File

@ -42,7 +42,7 @@ ASRCS =
CSRCS = esp32_boot.c esp32_bringup.c
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CONFIG_CSRCS += esp32_appinit.c
CSRCS += esp32_appinit.c
endif
SCRIPTIN = $(SCRIPTDIR)$(DELIM)esp32.template

View File

@ -42,7 +42,7 @@
#include <sys/types.h>
#include <nuttx/board.h>
#include "esp32_core.h"
#include "esp32-core.h"
#ifdef CONFIG_LIB_BOARDCTL