diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-01-15 10:14:20 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-01-15 10:14:20 +0000 |
commit | 6e11b18986d202f8a2e44cead0c37a2145360337 (patch) | |
tree | 049911c9b2aba94fc8ac4ed0d98185ecdc2a32aa /os/ports/IAR/ARMCMx | |
parent | 7474bb1c105be4221812eb272e2a8764ae74bee7 (diff) | |
download | ChibiOS-6e11b18986d202f8a2e44cead0c37a2145360337.tar.gz ChibiOS-6e11b18986d202f8a2e44cead0c37a2145360337.tar.bz2 ChibiOS-6e11b18986d202f8a2e44cead0c37a2145360337.zip |
Fixed bug 3158776.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2643 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/IAR/ARMCMx')
-rw-r--r-- | os/ports/IAR/ARMCMx/STM32/vectors.s | 2 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/chcore_v6m.h | 8 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/chcore_v7m.h | 8 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/cstartup.s | 16 |
4 files changed, 26 insertions, 8 deletions
diff --git a/os/ports/IAR/ARMCMx/STM32/vectors.s b/os/ports/IAR/ARMCMx/STM32/vectors.s index 193150f38..868741f4f 100644 --- a/os/ports/IAR/ARMCMx/STM32/vectors.s +++ b/os/ports/IAR/ARMCMx/STM32/vectors.s @@ -31,7 +31,7 @@ PRESERVE8
SECTION IRQSTACK:DATA:NOROOT(3)
- SECTION .intvec:CODE:NOROOT(2)
+ SECTION .intvec:CODE:NOROOT(3)
EXTERN __iar_program_start
PUBLIC __vector_table
diff --git a/os/ports/IAR/ARMCMx/chcore_v6m.h b/os/ports/IAR/ARMCMx/chcore_v6m.h index 9209fbaf4..a2d1a40d3 100644 --- a/os/ports/IAR/ARMCMx/chcore_v6m.h +++ b/os/ports/IAR/ARMCMx/chcore_v6m.h @@ -226,7 +226,15 @@ struct intctx { * @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out
*/
+#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define port_switch(ntp, otp) _port_switch(ntp, otp)
+#else
+#define port_switch(ntp, otp) { \
+ if ((void *)(__get_SP() - sizeof(struct intctx)) < (void *)(otp + 1)) \
+ chDbgPanic("stack overflow"); \
+ _port_switch(ntp, otp); \
+}
+#endif
#if !defined(__DOXYGEN__)
extern regarm_t _port_saved_pc;
diff --git a/os/ports/IAR/ARMCMx/chcore_v7m.h b/os/ports/IAR/ARMCMx/chcore_v7m.h index ba0c83f5a..ad4abf25b 100644 --- a/os/ports/IAR/ARMCMx/chcore_v7m.h +++ b/os/ports/IAR/ARMCMx/chcore_v7m.h @@ -225,7 +225,15 @@ struct intctx { * @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out
*/
+#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define port_switch(ntp, otp) _port_switch(ntp, otp)
+#else
+#define port_switch(ntp, otp) { \
+ if ((void *)(__get_SP() - sizeof(struct intctx)) < (void *)(otp + 1)) \
+ chDbgPanic("stack overflow"); \
+ _port_switch(ntp, otp); \
+}
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/os/ports/IAR/ARMCMx/cstartup.s b/os/ports/IAR/ARMCMx/cstartup.s index e01cb6dd3..1421ea86e 100644 --- a/os/ports/IAR/ARMCMx/cstartup.s +++ b/os/ports/IAR/ARMCMx/cstartup.s @@ -27,9 +27,16 @@ CONTROL_USE_PSP SET 2 AAPCS INTERWORK, VFP_COMPATIBLE, ROPI
PRESERVE8
- SECTION CSTACK:DATA:NOROOT(3)
SECTION .intvec:CODE:NOROOT(3)
+ SECTION CSTACK:DATA:NOROOT(3)
+ PUBLIC __heap_end__
+__heap_end__:
+
+ SECTION SYSHEAP:DATA:NOROOT(3)
+ PUBLIC __heap_base__
+__heap_base__:
+
PUBLIC __iar_program_start
EXTERN __vector_table
EXTWEAK __iar_init_core
@@ -41,7 +48,7 @@ CONTROL_USE_PSP SET 2 THUMB
__iar_program_start:
cpsid i
- ldr r0, =sfe(CSTACK)
+ ldr r0, =SFE(CSTACK)
msr PSP, r0
movs r0, #CONTROL_MODE_PRIVILEGED | CONTROL_USE_PSP
msr CONTROL, r0
@@ -55,9 +62,4 @@ __iar_program_start: __early_init:
bx lr
- SECTION SYSHEAP:DATA:NOROOT(3)
- PUBLIC __heap_base__
-__heap_base__:
- DS32 2
-
END
|