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.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Jan 06 16:16:03 2015 +0000
Parent:
58:13a25134ac60
Child:
60:f4d3d8971bc3
Commit message:
Synchronized with git revision 245a60b29caabb42eabdd19658eeac7c3f68313b

Full URL: https://github.com/mbedmicro/mbed/commit/245a60b29caabb42eabdd19658eeac7c3f68313b/

NUCLEO_F072RB/F091RC - adding target to rtos lib and exporter for coide and gcc_arm

Changed in this revision

rtos/Thread.cpp Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_A/RTX_Conf_CA.c Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/RTX_CM_lib.h Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/RTX_Conf_CM.c Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M0/TOOLCHAIN_GCC/HAL_CM0.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M0/TOOLCHAIN_IAR/HAL_CM0.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M0P/TOOLCHAIN_GCC/HAL_CM0.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M0P/TOOLCHAIN_IAR/HAL_CM0.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_GCC/HAL_CM3.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_IAR/HAL_CM3.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M4/TOOLCHAIN_GCC/HAL_CM4.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/TARGET_M4/TOOLCHAIN_IAR/HAL_CM4.s Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/cmsis_os.h Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/os_tcb.h Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/rt_CMSIS.c Show annotated file Show diff for this revision Revisions of this file
rtx/TARGET_CORTEX_M/rt_TypeDef.h Show annotated file Show diff for this revision Revisions of this file
--- a/rtos/Thread.cpp	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtos/Thread.cpp	Tue Jan 06 16:16:03 2015 +0000
@@ -33,10 +33,10 @@
     _thread_def.stacksize = stack_size;
 #ifndef __MBED_CMSIS_RTOS_CA9
     if (stack_pointer != NULL) {
-        _thread_def.stack_pointer = stack_pointer;
+        _thread_def.stack_pointer = (uint32_t*)stack_pointer;
         _dynamic_stack = false;
     } else {
-        _thread_def.stack_pointer = new unsigned char[stack_size];
+        _thread_def.stack_pointer = new uint32_t[stack_size/sizeof(uint32_t)];
         if (_thread_def.stack_pointer == NULL)
             error("Error allocating the stack memory\n");
         _dynamic_stack = true;
--- a/rtx/TARGET_CORTEX_A/RTX_Conf_CA.c	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_A/RTX_Conf_CA.c	Tue Jan 06 16:16:03 2015 +0000
@@ -90,7 +90,7 @@
 //   <1=> Privileged mode
 // <i> Default: Privileged mode
 #ifndef OS_RUNPRIV
- #define OS_RUNPRIV     0
+ #define OS_RUNPRIV     1
 #endif
 
 // </h>
@@ -107,7 +107,11 @@
 //   <i> Defines the timer clock value.
 //   <i> Default: 12000000  (12MHz)
 #ifndef OS_CLOCK
+#  if defined(TARGET_RZ_A1H)
  #define OS_CLOCK       12000000
+#  else
+#    error "no target defined"
+#  endif
 #endif
 
 //   <o>Timer tick value [us] <1-1000000>
@@ -161,7 +165,7 @@
 //   <i> Defines stack size for Timer thread.
 //   <i> Default: 200
 #ifndef OS_TIMERSTKSZ
- #define OS_TIMERSTKSZ  400
+ #define OS_TIMERSTKSZ  WORDS_STACK_SIZE
 #endif
 
 //   <o>Timer Callback Queue size <1-32>
@@ -194,7 +198,7 @@
 //  Define max. number system mutexes that are used to protect 
 //  the arm standard runtime library. For microlib they are not used.
 #ifndef OS_MUTEXCNT
- #define OS_MUTEXCNT    8
+ #define OS_MUTEXCNT    12
 #endif
 
 /*----------------------------------------------------------------------------
@@ -216,10 +220,6 @@
 
   for (;;) {
     /* HERE: include optional user code to be executed when no thread runs.*/
-#if 0
-      __DSB();
-      __WFI();
-#endif
   }
 }
 
