You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/03 09:13:23 UTC
[incubator-nuttx] 01/03: arch: armv6-m: Introduce setintstack macro
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 9f206f2bb6dcb6cf395fd430696af3c07312a8a1
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Sat Jul 3 09:03:23 2021 +0900
arch: armv6-m: Introduce setintstack macro
Summary:
- This commit introduces setintstack macro which can be
overridden for SMP with interrupt stack
Impact:
- SMP only
Testing:
- Tested with raspberrypi-pico:smp
- NOTE: more commits will be added later
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
arch/arm/src/armv6-m/arm_exception.S | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/arch/arm/src/armv6-m/arm_exception.S b/arch/arm/src/armv6-m/arm_exception.S
index a2200be..b71a912 100644
--- a/arch/arm/src/armv6-m/arm_exception.S
+++ b/arch/arm/src/armv6-m/arm_exception.S
@@ -44,6 +44,11 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+
+#ifdef CONFIG_SMP
+# include "chip.h"
+#endif
+
#include "exc_return.h"
/****************************************************************************
@@ -54,6 +59,26 @@
.file "arm_exception.S"
/****************************************************************************
+ * Macro Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: setintstack
+ *
+ * Description:
+ * Set the current stack pointer to the "top" the interrupt stack. Single CPU
+ * case. Must be provided by MCU-specific logic in the SMP case.
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 3
+ .macro setintstack, tmp1, tmp2
+ ldr \tmp1, =g_intstacktop
+ mov sp, \tmp1
+ .endm
+#endif
+
+/****************************************************************************
* .text
****************************************************************************/
@@ -142,8 +167,7 @@ exception_common:
*/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- ldr r7, =g_intstacktop /* R7=Top of the interrupt stack */
- mov sp, r7 /* Set the new stack point */
+ setintstack r7, r6 /* SP = IRQ stack top */
push {r1} /* Save the MSP on the interrupt stack */
bl arm_doirq /* R0=IRQ, R1=register save area on stack */
pop {r1} /* Recover R1=main stack pointer */