aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-03-19 17:58:45 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-03-19 17:58:45 +0000
commit84cc66dce9b5c8d0cfee1dcb5126f66a60c3f226 (patch)
tree62048535cdd46515dea1ca72eea4f0028e1024e1
parent0653f7de9c9a1562a0a74b73510d26df563b2da3 (diff)
downloadChibiOS-84cc66dce9b5c8d0cfee1dcb5126f66a60c3f226.tar.gz
ChibiOS-84cc66dce9b5c8d0cfee1dcb5126f66a60c3f226.tar.bz2
ChibiOS-84cc66dce9b5c8d0cfee1dcb5126f66a60c3f226.zip
Fixed bugs 3226671 and 3226657.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2833 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v6m.c9
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v6m.h25
-rw-r--r--os/ports/IAR/ARMCMx/chcore_v6m.h2
-rw-r--r--os/ports/RVCT/ARMCMx/chcore_v6m.h2
-rw-r--r--readme.txt4
5 files changed, 30 insertions, 12 deletions
diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.c b/os/ports/GCC/ARMCMx/chcore_v6m.c
index 553277bef..3574c620f 100644
--- a/os/ports/GCC/ARMCMx/chcore_v6m.c
+++ b/os/ports/GCC/ARMCMx/chcore_v6m.c
@@ -110,16 +110,9 @@ void _port_switch_from_isr(void) {
#if !defined(__DOXYGEN__)
__attribute__((naked))
#endif
-void port_switch(Thread *ntp, Thread *otp) {
+void _port_switch(Thread *ntp, Thread *otp) {
register struct intctx *r13 asm ("r13");
- /* Stack overflow check, if enabled.*/
-#if CH_DBG_ENABLE_STACK_CHECK
- if ((void *)(r13 - 1) < (void *)(otp + 1))
- asm volatile ("movs r0, #0 \n\t"
- "b chDbgPanic");
-#endif /* CH_DBG_ENABLE_STACK_CHECK */
-
PUSH_CONTEXT(r13);
otp->p_ctx.r13 = r13;
diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.h b/os/ports/GCC/ARMCMx/chcore_v6m.h
index 1d3198a7f..0212fe6b3 100644
--- a/os/ports/GCC/ARMCMx/chcore_v6m.h
+++ b/os/ports/GCC/ARMCMx/chcore_v6m.h
@@ -82,7 +82,7 @@ struct intctx {
* reduce this value to zero when compiling with optimizations.
*/
#ifndef IDLE_THREAD_STACK_SIZE
-#define IDLE_THREAD_STACK_SIZE 8
+#define IDLE_THREAD_STACK_SIZE 16
#endif
/**
@@ -200,11 +200,32 @@ struct intctx {
#define port_wait_for_interrupt()
#endif
+/**
+ * @brief Performs a context switch between two threads.
+ * @details This is the most critical code in any port, this function
+ * is responsible for the context switch between 2 threads.
+ * @note The implementation of this code affects <b>directly</b> the context
+ * switch performance so optimize here as much as you can.
+ *
+ * @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) { \
+ register struct intctx *r13 asm ("r13"); \
+ if ((void *)(r13 - 1) < (void *)(otp + 1)) \
+ chDbgPanic("stack overflow"); \
+ _port_switch(ntp, otp); \
+}
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
void port_halt(void);
- void port_switch(Thread *ntp, Thread *otp);
+ void _port_switch(Thread *ntp, Thread *otp);
void _port_irq_epilogue(regarm_t lr);
void _port_switch_from_isr(void);
void _port_thread_start(void);
diff --git a/os/ports/IAR/ARMCMx/chcore_v6m.h b/os/ports/IAR/ARMCMx/chcore_v6m.h
index 9e8d27ef7..a2d5ef577 100644
--- a/os/ports/IAR/ARMCMx/chcore_v6m.h
+++ b/os/ports/IAR/ARMCMx/chcore_v6m.h
@@ -82,7 +82,7 @@ struct intctx {
* reduce this value to zero when compiling with optimizations.
*/
#ifndef IDLE_THREAD_STACK_SIZE
-#define IDLE_THREAD_STACK_SIZE 8
+#define IDLE_THREAD_STACK_SIZE 16
#endif
/**
diff --git a/os/ports/RVCT/ARMCMx/chcore_v6m.h b/os/ports/RVCT/ARMCMx/chcore_v6m.h
index 547ad9bf3..970fc3b8d 100644
--- a/os/ports/RVCT/ARMCMx/chcore_v6m.h
+++ b/os/ports/RVCT/ARMCMx/chcore_v6m.h
@@ -82,7 +82,7 @@ struct intctx {
* reduce this value to zero when compiling with optimizations.
*/
#ifndef IDLE_THREAD_STACK_SIZE
-#define IDLE_THREAD_STACK_SIZE 8
+#define IDLE_THREAD_STACK_SIZE 16
#endif
/**
diff --git a/readme.txt b/readme.txt
index ea1ef41ee..e19d8f9d8 100644
--- a/readme.txt
+++ b/readme.txt
@@ -71,6 +71,10 @@
*****************************************************************************
*** 2.3.1 ***
+- FIX: Fixed insufficient idle thread stack in Cortex-M0-GCC port (bug 3226671)
+ (backported to 2.2.3).
+- FIX: Fixed stack checking in Cortex-M0-GCC port (bug 3226657)(backported
+ to 2.2.3).
- FIX: Fixed wrong checks in PAL driver (bug 3224681)(backported to 2.2.3).
- FIX: Fixed wrong checks in I/O Queues (bug 3219197)(backported to 2.2.3).
- FIX: Fixed invalid assertion in adcConvert() (bug 3205410)(backported