--- a/rtx/TARGET_CORTEX_M/RTX_CM_lib.h	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/RTX_CM_lib.h	Tue Jan 06 16:16:03 2015 +0000
@@ -286,6 +286,15 @@
 #elif defined(TARGET_STM32F429ZI)
 #define INITIAL_SP            (0x20030000UL)
 
+#elif defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
+#define INITIAL_SP            (0x20002000UL)
+
+#elif defined(TARGET_STM32F072RB)
+#define INITIAL_SP            (0x20004000UL)
+
+#elif defined(TARGET_STM32F091RC)
+#define INITIAL_SP            (0x20008000UL)
+
 #else
 #error "no target defined"
 
--- a/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c	Tue Jan 06 16:16:03 2015 +0000
@@ -50,12 +50,13 @@
 //   <i> Default: 6
 #ifndef OS_TASKCNT
 #  if   defined(TARGET_LPC1768) || defined(TARGET_LPC2368)   || defined(TARGET_LPC4088) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347) || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\
-   || defined(TARGET_KL46Z) || defined(TARGET_KL43Z)  || defined(TARGET_STM32F407) || defined(TARGET_F407VG)  || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) || defined(TARGET_NRF51822) || defined(TARGET_STM32F411RE) \
-   || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI)
+   || defined(TARGET_KL46Z) || defined(TARGET_KL43Z)  || defined(TARGET_STM32F407) || defined(TARGET_F407VG)  || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) \
+   || defined(TARGET_NRF51822) || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI)
 #    define OS_TASKCNT         14
 #  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \
    || defined(TARGET_LPC812)   || defined(TARGET_KL25Z)         || defined(TARGET_KL05Z)        || defined(TARGET_STM32F100RB)  || defined(TARGET_STM32F051R8) \
-   || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8)
+   || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) \
+   || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC)
 #    define OS_TASKCNT         6
 #  else
 #    error "no target defined"
@@ -65,13 +66,15 @@
 //   <o>Scheduler (+ interrupts) stack size [bytes] <64-4096:8><#/4>
 #ifndef OS_SCHEDULERSTKSIZE
 #  if   defined(TARGET_LPC1768) || defined(TARGET_LPC2368)   || defined(TARGET_LPC4088) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347)  || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\
-   || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG)  || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) || defined(TARGET_NRF51822) || defined(TARGET_STM32F411RE) \
-   || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI)
+   || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG)  || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) \
+   || defined(TARGET_NRF51822) || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI)
 #      define OS_SCHEDULERSTKSIZE    256
 #  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO)  || defined(TARGET_LPC1114) \
    || defined(TARGET_LPC812)   || defined(TARGET_KL25Z)         || defined(TARGET_KL05Z)        || defined(TARGET_STM32F100RB)  || defined(TARGET_STM32F051R8) \
-   || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8)
+   || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC)
 #      define OS_SCHEDULERSTKSIZE    128
+#  elif defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
+#      define OS_SCHEDULERSTKSIZE    112
 #  else
 #    error "no target defined"
 #  endif
@@ -116,10 +119,11 @@
 #  if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
 #    define OS_CLOCK       96000000
 
-#  elif defined(TARGET_LPC1347) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8)
+#  elif defined(TARGET_LPC1347) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8)
 #    define OS_CLOCK       72000000
 
-#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO)  || defined(TARGET_LPC1114) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F051R8) || defined(TARGET_LPC11U68)
+#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO)  || defined(TARGET_LPC1114) || defined(TARGET_KL25Z) \
+     || defined(TARGET_KL05Z) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F051R8) || defined(TARGET_LPC11U68) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC)
 #    define OS_CLOCK       48000000
 
 #  elif defined(TARGET_LPC812)
@@ -155,6 +159,12 @@
 #elif defined(TARGET_STM32F429ZI)
 #    define OS_CLOCK       168000000
 
