2 * Copyright (c) 2013-2021 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * -----------------------------------------------------------------------------
22 * Project: CMSIS-RTOS RTX
23 * Title: RTX Configuration definitions
25 * -----------------------------------------------------------------------------
32 #include "RTE_Components.h"
33 #ifdef RTE_RTX_CONFIG_H
34 #include RTE_RTX_CONFIG_H
38 //-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
40 // <h>System Configuration
41 // =======================
43 // <o>Global Dynamic Memory size [bytes] <0-1073741824:8>
44 // <i> Defines the combined global dynamic memory size.
46 #ifndef OS_DYNAMIC_MEM_SIZE
47 #define OS_DYNAMIC_MEM_SIZE 24000
50 // <o>Kernel Tick Frequency [Hz] <1-1000000>
51 // <i> Defines base time unit for delays and timeouts.
52 // <i> Default: 1000 (1ms tick)
54 #define OS_TICK_FREQ 1000
57 // <e>Round-Robin Thread switching
58 // <i> Enables Round-Robin Thread switching.
59 #ifndef OS_ROBIN_ENABLE
60 #define OS_ROBIN_ENABLE 1
63 // <o>Round-Robin Timeout <1-1000>
64 // <i> Defines how many ticks a thread will execute before a thread switch.
66 #ifndef OS_ROBIN_TIMEOUT
67 #define OS_ROBIN_TIMEOUT 5
73 // <4=> 4 entries <8=> 8 entries <12=> 12 entries <16=> 16 entries
74 // <24=> 24 entries <32=> 32 entries <48=> 48 entries <64=> 64 entries
75 // <96=> 96 entries <128=> 128 entries <196=> 196 entries <256=> 256 entries
76 // <i> RTOS Functions called from ISR store requests to this buffer.
77 // <i> Default: 16 entries
78 #ifndef OS_ISR_FIFO_QUEUE
79 #define OS_ISR_FIFO_QUEUE 16
82 // <q>Object Memory usage counters
83 // <i> Enables object memory usage counters (requires RTX source variant).
84 #ifndef OS_OBJ_MEM_USAGE
85 #define OS_OBJ_MEM_USAGE 0
90 // <h>Thread Configuration
91 // =======================
93 // <e>Object specific Memory allocation
94 // <i> Enables object specific memory allocation.
95 #ifndef OS_THREAD_OBJ_MEM
96 #define OS_THREAD_OBJ_MEM 0
99 // <o>Number of user Threads <1-1000>
100 // <i> Defines maximum number of user threads that can be active at the same time.
101 // <i> Applies to user threads with system provided memory for control blocks.
102 #ifndef OS_THREAD_NUM
103 #define OS_THREAD_NUM 1
106 // <o>Number of user Threads with default Stack size <0-1000>
107 // <i> Defines maximum number of user threads with default stack size.
108 // <i> Applies to user threads with zero stack size specified.
109 #ifndef OS_THREAD_DEF_STACK_NUM
110 #define OS_THREAD_DEF_STACK_NUM 0
113 // <o>Total Stack size [bytes] for user Threads with user-provided Stack size <0-1073741824:8>
114 // <i> Defines the combined stack size for user threads with user-provided stack size.
115 // <i> Applies to user threads with user-provided stack size and system provided memory for stack.
117 #ifndef OS_THREAD_USER_STACK_SIZE
118 #define OS_THREAD_USER_STACK_SIZE 0
123 // <o>Default Thread Stack size [bytes] <96-1073741824:8>
124 // <i> Defines stack size for threads with zero stack size specified.
126 #ifndef OS_STACK_SIZE
127 #define OS_STACK_SIZE 3072
130 // <o>Idle Thread Stack size [bytes] <72-1073741824:8>
131 // <i> Defines stack size for Idle thread.
133 #ifndef OS_IDLE_THREAD_STACK_SIZE
134 #define OS_IDLE_THREAD_STACK_SIZE 256
137 // <o>Idle Thread TrustZone Module Identifier
138 // <i> Defines TrustZone Thread Context Management Identifier.
139 // <i> Applies only to cores with TrustZone technology.
140 // <i> Default: 0 (not used)
141 #ifndef OS_IDLE_THREAD_TZ_MOD_ID
142 #define OS_IDLE_THREAD_TZ_MOD_ID 0
145 // <q>Stack overrun checking
146 // <i> Enables stack overrun check at thread switch (requires RTX source variant).
147 // <i> Enabling this option increases slightly the execution time of a thread switch.
148 #ifndef OS_STACK_CHECK
149 #define OS_STACK_CHECK 1
152 // <q>Stack usage watermark
153 // <i> Initializes thread stack with watermark pattern for analyzing stack usage.
154 // <i> Enabling this option increases significantly the execution time of thread creation.
155 #ifndef OS_STACK_WATERMARK
156 #define OS_STACK_WATERMARK 0
159 // <o>Processor mode for Thread execution
160 // <0=> Unprivileged mode
161 // <1=> Privileged mode
162 // <i> Default: Privileged mode
163 #ifndef OS_PRIVILEGE_MODE
164 #define OS_PRIVILEGE_MODE 1
169 // <h>Timer Configuration
170 // ======================
172 // <e>Object specific Memory allocation
173 // <i> Enables object specific memory allocation.
174 #ifndef OS_TIMER_OBJ_MEM
175 #define OS_TIMER_OBJ_MEM 0
178 // <o>Number of Timer objects <1-1000>
179 // <i> Defines maximum number of objects that can be active at the same time.
180 // <i> Applies to objects with system provided memory for control blocks.
182 #define OS_TIMER_NUM 1
187 // <o>Timer Thread Priority
189 // <16=> Below Normal <24=> Normal <32=> Above Normal
192 // <i> Defines priority for timer thread
194 #ifndef OS_TIMER_THREAD_PRIO
195 #define OS_TIMER_THREAD_PRIO 40
198 // <o>Timer Thread Stack size [bytes] <0-1073741824:8>
199 // <i> Defines stack size for Timer thread.
200 // <i> May be set to 0 when timers are not used.
202 #ifndef OS_TIMER_THREAD_STACK_SIZE
203 #define OS_TIMER_THREAD_STACK_SIZE 256
206 // <o>Timer Thread TrustZone Module Identifier
207 // <i> Defines TrustZone Thread Context Management Identifier.
208 // <i> Applies only to cores with TrustZone technology.
209 // <i> Default: 0 (not used)
210 #ifndef OS_TIMER_THREAD_TZ_MOD_ID
211 #define OS_TIMER_THREAD_TZ_MOD_ID 0
214 // <o>Timer Callback Queue entries <0-256>
215 // <i> Number of concurrent active timer callback functions.
216 // <i> May be set to 0 when timers are not used.
218 #ifndef OS_TIMER_CB_QUEUE
219 #define OS_TIMER_CB_QUEUE 4
224 // <h>Event Flags Configuration
225 // ============================
227 // <e>Object specific Memory allocation
228 // <i> Enables object specific memory allocation.
229 #ifndef OS_EVFLAGS_OBJ_MEM
230 #define OS_EVFLAGS_OBJ_MEM 0
233 // <o>Number of Event Flags objects <1-1000>
234 // <i> Defines maximum number of objects that can be active at the same time.
235 // <i> Applies to objects with system provided memory for control blocks.
236 #ifndef OS_EVFLAGS_NUM
237 #define OS_EVFLAGS_NUM 1
244 // <h>Mutex Configuration
245 // ======================
247 // <e>Object specific Memory allocation
248 // <i> Enables object specific memory allocation.
249 #ifndef OS_MUTEX_OBJ_MEM
250 #define OS_MUTEX_OBJ_MEM 0
253 // <o>Number of Mutex objects <1-1000>
254 // <i> Defines maximum number of objects that can be active at the same time.
255 // <i> Applies to objects with system provided memory for control blocks.
257 #define OS_MUTEX_NUM 1
264 // <h>Semaphore Configuration
265 // ==========================
267 // <e>Object specific Memory allocation
268 // <i> Enables object specific memory allocation.
269 #ifndef OS_SEMAPHORE_OBJ_MEM
270 #define OS_SEMAPHORE_OBJ_MEM 0
273 // <o>Number of Semaphore objects <1-1000>
274 // <i> Defines maximum number of objects that can be active at the same time.
275 // <i> Applies to objects with system provided memory for control blocks.
276 #ifndef OS_SEMAPHORE_NUM
277 #define OS_SEMAPHORE_NUM 1
284 // <h>Memory Pool Configuration
285 // ============================
287 // <e>Object specific Memory allocation
288 // <i> Enables object specific memory allocation.
289 #ifndef OS_MEMPOOL_OBJ_MEM
290 #define OS_MEMPOOL_OBJ_MEM 0
293 // <o>Number of Memory Pool objects <1-1000>
294 // <i> Defines maximum number of objects that can be active at the same time.
295 // <i> Applies to objects with system provided memory for control blocks.
296 #ifndef OS_MEMPOOL_NUM
297 #define OS_MEMPOOL_NUM 1
300 // <o>Data Storage Memory size [bytes] <0-1073741824:8>
301 // <i> Defines the combined data storage memory size.
302 // <i> Applies to objects with system provided memory for data storage.
304 #ifndef OS_MEMPOOL_DATA_SIZE
305 #define OS_MEMPOOL_DATA_SIZE 0
312 // <h>Message Queue Configuration
313 // ==============================
315 // <e>Object specific Memory allocation
316 // <i> Enables object specific memory allocation.
317 #ifndef OS_MSGQUEUE_OBJ_MEM
318 #define OS_MSGQUEUE_OBJ_MEM 0
321 // <o>Number of Message Queue objects <1-1000>
322 // <i> Defines maximum number of objects that can be active at the same time.
323 // <i> Applies to objects with system provided memory for control blocks.
324 #ifndef OS_MSGQUEUE_NUM
325 #define OS_MSGQUEUE_NUM 1
328 // <o>Data Storage Memory size [bytes] <0-1073741824:8>
329 // <i> Defines the combined data storage memory size.
330 // <i> Applies to objects with system provided memory for data storage.
332 #ifndef OS_MSGQUEUE_DATA_SIZE
333 #define OS_MSGQUEUE_DATA_SIZE 0
340 // <h>Event Recorder Configuration
341 // ===============================
343 // <e>Global Initialization
344 // <i> Initialize Event Recorder during 'osKernelInitialize'.
346 #define OS_EVR_INIT 1
349 // <q>Start recording
350 // <i> Start event recording after initialization.
352 #define OS_EVR_START 1
355 // <h>Global Event Filter Setup
356 // <i> Initial recording level applied to all components.
358 // <o.1>API function call events
359 // <o.2>Operation events
360 // <o.3>Detailed operation events
363 #define OS_EVR_LEVEL 0x00U
366 // <h>RTOS Event Filter Setup
367 // <i> Recording levels for RTX components.
368 // <i> Only applicable if events for the respective component are generated.
370 // <e.7>Memory Management
371 // <i> Recording level for Memory Management events.
373 // <o.1>API function call events
374 // <o.2>Operation events
375 // <o.3>Detailed operation events
377 #ifndef OS_EVR_MEMORY_LEVEL
378 #define OS_EVR_MEMORY_LEVEL 0x81U
382 // <i> Recording level for Kernel events.
384 // <o.1>API function call events
385 // <o.2>Operation events
386 // <o.3>Detailed operation events
388 #ifndef OS_EVR_KERNEL_LEVEL
389 #define OS_EVR_KERNEL_LEVEL 0x81U
393 // <i> Recording level for Thread events.
395 // <o.1>API function call events
396 // <o.2>Operation events
397 // <o.3>Detailed operation events
399 #ifndef OS_EVR_THREAD_LEVEL
400 #define OS_EVR_THREAD_LEVEL 0x85U
404 // <i> Recording level for Generic Wait events.
406 // <o.1>API function call events
407 // <o.2>Operation events
408 // <o.3>Detailed operation events
410 #ifndef OS_EVR_WAIT_LEVEL
411 #define OS_EVR_WAIT_LEVEL 0x81U
415 // <i> Recording level for Thread Flags events.
417 // <o.1>API function call events
418 // <o.2>Operation events
419 // <o.3>Detailed operation events
421 #ifndef OS_EVR_THFLAGS_LEVEL
422 #define OS_EVR_THFLAGS_LEVEL 0x81U
426 // <i> Recording level for Event Flags events.
428 // <o.1>API function call events
429 // <o.2>Operation events
430 // <o.3>Detailed operation events
432 #ifndef OS_EVR_EVFLAGS_LEVEL
433 #define OS_EVR_EVFLAGS_LEVEL 0x81U
437 // <i> Recording level for Timer events.
439 // <o.1>API function call events
440 // <o.2>Operation events
441 // <o.3>Detailed operation events
443 #ifndef OS_EVR_TIMER_LEVEL
444 #define OS_EVR_TIMER_LEVEL 0x81U
448 // <i> Recording level for Mutex events.
450 // <o.1>API function call events
451 // <o.2>Operation events
452 // <o.3>Detailed operation events
454 #ifndef OS_EVR_MUTEX_LEVEL
455 #define OS_EVR_MUTEX_LEVEL 0x81U
459 // <i> Recording level for Semaphore events.
461 // <o.1>API function call events
462 // <o.2>Operation events
463 // <o.3>Detailed operation events
465 #ifndef OS_EVR_SEMAPHORE_LEVEL
466 #define OS_EVR_SEMAPHORE_LEVEL 0x81U
470 // <i> Recording level for Memory Pool events.
472 // <o.1>API function call events
473 // <o.2>Operation events
474 // <o.3>Detailed operation events
476 #ifndef OS_EVR_MEMPOOL_LEVEL
477 #define OS_EVR_MEMPOOL_LEVEL 0x81U
480 // <e.7>Message Queue
481 // <i> Recording level for Message Queue events.
483 // <o.1>API function call events
484 // <o.2>Operation events
485 // <o.3>Detailed operation events
487 #ifndef OS_EVR_MSGQUEUE_LEVEL
488 #define OS_EVR_MSGQUEUE_LEVEL 0x81U
495 // <h>RTOS Event Generation
496 // <i> Enables event generation for RTX components (requires RTX source variant).
498 // <q>Memory Management
499 // <i> Enables Memory Management event generation.
500 #ifndef OS_EVR_MEMORY
501 #define OS_EVR_MEMORY 1
505 // <i> Enables Kernel event generation.
506 #ifndef OS_EVR_KERNEL
507 #define OS_EVR_KERNEL 1
511 // <i> Enables Thread event generation.
512 #ifndef OS_EVR_THREAD
513 #define OS_EVR_THREAD 1
517 // <i> Enables Generic Wait event generation.
519 #define OS_EVR_WAIT 1
523 // <i> Enables Thread Flags event generation.
524 #ifndef OS_EVR_THFLAGS
525 #define OS_EVR_THFLAGS 1
529 // <i> Enables Event Flags event generation.
530 #ifndef OS_EVR_EVFLAGS
531 #define OS_EVR_EVFLAGS 1
535 // <i> Enables Timer event generation.
537 #define OS_EVR_TIMER 1
541 // <i> Enables Mutex event generation.
543 #define OS_EVR_MUTEX 1
547 // <i> Enables Semaphore event generation.
548 #ifndef OS_EVR_SEMAPHORE
549 #define OS_EVR_SEMAPHORE 1
553 // <i> Enables Memory Pool event generation.
554 #ifndef OS_EVR_MEMPOOL
555 #define OS_EVR_MEMPOOL 1
559 // <i> Enables Message Queue event generation.
560 #ifndef OS_EVR_MSGQUEUE
561 #define OS_EVR_MSGQUEUE 1
568 // Number of Threads which use standard C/C++ library libspace
569 // (when thread specific memory allocation is not used).
570 #if (OS_THREAD_OBJ_MEM == 0)
571 #ifndef OS_THREAD_LIBSPACE_NUM
572 #define OS_THREAD_LIBSPACE_NUM 4
575 #define OS_THREAD_LIBSPACE_NUM OS_THREAD_NUM
578 //------------- <<< end of configuration section >>> ---------------------------
580 #endif // RTX_CONFIG_H_