2 * Copyright (c) 2013-2019 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 #ifndef RTE_Compiler_EventRecorder
42 //-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
44 // <h>System Configuration
45 // =======================
47 // <o>Global Dynamic Memory size [bytes] <0-1073741824:8>
48 // <i> Defines the combined global dynamic memory size.
50 #ifndef OS_DYNAMIC_MEM_SIZE
51 #define OS_DYNAMIC_MEM_SIZE 8192
54 // <o>Kernel Tick Frequency [Hz] <1-1000000>
55 // <i> Defines base time unit for delays and timeouts.
56 // <i> Default: 1000 (1ms tick)
58 #define OS_TICK_FREQ 1000
61 // <e>Round-Robin Thread switching
62 // <i> Enables Round-Robin Thread switching.
63 #ifndef OS_ROBIN_ENABLE
64 #define OS_ROBIN_ENABLE 1
67 // <o>Round-Robin Timeout <1-1000>
68 // <i> Defines how many ticks a thread will execute before a thread switch.
70 #ifndef OS_ROBIN_TIMEOUT
71 #define OS_ROBIN_TIMEOUT 5
77 // <4=> 4 entries <8=> 8 entries <12=> 12 entries <16=> 16 entries
78 // <24=> 24 entries <32=> 32 entries <48=> 48 entries <64=> 64 entries
79 // <96=> 96 entries <128=> 128 entries <196=> 196 entries <256=> 256 entries
80 // <i> RTOS Functions called from ISR store requests to this buffer.
81 // <i> Default: 16 entries
82 #ifndef OS_ISR_FIFO_QUEUE
83 #define OS_ISR_FIFO_QUEUE 16
86 // <q>Object Memory usage counters
87 // <i> Enables object memory usage counters (requires RTX source variant).
88 #ifndef OS_OBJ_MEM_USAGE
89 #define OS_OBJ_MEM_USAGE 0
94 // <h>Thread Configuration
95 // =======================
97 // <e>Object specific Memory allocation
98 // <i> Enables object specific memory allocation.
99 #ifndef OS_THREAD_OBJ_MEM
100 #define OS_THREAD_OBJ_MEM 0
103 // <o>Number of user Threads <1-1000>
104 // <i> Defines maximum number of user threads that can be active at the same time.
105 // <i> Applies to user threads with system provided memory for control blocks.
106 #ifndef OS_THREAD_NUM
107 #define OS_THREAD_NUM 1
110 // <o>Number of user Threads with default Stack size <0-1000>
111 // <i> Defines maximum number of user threads with default stack size.
112 // <i> Applies to user threads with zero stack size specified.
113 #ifndef OS_THREAD_DEF_STACK_NUM
114 #define OS_THREAD_DEF_STACK_NUM 0
117 // <o>Total Stack size [bytes] for user Threads with user-provided Stack size <0-1073741824:8>
118 // <i> Defines the combined stack size for user threads with user-provided stack size.
119 // <i> Applies to user threads with user-provided stack size and system provided memory for stack.
121 #ifndef OS_THREAD_USER_STACK_SIZE
122 #define OS_THREAD_USER_STACK_SIZE 0
127 // <o>Default Thread Stack size [bytes] <96-1073741824:8>
128 // <i> Defines stack size for threads with zero stack size specified.
130 #ifndef OS_STACK_SIZE
131 #define OS_STACK_SIZE 2048
134 // <o>Idle Thread Stack size [bytes] <72-1073741824:8>
135 // <i> Defines stack size for Idle thread.
137 #ifndef OS_IDLE_THREAD_STACK_SIZE
138 #define OS_IDLE_THREAD_STACK_SIZE 512
141 // <o>Idle Thread TrustZone Module Identifier
142 // <i> Defines TrustZone Thread Context Management Identifier.
143 // <i> Applies only to cores with TrustZone technology.
144 // <i> Default: 0 (not used)
145 #ifndef OS_IDLE_THREAD_TZ_MOD_ID
146 #define OS_IDLE_THREAD_TZ_MOD_ID 0
149 // <q>Stack overrun checking
150 // <i> Enables stack overrun check at thread switch.
151 // <i> Enabling this option increases slightly the execution time of a thread switch.
152 #ifndef OS_STACK_CHECK
153 #define OS_STACK_CHECK 1
156 // <q>Stack usage watermark
157 // <i> Initializes thread stack with watermark pattern for analyzing stack usage.
158 // <i> Enabling this option increases significantly the execution time of thread creation.
159 #ifndef OS_STACK_WATERMARK
160 #define OS_STACK_WATERMARK 0
163 // <o>Processor mode for Thread execution
164 // <0=> Unprivileged mode
165 // <1=> Privileged mode
166 // <i> Default: Privileged mode
167 #ifndef OS_PRIVILEGE_MODE
168 #define OS_PRIVILEGE_MODE 1
173 // <h>Timer Configuration
174 // ======================
176 // <e>Object specific Memory allocation
177 // <i> Enables object specific memory allocation.
178 #ifndef OS_TIMER_OBJ_MEM
179 #define OS_TIMER_OBJ_MEM 0
182 // <o>Number of Timer objects <1-1000>
183 // <i> Defines maximum number of objects that can be active at the same time.
184 // <i> Applies to objects with system provided memory for control blocks.
186 #define OS_TIMER_NUM 1
191 // <o>Timer Thread Priority
193 // <16=> Below Normal <24=> Normal <32=> Above Normal
196 // <i> Defines priority for timer thread
198 #ifndef OS_TIMER_THREAD_PRIO
199 #define OS_TIMER_THREAD_PRIO 40
202 // <o>Timer Thread Stack size [bytes] <0-1073741824:8>
203 // <i> Defines stack size for Timer thread.
204 // <i> May be set to 0 when timers are not used.
206 #ifndef OS_TIMER_THREAD_STACK_SIZE
207 #define OS_TIMER_THREAD_STACK_SIZE 256
210 // <o>Timer Thread TrustZone Module Identifier
211 // <i> Defines TrustZone Thread Context Management Identifier.
212 // <i> Applies only to cores with TrustZone technology.
213 // <i> Default: 0 (not used)
214 #ifndef OS_TIMER_THREAD_TZ_MOD_ID
215 #define OS_TIMER_THREAD_TZ_MOD_ID 0
218 // <o>Timer Callback Queue entries <0-256>
219 // <i> Number of concurrent active timer callback functions.
220 // <i> May be set to 0 when timers are not used.
222 #ifndef OS_TIMER_CB_QUEUE
223 #define OS_TIMER_CB_QUEUE 4
228 // <h>Event Flags Configuration
229 // ============================
231 // <e>Object specific Memory allocation
232 // <i> Enables object specific memory allocation.
233 #ifndef OS_EVFLAGS_OBJ_MEM
234 #define OS_EVFLAGS_OBJ_MEM 0
237 // <o>Number of Event Flags objects <1-1000>
238 // <i> Defines maximum number of objects that can be active at the same time.
239 // <i> Applies to objects with system provided memory for control blocks.
240 #ifndef OS_EVFLAGS_NUM
241 #define OS_EVFLAGS_NUM 1
248 // <h>Mutex Configuration
249 // ======================
251 // <e>Object specific Memory allocation
252 // <i> Enables object specific memory allocation.
253 #ifndef OS_MUTEX_OBJ_MEM
254 #define OS_MUTEX_OBJ_MEM 0
257 // <o>Number of Mutex objects <1-1000>
258 // <i> Defines maximum number of objects that can be active at the same time.
259 // <i> Applies to objects with system provided memory for control blocks.
261 #define OS_MUTEX_NUM 1
268 // <h>Semaphore Configuration
269 // ==========================
271 // <e>Object specific Memory allocation
272 // <i> Enables object specific memory allocation.
273 #ifndef OS_SEMAPHORE_OBJ_MEM
274 #define OS_SEMAPHORE_OBJ_MEM 0
277 // <o>Number of Semaphore objects <1-1000>
278 // <i> Defines maximum number of objects that can be active at the same time.
279 // <i> Applies to objects with system provided memory for control blocks.
280 #ifndef OS_SEMAPHORE_NUM
281 #define OS_SEMAPHORE_NUM 1
288 // <h>Memory Pool Configuration
289 // ============================
291 // <e>Object specific Memory allocation
292 // <i> Enables object specific memory allocation.
293 #ifndef OS_MEMPOOL_OBJ_MEM
294 #define OS_MEMPOOL_OBJ_MEM 0
297 // <o>Number of Memory Pool objects <1-1000>
298 // <i> Defines maximum number of objects that can be active at the same time.
299 // <i> Applies to objects with system provided memory for control blocks.
300 #ifndef OS_MEMPOOL_NUM
301 #define OS_MEMPOOL_NUM 1
304 // <o>Data Storage Memory size [bytes] <0-1073741824:8>
305 // <i> Defines the combined data storage memory size.
306 // <i> Applies to objects with system provided memory for data storage.
308 #ifndef OS_MEMPOOL_DATA_SIZE
309 #define OS_MEMPOOL_DATA_SIZE 0
316 // <h>Message Queue Configuration
317 // ==============================
319 // <e>Object specific Memory allocation
320 // <i> Enables object specific memory allocation.
321 #ifndef OS_MSGQUEUE_OBJ_MEM
322 #define OS_MSGQUEUE_OBJ_MEM 0
325 // <o>Number of Message Queue objects <1-1000>
326 // <i> Defines maximum number of objects that can be active at the same time.
327 // <i> Applies to objects with system provided memory for control blocks.
328 #ifndef OS_MSGQUEUE_NUM
329 #define OS_MSGQUEUE_NUM 1
332 // <o>Data Storage Memory size [bytes] <0-1073741824:8>
333 // <i> Defines the combined data storage memory size.
334 // <i> Applies to objects with system provided memory for data storage.
336 #ifndef OS_MSGQUEUE_DATA_SIZE
337 #define OS_MSGQUEUE_DATA_SIZE 0
344 // <h>Event Recorder Configuration
345 // ===============================
347 // <e>Global Initialization
348 // <i> Initialize Event Recorder during 'osKernelInitialize'.
350 #define OS_EVR_INIT 1
353 // <q>Start recording
354 // <i> Start event recording after initialization.
356 #define OS_EVR_START 1
359 // <h>Global Event Filter Setup
360 // <i> Initial recording level applied to all components.
362 // <o.1>API function call events
363 // <o.2>Operation events
364 // <o.3>Detailed operation events
367 #define OS_EVR_LEVEL 0x0FU
370 // <h>RTOS Event Filter Setup
371 // <i> Recording levels for RTX components.
372 // <i> Only applicable if events for the respective component are generated.
374 // <h>Memory Management
375 // <i> Recording level for Memory Management events.
377 // <o.1>API function call events
378 // <o.2>Operation events
379 // <o.3>Detailed operation events
381 #ifndef OS_EVR_MEMORY_LEVEL
382 #define OS_EVR_MEMORY_LEVEL 0x01U
386 // <i> Recording level for Kernel events.
388 // <o.1>API function call events
389 // <o.2>Operation events
390 // <o.3>Detailed operation events
392 #ifndef OS_EVR_KERNEL_LEVEL
393 #define OS_EVR_KERNEL_LEVEL 0x01U
397 // <i> Recording level for Thread events.
399 // <o.1>API function call events
400 // <o.2>Operation events
401 // <o.3>Detailed operation events
403 #ifndef OS_EVR_THREAD_LEVEL
404 #define OS_EVR_THREAD_LEVEL 0x01U
408 // <i> Recording level for Generic Wait events.
410 // <o.1>API function call events
411 // <o.2>Operation events
412 // <o.3>Detailed operation events
414 #ifndef OS_EVR_WAIT_LEVEL
415 #define OS_EVR_WAIT_LEVEL 0x01U
419 // <i> Recording level for Thread Flags events.
421 // <o.1>API function call events
422 // <o.2>Operation events
423 // <o.3>Detailed operation events
425 #ifndef OS_EVR_THFLAGS_LEVEL
426 #define OS_EVR_THFLAGS_LEVEL 0x01U
430 // <i> Recording level for Event Flags events.
432 // <o.1>API function call events
433 // <o.2>Operation events
434 // <o.3>Detailed operation events
436 #ifndef OS_EVR_EVFLAGS_LEVEL
437 #define OS_EVR_EVFLAGS_LEVEL 0x01U
441 // <i> Recording level for Timer events.
443 // <o.1>API function call events
444 // <o.2>Operation events
445 // <o.3>Detailed operation events
447 #ifndef OS_EVR_TIMER_LEVEL
448 #define OS_EVR_TIMER_LEVEL 0x01U
452 // <i> Recording level for Mutex events.
454 // <o.1>API function call events
455 // <o.2>Operation events
456 // <o.3>Detailed operation events
458 #ifndef OS_EVR_MUTEX_LEVEL
459 #define OS_EVR_MUTEX_LEVEL 0x01U
463 // <i> Recording level for Semaphore events.
465 // <o.1>API function call events
466 // <o.2>Operation events
467 // <o.3>Detailed operation events
469 #ifndef OS_EVR_SEMAPHORE_LEVEL
470 #define OS_EVR_SEMAPHORE_LEVEL 0x01U
474 // <i> Recording level for Memory Pool events.
476 // <o.1>API function call events
477 // <o.2>Operation events
478 // <o.3>Detailed operation events
480 #ifndef OS_EVR_MEMPOOL_LEVEL
481 #define OS_EVR_MEMPOOL_LEVEL 0x01U
485 // <i> Recording level for Message Queue events.
487 // <o.1>API function call events
488 // <o.2>Operation events
489 // <o.3>Detailed operation events
491 #ifndef OS_EVR_MSGQUEUE_LEVEL
492 #define OS_EVR_MSGQUEUE_LEVEL 0x01U
499 // <h>RTOS Event Generation
500 // <i> Enables event generation for RTX components (requires RTX source variant).
502 // <q>Memory Management
503 // <i> Enables Memory Management event generation.
504 #ifndef OS_EVR_MEMORY
505 #define OS_EVR_MEMORY 0
509 // <i> Enables Kernel event generation.
510 #ifndef OS_EVR_KERNEL
511 #define OS_EVR_KERNEL 0
515 // <i> Enables Thread event generation.
516 #ifndef OS_EVR_THREAD
517 #define OS_EVR_THREAD 0
521 // <i> Enables Generic Wait event generation.
523 #define OS_EVR_WAIT 0
527 // <i> Enables Thread Flags event generation.
528 #ifndef OS_EVR_THFLAGS
529 #define OS_EVR_THFLAGS 0
533 // <i> Enables Event Flags event generation.
534 #ifndef OS_EVR_EVFLAGS
535 #define OS_EVR_EVFLAGS 0
539 // <i> Enables Timer event generation.
541 #define OS_EVR_TIMER 0
545 // <i> Enables Mutex event generation.
547 #define OS_EVR_MUTEX 0
551 // <i> Enables Semaphore event generation.
552 #ifndef OS_EVR_SEMAPHORE
553 #define OS_EVR_SEMAPHORE 0
557 // <i> Enables Memory Pool event generation.
558 #ifndef OS_EVR_MEMPOOL
559 #define OS_EVR_MEMPOOL 0
563 // <i> Enables Message Queue event generation.
564 #ifndef OS_EVR_MSGQUEUE
565 #define OS_EVR_MSGQUEUE 0
572 // Number of Threads which use standard C/C++ library libspace
573 // (when thread specific memory allocation is not used).
574 #if (OS_THREAD_OBJ_MEM == 0)
575 #ifndef OS_THREAD_LIBSPACE_NUM
576 #define OS_THREAD_LIBSPACE_NUM 4
579 #define OS_THREAD_LIBSPACE_NUM OS_THREAD_NUM
582 //------------- <<< end of configuration section >>> ---------------------------
584 #endif // RTX_CONFIG_H_