Skip to content

Commit dcd863b

Browse files
authored
Merge pull request #12736 from Patater/rtosv2-compat
rtos: Improve CMSIS-RTOSv2 app compatibility
2 parents 7b0c38a + fa5a954 commit dcd863b

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

rtos/source/TARGET_CORTEX/mbed_lib.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,38 @@
2525
"idle-thread-stack-size-debug-extra": {
2626
"help": "Additional size to add to the idle thread when code compilation optimisation is disabled",
2727
"value": 0
28+
},
29+
"thread-num": {
30+
"help": "Maximum number of CMSIS-RTOSv2 object-pool threads that can be active at the same time",
31+
"value": 0
32+
},
33+
"thread-user-stack-size": {
34+
"help": "The total memory available for all CMSIS-RTOSv2 object-pool thread stacks combined",
35+
"value": 0
36+
},
37+
"timer-num": {
38+
"help": "Maximum number of CMSIS-RTOSv2 object-pool timers that can be active at the same time",
39+
"value": 0
40+
},
41+
"evflags-num": {
42+
"help": "Maximum number of CMSIS-RTOSv2 object-pool event flag objects that can be active at the same time",
43+
"value": 0
44+
},
45+
"mutex-num": {
46+
"help": "Maximum number of CMSIS-RTOSv2 object-pool mutexes that can be active at the same time",
47+
"value": 0
48+
},
49+
"semaphore-num": {
50+
"help": "Maximum number of CMSIS-RTOSv2 object-pool semaphores that can be active at the same time",
51+
"value": 0
52+
},
53+
"msgqueue-num": {
54+
"help": "Maximum number of CMSIS-RTOSv2 object-pool message queues that can be active at the same time",
55+
"value": 0
56+
},
57+
"msgqueue-data-size": {
58+
"help": "The total memory available for all CMSIS-RTOSv2 object-pool message queues combined",
59+
"value": 0
2860
}
2961
},
3062
"macros": ["_RTE_"],

rtos/source/TARGET_CORTEX/mbed_rtx_conf.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,62 @@
6060
#define OS_IDLE_THREAD_STACK_SIZE (MBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE + EXTRA_IDLE_STACK + EXTRA_IDLE_STACK_DEBUG)
6161
#endif
6262

63+
// The number of threads available to applications that need to use
64+
// CMSIS-RTOSv2 Object-specific Memory Pools
65+
#if MBED_CONF_RTOS_THREAD_NUM > 0
66+
#define OS_THREAD_OBJ_MEM 1
67+
#define OS_THREAD_NUM MBED_CONF_RTOS_THREAD_NUM
68+
#endif
69+
70+
// The total amount of memory for all thread stacks combined available to
71+
// applications that need to use CMSIS-RTOSv2 Object-specific Memory Pools for
72+
// threads
73+
#if MBED_CONF_RTOS_THREAD_USER_STACK_SIZE > 0
74+
#define OS_THREAD_USER_STACK_SIZE MBED_CONF_RTOS_THREAD_USER_STACK_SIZE
75+
#endif
76+
77+
// The number of timers available to applications that need to use CMSIS-RTOSv2
78+
// Object-specific Memory Pools
79+
#if MBED_CONF_RTOS_TIMER_NUM > 0
80+
#define OS_TIMER_OBJ_MEM 1
81+
#define OS_TIMER_NUM MBED_CONF_RTOS_TIMER_NUM
82+
#endif
83+
84+
// The number of event flag objects available to applications that need to use
85+
// CMSIS-RTOSv2 Object-specific Memory Pools
86+
#if MBED_CONF_RTOS_EVFLAGS_NUM > 0
87+
#define OS_EVFLAGS_OBJ_MEM 1
88+
#define OS_EVFLAGS_NUM MBED_CONF_RTOS_EVFLAGS_NUM
89+
#endif
90+
91+
// The number of mutexes available to applications that need to use
92+
// CMSIS-RTOSv2 Object-specific Memory Pools
93+
#if MBED_CONF_RTOS_MUTEX_NUM > 0
94+
#define OS_MUTEX_OBJ_MEM 1
95+
#define OS_MUTEX_NUM MBED_CONF_RTOS_MUTEX_NUM
96+
#endif
97+
98+
// The number of semaphores available to applications that need to use
99+
// CMSIS-RTOSv2 Object-specific Memory Pools
100+
#if MBED_CONF_RTOS_SEMAPHORE_NUM > 0
101+
#define OS_SEMAPHORE_OBJ_MEM 1
102+
#define OS_SEMAPHORE_NUM MBED_CONF_RTOS_SEMAPHORE_NUM
103+
#endif
104+
105+
// The number of message queues available to applications that need to use
106+
// CMSIS-RTOSv2 Object-specific Memory Pools
107+
#if MBED_CONF_RTOS_MSGQUEUE_NUM > 0
108+
#define OS_MSGQUEUE_OBJ_MEM 1
109+
#define OS_MSGQUEUE_NUM MBED_CONF_RTOS_MSGQUEUE_NUM
110+
#endif
111+
112+
// The total amount of memory for all message queues combined available to
113+
// applications that need to use CMSIS-RTOSv2 Object-specific Memory Pools for
114+
// message queues
115+
#if MBED_CONF_RTOS_MSGQUEUE_DATA_SIZE > 0
116+
#define OS_MSGQUEUE_DATA_SIZE MBED_CONF_RTOS_MSGQUEUE_DATA_SIZE
117+
#endif
118+
63119
#define OS_DYNAMIC_MEM_SIZE 0
64120

65121
#if defined(OS_TICK_FREQ) && (OS_TICK_FREQ != 1000)

0 commit comments

Comments
 (0)