diff options
-rw-r--r-- | os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7S256.ld | 7 | ||||
-rw-r--r-- | os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7X256.ld | 7 | ||||
-rw-r--r-- | os/ports/GCC/ARM/LPC214x/ld/LPC2148.ld | 7 | ||||
-rw-r--r-- | os/ports/GCC/ARM/chcore.h | 23 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/chcore_v6m.h | 2 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/chcore_v7m.h | 2 | ||||
-rw-r--r-- | readme.txt | 2 |
7 files changed, 22 insertions, 28 deletions
diff --git a/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7S256.ld b/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7S256.ld index cad09b755..8ec869a02 100644 --- a/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7S256.ld +++ b/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7S256.ld @@ -98,7 +98,8 @@ SECTIONS }
PROVIDE(end = .);
-_end = .;
+_end = .;
-__heap_base__ = _end;
-__heap_end__ = __ram_end__ - __stacks_total_size__;
+__heap_base__ = _end;
+__heap_end__ = __ram_end__ - __stacks_total_size__;
+__main_thread_stack_base__ = __ram_end__ - __stacks_total_size__;
diff --git a/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7X256.ld b/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7X256.ld index 9308935be..ea9527a34 100644 --- a/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7X256.ld +++ b/os/ports/GCC/ARM/AT91SAM7/ld/AT91SAM7X256.ld @@ -98,7 +98,8 @@ SECTIONS }
PROVIDE(end = .);
-_end = .;
+_end = .;
-__heap_base__ = _end;
-__heap_end__ = __ram_end__ - __stacks_total_size__;
+__heap_base__ = _end;
+__heap_end__ = __ram_end__ - __stacks_total_size__;
+__main_thread_stack_base__ = __ram_end__ - __stacks_total_size__;
diff --git a/os/ports/GCC/ARM/LPC214x/ld/LPC2148.ld b/os/ports/GCC/ARM/LPC214x/ld/LPC2148.ld index 40683d14e..c94daa808 100644 --- a/os/ports/GCC/ARM/LPC214x/ld/LPC2148.ld +++ b/os/ports/GCC/ARM/LPC214x/ld/LPC2148.ld @@ -101,7 +101,8 @@ SECTIONS }
PROVIDE(end = .);
-_end = .;
+_end = .;
-__heap_base__ = _end;
-__heap_end__ = __ram_end__ - __stacks_total_size__;
+__heap_base__ = _end;
+__heap_end__ = __ram_end__ - __stacks_total_size__;
+__main_thread_stack_base__ = __ram_end__ - __stacks_total_size__;
diff --git a/os/ports/GCC/ARM/chcore.h b/os/ports/GCC/ARM/chcore.h index 20727ce23..c2d2892cd 100644 --- a/os/ports/GCC/ARM/chcore.h +++ b/os/ports/GCC/ARM/chcore.h @@ -438,14 +438,10 @@ struct context { #ifdef THUMB
#if CH_DBG_ENABLE_STACK_CHECK
#define port_switch(ntp, otp) { \
- register Thread *_ntp asm ("r0") = (ntp); \
- register Thread *_otp asm ("r1") = (otp); \
- register char *sp asm ("sp"); \
- if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) \
- asm volatile ("mov r0, #0 \n\t" \
- "ldr r1, =chDbgPanic \n\t" \
- "bx r1"); \
- _port_switch_thumb(_ntp, _otp); \
+ register struct intctx *r13 asm ("r13"); \
+ if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
+ chDbgPanic("stack overflow"); \
+ _port_switch_thumb(ntp, otp); \
}
#else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(ntp, otp) _port_switch_thumb(ntp, otp)
@@ -453,13 +449,10 @@ struct context { #else /* !THUMB */
#if CH_DBG_ENABLE_STACK_CHECK
#define port_switch(ntp, otp) { \
- register Thread *_ntp asm ("r0") = (ntp); \
- register Thread *_otp asm ("r1") = (otp); \
- register char *sp asm ("sp"); \
- if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) \
- asm volatile ("mov r0, #0 \n\t" \
- "b chDbgPanic"); \
- _port_switch_arm(_ntp, _otp); \
+ register struct intctx *r13 asm ("r13"); \
+ if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
+ chDbgPanic("stack overflow"); \
+ _port_switch_arm(ntp, otp); \
}
#else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(ntp, otp) _port_switch_arm(ntp, otp)
diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.h b/os/ports/GCC/ARMCMx/chcore_v6m.h index c2142e46a..b98be1166 100644 --- a/os/ports/GCC/ARMCMx/chcore_v6m.h +++ b/os/ports/GCC/ARMCMx/chcore_v6m.h @@ -242,7 +242,7 @@ struct intctx { #define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
- register struct intctx *r13 asm ("r13"); \
+ register struct intctx *r13 asm ("r13"); \
if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
chDbgPanic("stack overflow"); \
_port_switch(ntp, otp); \
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h index 5e2aea343..3710c2edf 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.h +++ b/os/ports/GCC/ARMCMx/chcore_v7m.h @@ -328,7 +328,7 @@ struct intctx { #define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
- register struct intctx *r13 asm ("r13"); \
+ register struct intctx *r13 asm ("r13"); \
if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
chDbgPanic("stack overflow"); \
_port_switch(ntp, otp); \
diff --git a/readme.txt b/readme.txt index b56489b80..c2fffb1a7 100644 --- a/readme.txt +++ b/readme.txt @@ -92,7 +92,6 @@ - NEW: Removed all the ch.ld files from the ARMCMx demos, now the makefiles
point to common ld files under the various ports. Less duplication and
easier maintenance.
- (do this to the other GCC ports too)
- NEW: Improved stack checking and reorganized memory map for the Cortex-Mx
demos. Now stacks are allocated at the start of the RAM, an overflow of the
exception stack now triggers an exception (it could went unnoticed before).
@@ -100,7 +99,6 @@ threads. Now all threads have an explicit stack boundary pointer.
(documentation to be updated)
(change to be ported to IAR and Keil ports)
- (change to be ported to ARM and other ports)
- NEW: Added debug plugin for Eclipse under ./tools/eclipse (backported to
2.2.7).
- NEW: The debug macros chDbgCheck() and chDbgAssert() now can be externally
|