Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.

Dependents:   denki-yohou_b TestY201 Network-RTOS NTPClient_HelloWorld ... more

Deprecated

This is the mbed 2 rtos library. mbed OS 5 integrates the mbed library with mbed-rtos. With this, we have provided thread safety for all mbed APIs. If you'd like to learn about using mbed OS 5, please see the docs.

Revision:
123:58563e6cba1e
Parent:
120:4dc938e301cc
--- a/rtx/TARGET_CORTEX_M/rt_System.c	Wed Nov 09 12:22:14 2016 -0600
+++ b/rtx/TARGET_CORTEX_M/rt_System.c	Mon Nov 14 17:14:42 2016 -0600
@@ -313,10 +313,22 @@
 /*--------------------------- rt_stk_check ----------------------------------*/
 
 __weak void rt_stk_check (void) {
+#ifdef __MBED_CMSIS_RTOS_CM
+    /* Check for stack overflow. */
+    if (os_tsk.run->task_id == MAIN_THREAD_ID) {
+        // TODO: For the main thread the check should be done against the main heap pointer
+    } else {
+        if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) ||
+            (os_tsk.run->stack[0] != MAGIC_WORD)) {
+            os_error (OS_ERR_STK_OVF);
+        }
+    }
+#else
     if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) ||
         (os_tsk.run->stack[0] != MAGIC_WORD)) {
         os_error (OS_ERR_STK_OVF);
     }
+#endif
 }
 
 /*----------------------------------------------------------------------------