+#elif defined(TARGET_STM32F302R8)
+#    define OS_CLOCK       64000000
+
+#elif defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
+#    define OS_CLOCK       32000000
+
 #  else
 #    error "no target defined"
 #  endif
--- a/rtx/TARGET_CORTEX_M/TARGET_M0/TOOLCHAIN_GCC/HAL_CM0.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M0/TOOLCHAIN_GCC/HAL_CM0.s	Tue Jan 06 16:16:03 2015 +0000
@@ -35,7 +35,7 @@
         .file   "HAL_CM0.S"
         .syntax unified
 
-        .equ    TCB_TSTACK, 36
+        .equ    TCB_TSTACK, 40
 
 
 /*----------------------------------------------------------------------------
--- a/rtx/TARGET_CORTEX_M/TARGET_M0/TOOLCHAIN_IAR/HAL_CM0.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M0/TOOLCHAIN_IAR/HAL_CM0.s	Tue Jan 06 16:16:03 2015 +0000
@@ -34,7 +34,7 @@
 
         NAME    HAL_CM0.S
 
-        #define TCB_TSTACK 36
+        #define TCB_TSTACK 40
 
         EXTERN  os_flags
         EXTERN  os_tsk
--- a/rtx/TARGET_CORTEX_M/TARGET_M0P/TOOLCHAIN_GCC/HAL_CM0.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M0P/TOOLCHAIN_GCC/HAL_CM0.s	Tue Jan 06 16:16:03 2015 +0000
@@ -35,7 +35,7 @@
         .file   "HAL_CM0.S"
         .syntax unified
 
-        .equ    TCB_TSTACK, 36
+        .equ    TCB_TSTACK, 40
 
 
 /*----------------------------------------------------------------------------
--- a/rtx/TARGET_CORTEX_M/TARGET_M0P/TOOLCHAIN_IAR/HAL_CM0.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M0P/TOOLCHAIN_IAR/HAL_CM0.s	Tue Jan 06 16:16:03 2015 +0000
@@ -34,7 +34,7 @@
 
         NAME    HAL_CM0.S
 
-        #define TCB_TSTACK 36
+        #define TCB_TSTACK 40
 
         EXTERN  os_flags
         EXTERN  os_tsk
--- a/rtx/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_GCC/HAL_CM3.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_GCC/HAL_CM3.s	Tue Jan 06 16:16:03 2015 +0000
@@ -35,7 +35,7 @@
         .file   "HAL_CM3.S"
         .syntax unified
 
-        .equ    TCB_TSTACK, 36
+        .equ    TCB_TSTACK, 40
 
 
 /*----------------------------------------------------------------------------
--- a/rtx/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_IAR/HAL_CM3.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_IAR/HAL_CM3.s	Tue Jan 06 16:16:03 2015 +0000
@@ -34,7 +34,7 @@
 
         NAME    HAL_CM3.S
 
-        #define TCB_TSTACK 36
+        #define TCB_TSTACK 40
 
         EXTERN  os_flags
         EXTERN  os_tsk
--- a/rtx/TARGET_CORTEX_M/TARGET_M4/TOOLCHAIN_GCC/HAL_CM4.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M4/TOOLCHAIN_GCC/HAL_CM4.s	Tue Jan 06 16:16:03 2015 +0000
@@ -36,7 +36,7 @@
         .syntax unified
 
         .equ    TCB_STACKF, 32
-        .equ    TCB_TSTACK, 36
+        .equ    TCB_TSTACK, 40
 
 
 /*----------------------------------------------------------------------------
--- a/rtx/TARGET_CORTEX_M/TARGET_M4/TOOLCHAIN_IAR/HAL_CM4.s	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/TARGET_M4/TOOLCHAIN_IAR/HAL_CM4.s	Tue Jan 06 16:16:03 2015 +0000
@@ -35,7 +35,7 @@
         NAME    HAL_CM4.S
 
         #define TCB_STACKF 32
-        #define TCB_TSTACK 36
+        #define TCB_TSTACK 40
 
         EXTERN  os_flags
         EXTERN  os_tsk
--- a/rtx/TARGET_CORTEX_M/cmsis_os.h	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/cmsis_os.h	Tue Jan 06 16:16:03 2015 +0000
@@ -243,7 +243,7 @@
   os_pthread               pthread;      ///< start address of thread function
   osPriority             tpriority;      ///< initial thread priority
   uint32_t               stacksize;      ///< stack size requirements in bytes
-  unsigned char         *stack_pointer;  ///< pointer to the stack memory block
+  uint32_t               *stack_pointer;  ///< pointer to the stack memory block
   struct OS_TCB          tcb;
 } osThreadDef_t;
 
@@ -337,7 +337,7 @@
 extern osThreadDef_t os_thread_def_##name
 #else                            // define the object
 #define osThreadDef(name, priority, stacksz)  \
-unsigned char os_thread_def_stack_##name [stacksz]; \
+uint32_t os_thread_def_stack_##name [stacksz / sizeof(uint32_t)]; \
 osThreadDef_t os_thread_def_##name = \
 { (name), (priority), (stacksz), (os_thread_def_stack_##name)}
 #endif
--- a/rtx/TARGET_CORTEX_M/os_tcb.h	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/os_tcb.h	Tue Jan 06 16:16:03 2015 +0000
@@ -32,8 +32,9 @@
 
   /* Hardware dependant part: specific for CM processor                      */
   U8     stack_frame;             /* Stack frame: 0=Basic, 1=Extended        */
