This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new ae539f7a0e9 arch/arm: allow boards to override the IDLE stack base
ae539f7a0e9 is described below

commit ae539f7a0e9ba0c7826ef2805be4939c7ff7b220
Author: anjiahao <[email protected]>
AuthorDate: Tue Nov 24 19:55:58 2026 +0800

    arch/arm: allow boards to override the IDLE stack base
    
    The ARM-M vector code hardcodes the IDLE stack at the end of .bss.
    Allow a board to define IDLE_STACK_BASE when the stack must be placed
    at a specific address, matching the ARM-A and ARM-R ports.
    
    Signed-off-by: anjiahao <[email protected]>
---
 arch/arm/src/armv6-m/arm_vectors.c | 10 +++++++++-
 arch/arm/src/armv7-m/arm_vectors.c | 10 +++++++++-
 arch/arm/src/armv8-m/arm_vectors.c | 10 +++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/armv6-m/arm_vectors.c 
b/arch/arm/src/armv6-m/arm_vectors.c
index 6a8669f0102..fb886959d6a 100644
--- a/arch/arm/src/armv6-m/arm_vectors.c
+++ b/arch/arm/src/armv6-m/arm_vectors.c
@@ -50,7 +50,15 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define IDLE_STACK      (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
+/* 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 ARMV6M_PERIPHERAL_INTERRUPTS
 #  error ARMV6M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O 
interrupts to be supported
diff --git a/arch/arm/src/armv7-m/arm_vectors.c 
b/arch/arm/src/armv7-m/arm_vectors.c
index 16f040e5398..e19227df2d1 100644
--- a/arch/arm/src/armv7-m/arm_vectors.c
+++ b/arch/arm/src/armv7-m/arm_vectors.c
@@ -48,7 +48,15 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define IDLE_STACK      (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
+/* 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
diff --git a/arch/arm/src/armv8-m/arm_vectors.c 
b/arch/arm/src/armv8-m/arm_vectors.c
index f4a2557d94e..5800556f0a4 100644
--- a/arch/arm/src/armv8-m/arm_vectors.c
+++ b/arch/arm/src/armv8-m/arm_vectors.c
@@ -48,7 +48,15 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define IDLE_STACK      (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
+/* 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

Reply via email to