1 /* --------------------------------------------------------------------------
2 * Copyright (c) 2013-2024 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-FreeRTOS
23 * Title: FreeRTOS configuration definitions
25 * --------------------------------------------------------------------------*/
27 #ifndef FREERTOS_CONFIG_H
28 #define FREERTOS_CONFIG_H
30 /*-----------------------------------------------------------
31 * Application specific definitions.
33 * These definitions should be adjusted for your particular hardware and
34 * application requirements.
36 * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
37 * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
39 * See http://www.freertos.org/a00110.html
40 *----------------------------------------------------------*/
42 #if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
45 #include "RTE_Components.h"
46 #include CMSIS_device_header
49 //-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
51 // <o>Minimal stack size [words] <0-65535>
52 // <i> Stack for idle task and default task stack in words.
54 #define configMINIMAL_STACK_SIZE ((uint16_t)(128))
56 // <o>Total heap size [bytes] <0-0xFFFFFFFF>
57 // <i> Heap memory size in bytes.
59 #define configTOTAL_HEAP_SIZE ((size_t)8192)
61 // <o>Kernel tick frequency [Hz] <0-0xFFFFFFFF>
62 // <i> Kernel tick rate in Hz.
64 #define configTICK_RATE_HZ ((TickType_t)1000)
66 // <o>Timer task stack depth [words] <0-65535>
67 // <i> Stack for timer task in words.
69 #define configTIMER_TASK_STACK_DEPTH 80
71 // <o>Timer task priority <0-56>
72 // <i> Timer task priority.
73 // <i> Default: 40 (High)
74 #define configTIMER_TASK_PRIORITY 40
76 // <o>Timer queue length <0-1024>
77 // <i> Timer command queue length.
79 #define configTIMER_QUEUE_LENGTH 5
81 // <o>Preemption interrupt priority
82 // <i> Maximum priority of interrupts that are safe to call FreeRTOS API.
84 #define configMAX_SYSCALL_INTERRUPT_PRIORITY 16
86 // <q>Use time slicing
87 // <i> Enable setting to use timeslicing.
89 #define configUSE_TIME_SLICING 1
91 // <q>Use tickless idle
92 // <i> Enable low power tickless mode to stop the periodic tick interrupt during idle periods or
93 // <i> disable it to keep the tick interrupt running at all times.
95 #define configUSE_TICKLESS_IDLE 0
97 // <q>Idle should yield
98 // <i> Control Yield behaviour of the idle task.
100 #define configIDLE_SHOULD_YIELD 1
102 // <o>Check for stack overflow
103 // <0=>Disable <1=>Method one <2=>Method two
104 // <i> Enable or disable stack overflow checking.
105 // <i> Callback function vApplicationStackOverflowHook implementation is required when stack checking is enabled.
107 #define configCHECK_FOR_STACK_OVERFLOW 2
110 // <i> Enable callback function call on each idle task iteration.
111 // <i> Callback function vApplicationIdleHook implementation is required when idle hook is enabled.
113 #define configUSE_IDLE_HOOK 0
116 // <i> Enable callback function call during each tick interrupt.
117 // <i> Callback function vApplicationTickHook implementation is required when tick hook is enabled.
119 #define configUSE_TICK_HOOK 0
121 // <q>Use deamon task startup hook
122 // <i> Enable callback function call when timer service starts.
123 // <i> Callback function vApplicationDaemonTaskStartupHook implementation is required when deamon task startup hook is enabled.
125 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
127 // <q>Use malloc failed hook
128 // <i> Enable callback function call when out of dynamic memory.
129 // <i> Callback function vApplicationMallocFailedHook implementation is required when malloc failed hook is enabled.
131 #define configUSE_MALLOC_FAILED_HOOK 0
133 // <o>Queue registry size
134 // <i> Define maximum number of queue objects registered for debug purposes.
135 // <i> The queue registry is used by kernel aware debuggers to locate queue and semaphore structures and display associated text names.
137 #define configQUEUE_REGISTRY_SIZE 0
139 // <h>Memory Allocation Configuration
140 // <i> Enable and configure memory allocation specific features.
141 // <i> To configure FreeRTOS heap size use configTOTAL_HEAP_SIZE.
143 // <q> Support static memory allocation
144 // <i> Enable or disable static memory allocation.
145 // <i> When enabled RTOS objects can be created using application provided RAM.
147 #define configSUPPORT_STATIC_ALLOCATION 1
149 // <q> Support dynamic memory allocation
150 // <i> Enable or disable dynamic memory allocation.
151 // <i> When enabled RTOS objects can be created using RAM automatically allocated from the FreeRTOS heap.
153 #define configSUPPORT_DYNAMIC_ALLOCATION 1
155 // <q>Use kernel provided static memory
156 // <i> When enabled FreeRTOS kernel provides static memory for Idle and Timer tasks.
157 // <i> Otherwise user shall provide implementation of:
158 // <i> - vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory
159 // <i> - vApplicationGetPassiveIdleTaskMemory (when kernel uses SMP)
161 #define configKERNEL_PROVIDED_STATIC_MEMORY 1
163 // <q>Use application allocated heap
164 // <i> Global heap buffer must be provided externally when using application allocated heap.
165 // <i> The buffer must be declared as: uint8_t ucHeap[ configTOTAL_HEAP_SIZE ].
167 #define configAPPLICATION_ALLOCATED_HEAP 0
169 // <q>Use separate heap for stack allocation
170 // <i> Enable or disable stack allocation for any task from a separate heap.
171 // <i> Thread-safe implementation of pvPortMallocStack and vPortFreeStack is required when using separate heap.
173 #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
175 // <q>Use heap protector
176 // <i> Enable or disable bounds checking and obfuscation to heap block pointers.
177 // <i> This setting only applies to Heap_4 and Heap_5.
179 #define configENABLE_HEAP_PROTECTOR 0
182 // <h>Event Recorder Configuration
183 // <i> Initialize and setup Event Recorder level filtering.
184 // <i> Settings have no effect when Event Recorder is not present.
186 // <q>Initialize Event Recorder
187 // <i> Initialize Event Recorder before FreeRTOS kernel start.
189 #define configEVR_INITIALIZE 1
191 // <e>Setup recording level filter
192 // <i> Enable configuration of FreeRTOS events recording level
194 #define configEVR_SETUP_LEVEL 1
196 // <o>Tasks functions
197 // <i> Define event recording level bitmask for events generated from Tasks functions.
199 // <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
200 #define configEVR_LEVEL_TASKS 0x07
202 // <o>Queue functions
203 // <i> Define event recording level bitmask for events generated from Queue functions.
205 // <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
206 #define configEVR_LEVEL_QUEUE 0x07
208 // <o>Timer functions
209 // <i> Define event recording level bitmask for events generated from Timer functions.
211 // <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
212 #define configEVR_LEVEL_TIMERS 0x07
214 // <o>Event Groups functions
215 // <i> Define event recording level bitmask for events generated from Event Groups functions.
217 // <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
218 #define configEVR_LEVEL_EVENTGROUPS 0x07
221 // <i> Define event recording level bitmask for events generated from Heap functions.
223 // <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
224 #define configEVR_LEVEL_HEAP 0x07
226 // <o>Stream Buffer functions
227 // <i> Define event recording level bitmask for events generated from Stream Buffer functions.
229 // <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
230 #define configEVR_LEVEL_STREAMBUFFER 0x07
234 // <h> Port Specific Features
235 // <i> Enable and configure port specific features.
236 // <i> Check FreeRTOS documentation for definitions that apply for the used port.
238 // <q>Use Floating Point Unit
239 // <i> Using Floating Point Unit (FPU) affects context handling.
240 // <i> Enable FPU when application uses floating point operations.
242 #define configENABLE_FPU 0
244 // <q>Use M-Profile Vector Extension
245 // <i> Using M-Profile Vector Extension (MVE) affects context handling.
246 // <i> Enable MVE when application uses signal processing and ML algorithms.
248 #define configENABLE_MVE 0
250 // <q>Use Memory Protection Unit
251 // <i> Using Memory Protection Unit (MPU) requires detailed memory map definition.
252 // <i> This setting is only releavant for MPU enabled ports.
254 #define configENABLE_MPU 0
256 // <q> Use TrustZone Secure Side Only
257 // <i> This settings prevents FreeRTOS contex switch to Non-Secure side.
258 // <i> Enable this setting when FreeRTOS runs on the Secure side only.
259 #define configRUN_FREERTOS_SECURE_ONLY 0
261 // <q>Use TrustZone Security Extension
262 // <i> Using TrustZone affects context handling.
263 // <i> Enable TrustZone when FreeRTOS runs on the Non-Secure side and calls functions from the Secure side.
265 #define configENABLE_TRUSTZONE 0
267 // <o>Minimal secure stack size [words] <0-65535>
268 // <i> Stack for idle task Secure side context in words.
269 // <i> This setting is only relevant when TrustZone extension is enabled.
271 #define configMINIMAL_SECURE_STACK_SIZE ((uint32_t)128)
274 // <h> Symmetric Multiprocessing Configuration
275 // <i> Enable and configure FreeRTOS for Symmetric Multiprocessing (SMP).
277 // <q>Number of processor cores
278 // <i> Sets the number of available processor cores.
280 #define configNUMBER_OF_CORES 1
282 // <q>Use processor core affinity
283 // <i> Enables the control for task to run on specific processor cores.
284 // <i> Task that has no processor affinity set may run on any available core.
286 #define configUSE_CORE_AFFINITY 0
288 // <q>Use passive idle hook
289 // <i> Enable callback function call on each idle task iteration.
290 // <i> Callback function vApplicationPassiveIdleHook implementation is required when idle hook is enabled.
292 #define configUSE_PASSIVE_IDLE_HOOK 0
295 //------------- <<< end of configuration section >>> ---------------------------
297 /* Defines needed by FreeRTOS to implement CMSIS RTOS2 API. Do not change! */
298 #define configCPU_CLOCK_HZ (SystemCoreClock)
299 #define configUSE_PREEMPTION 1
300 #define configUSE_TIMERS 1
301 #define configUSE_MUTEXES 1
302 #define configUSE_RECURSIVE_MUTEXES 1
303 #define configUSE_COUNTING_SEMAPHORES 1
304 #define configUSE_TASK_NOTIFICATIONS 1
305 #define configUSE_TRACE_FACILITY 1
306 #define configUSE_16_BIT_TICKS 0
307 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
308 #define configMAX_PRIORITIES 56
309 #define configKERNEL_INTERRUPT_PRIORITY 255
311 /* Defines that include FreeRTOS functions which implement CMSIS RTOS2 API. Do not change! */
312 #define INCLUDE_xEventGroupSetBitsFromISR 1
313 #define INCLUDE_xSemaphoreGetMutexHolder 1
314 #define INCLUDE_vTaskDelay 1
315 #define INCLUDE_xTaskDelayUntil 1
316 #define INCLUDE_vTaskDelete 1
317 #define INCLUDE_xTaskGetCurrentTaskHandle 1
318 #define INCLUDE_xTaskGetSchedulerState 1
319 #define INCLUDE_uxTaskGetStackHighWaterMark 1
320 #define INCLUDE_uxTaskPriorityGet 1
321 #define INCLUDE_vTaskPrioritySet 1
322 #define INCLUDE_eTaskGetState 1
323 #define INCLUDE_vTaskSuspend 1
324 #define INCLUDE_xTaskAbortDelay 1
325 #define INCLUDE_xTimerPendFunctionCall 1
327 /* Map the FreeRTOS port interrupt handlers to their CMSIS standard names. */
328 #define xPortPendSVHandler PendSV_Handler
329 #define vPortSVCHandler SVC_Handler
331 /* Ensure Cortex-M port compatibility. */
332 #define SysTick_Handler xPortSysTickHandler
334 #if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
335 //#define traceENTER_xTaskGetSchedulerState_DISABLE
336 //#define traceRETURN_xTaskGetSchedulerState_DISABLE
337 /* Include debug event definitions */
338 #include "freertos_evr.h"
341 #endif /* FREERTOS_CONFIG_H */