-  U8     reserved;
-  U16    priv_stack;              /* Private stack size in bytes             */
+  U8     reserved1;
+  U16    reserved2;
+  U32    priv_stack;              /* Private stack size in bytes             */
   U32    tsk_stack;               /* Current task Stack pointer (R13)        */
   U32    *stack;                  /* Pointer to Task Stack memory block      */
 
--- a/rtx/TARGET_CORTEX_M/rt_CMSIS.c	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/rt_CMSIS.c	Tue Jan 06 16:16:03 2015 +0000
@@ -547,18 +547,19 @@
   U8 priority = thread_def->tpriority - osPriorityIdle + 1;
   P_TCB task_context = &thread_def->tcb;
 
-  /* If "size != 0" use a private user provided stack. */
+  /* Utilize the user provided stack. */
   task_context->stack      = (U32*)thread_def->stack_pointer;
   task_context->priv_stack = thread_def->stacksize;
-  /* Pass parameter 'argv' to 'rt_init_context' */
-  task_context->msg = argument;
-  /* For 'size == 0' system allocates the user stack from the memory pool. */
-  rt_init_context (task_context, priority, (FUNCP)thread_def->pthread);
-
   /* Find a free entry in 'os_active_TCB' table. */
   OS_TID tsk = rt_get_TID ();
   os_active_TCB[tsk-1] = task_context;
   task_context->task_id = tsk;
+  /* Pass parameter 'argv' to 'rt_init_context' */
+  task_context->msg = argument;
+  /* Initialize thread context structure, including the thread's stack. */
+  rt_init_context (task_context, priority, (FUNCP)thread_def->pthread);
+
+  /* Dispatch this task to the scheduler for execution. */
   DBG_TASK_NOTIFY(task_context, __TRUE);
   rt_dispatch (task_context);
 
--- a/rtx/TARGET_CORTEX_M/rt_TypeDef.h	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/rt_TypeDef.h	Tue Jan 06 16:16:03 2015 +0000
@@ -41,7 +41,7 @@
 typedef U32     OS_RESULT;
 
 #define TCB_STACKF      32        /* 'stack_frame' offset                    */
-#define TCB_TSTACK      36        /* 'tsk_stack' offset                      */
+#define TCB_TSTACK      40        /* 'tsk_stack' offset                      */
 
 typedef struct OS_PSFE {          /* Post Service Fifo Entry                 */
   void  *id;                      /* Object Identification                   */