]> begriffs open source - cmsis-freertos/blob - CMSIS/RTOS2/FreeRTOS/Examples/App/Hello/RTE/RTOS/FreeRTOSConfig.h
Update FreeRTOS configuration
[cmsis-freertos] / CMSIS / RTOS2 / FreeRTOS / Examples / App / Hello / RTE / RTOS / FreeRTOSConfig.h
1 /* --------------------------------------------------------------------------
2  * Copyright (c) 2013-2024 Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
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
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  * --------------------------------------------------------------------------
19  *
20  * $Revision:   V10.6.0
21  *
22  * Project:     CMSIS-FreeRTOS
23  * Title:       FreeRTOS configuration definitions
24  *
25  * --------------------------------------------------------------------------*/
26
27 #ifndef FREERTOS_CONFIG_H
28 #define FREERTOS_CONFIG_H
29
30 /*-----------------------------------------------------------
31  * Application specific definitions.
32  *
33  * These definitions should be adjusted for your particular hardware and
34  * application requirements.
35  *
36  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
37  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
38  *
39  * See http://www.freertos.org/a00110.html
40  *----------------------------------------------------------*/
41
42 #if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
43 #include <stdint.h>
44
45 #include "RTE_Components.h"
46 #include CMSIS_device_header
47 #endif
48
49 //-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
50
51 //  <o>Minimal stack size [words] <0-65535>
52 //  <i> Stack for idle task and default task stack in words.
53 //  <i> Default: 128
54 #define configMINIMAL_STACK_SIZE                  ((uint16_t)(128))
55
56 //  <o>Total heap size [bytes] <0-0xFFFFFFFF>
57 //  <i> Heap memory size in bytes.
58 //  <i> Default: 8192
59 #define configTOTAL_HEAP_SIZE                     ((size_t)8192)
60
61 //  <o>Kernel tick frequency [Hz] <0-0xFFFFFFFF>
62 //  <i> Kernel tick rate in Hz.
63 //  <i> Default: 1000
64 #define configTICK_RATE_HZ                        ((TickType_t)1000)
65
66 //  <o>Timer task stack depth [words] <0-65535>
67 //  <i> Stack for timer task in words.
68 //  <i> Default: 80
69 #define configTIMER_TASK_STACK_DEPTH              80
70
71 //  <o>Timer task priority <0-56>
72 //  <i> Timer task priority.
73 //  <i> Default: 40 (High)
74 #define configTIMER_TASK_PRIORITY                 40
75
76 //  <o>Timer queue length <0-1024>
77 //  <i> Timer command queue length.
78 //  <i> Default: 5
79 #define configTIMER_QUEUE_LENGTH                  5
80
81 //  <o>Preemption interrupt priority
82 //  <i> Maximum priority of interrupts that are safe to call FreeRTOS API.
83 //  <i> Default: 128
84 #define configMAX_SYSCALL_INTERRUPT_PRIORITY      128
85
86 //  <q>Use time slicing
87 //  <i> Enable setting to use timeslicing.
88 //  <i> Default: 1
89 #define configUSE_TIME_SLICING                    1
90
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.
94 //  <i> Default: 0
95 #define configUSE_TICKLESS_IDLE                   0
96
97 //  <q>Idle should yield
98 //  <i> Control Yield behaviour of the idle task.
99 //  <i> Default: 1
100 #define configIDLE_SHOULD_YIELD                   1
101
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.
106 //  <i> Default: 0
107 #define configCHECK_FOR_STACK_OVERFLOW            2
108
109 //  <q>Use idle hook
110 //  <i> Enable callback function call on each idle task iteration.
111 //  <i> Callback function vApplicationIdleHook implementation is required when idle hook is enabled.
112 //  <i> Default: 0
113 #define configUSE_IDLE_HOOK                       0
114
115 //  <q>Use tick hook
116 //  <i> Enable callback function call during each tick interrupt.
117 //  <i> Callback function vApplicationTickHook implementation is required when tick hook is enabled.
118 //  <i> Default: 0
119 #define configUSE_TICK_HOOK                       0
120
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.
124 //  <i> Default: 0
125 #define configUSE_DAEMON_TASK_STARTUP_HOOK        0
126
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.
130 //  <i> Default: 0
131 #define configUSE_MALLOC_FAILED_HOOK              0
132
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.
136 //  <i> Default: 0
137 #define configQUEUE_REGISTRY_SIZE                 0
138
139 // <h>Event Recorder Configuration
140 // <i> Initialize and setup Event Recorder level filtering.
141 // <i> Settings have no effect when Event Recorder is not present.
142
143 //  <q>Initialize Event Recorder
144 //  <i> Initialize Event Recorder before FreeRTOS kernel start.
145 //  <i> Default: 1
146 #define configEVR_INITIALIZE                      1
147
148 //  <e>Setup recording level filter
149 //  <i> Enable configuration of FreeRTOS events recording level
150 //  <i> Default: 1
151 #define configEVR_SETUP_LEVEL                     1
152
153 //  <o>Tasks functions
154 //  <i> Define event recording level bitmask for events generated from Tasks functions.
155 //  <i> Default: 0x05
156 //    <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
157 #define configEVR_LEVEL_TASKS                     0x07
158
159 //  <o>Queue functions
160 //  <i> Define event recording level bitmask for events generated from Queue functions.
161 //  <i> Default: 0x05
162 //    <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
163 #define configEVR_LEVEL_QUEUE                     0x07
164
165 //  <o>Timer functions
166 //  <i> Define event recording level bitmask for events generated from Timer functions.
167 //  <i> Default: 0x05
168 //    <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
169 #define configEVR_LEVEL_TIMERS                    0x07
170
171 //  <o>Event Groups functions
172 //  <i> Define event recording level bitmask for events generated from Event Groups functions.
173 //  <i> Default: 0x05
174 //    <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
175 #define configEVR_LEVEL_EVENTGROUPS               0x07
176
177 //  <o>Heap functions
178 //  <i> Define event recording level bitmask for events generated from Heap functions.
179 //  <i> Default: 0x05
180 //    <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
181 #define configEVR_LEVEL_HEAP                      0x07
182
183 //  <o>Stream Buffer functions
184 //  <i> Define event recording level bitmask for events generated from Stream Buffer functions.
185 //  <i> Default: 0x05
186 //    <0x00=>Off <0x01=>Errors <0x03=>Errors + API <0x05=>Errors + Operation <0x07=>Errors + API + Operation <0x0F=>All
187 #define configEVR_LEVEL_STREAMBUFFER              0x07
188 //  </e>
189 // </h>
190
191 // <h>Memory Allocation Configuration
192 // <i> Enable and configure memory allocation specific features.
193 // <i> To configure FreeRTOS heap size use configTOTAL_HEAP_SIZE.
194
195 //  <q> Support static memory allocation
196 //  <i> Enable or disable static memory allocation.
197 //  <i> When enabled RTOS objects can be created using application provided RAM.
198 //  <i> Default: 1
199 #define configSUPPORT_STATIC_ALLOCATION           1
200
201 //  <q> Support dynamic memory allocation
202 //  <i> Enable or disable dynamic memory allocation.
203 //  <i> When enabled RTOS objects can be created using RAM automatically allocated from the FreeRTOS heap.
204 //  <i> Default: 1
205 #define configSUPPORT_DYNAMIC_ALLOCATION          1
206
207 //  <q>Use kernel provided static memory
208 //  <i> When enabled FreeRTOS kernel provides static memory for Idle and Timer tasks.
209 //  <i> Otherwise user shall provide implementation of:
210 //  <i> - vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory
211 //  <i> - vApplicationGetPassiveIdleTaskMemory (when kernel uses SMP)
212 //  <i> Default: 1
213 #define configKERNEL_PROVIDED_STATIC_MEMORY       1
214
215 //  <q>Use application allocated heap
216 //  <i> Global heap buffer must be provided externally when using application allocated heap.
217 //  <i> The buffer must be declared as: uint8_t ucHeap[ configTOTAL_HEAP_SIZE ].
218 //  <i> Default: 0
219 #define configAPPLICATION_ALLOCATED_HEAP          0
220
221 //  <q>Use separate heap for stack allocation
222 //  <i> Enable or disable stack allocation for any task from a separate heap.
223 //  <i> Thread-safe implementation of pvPortMallocStack and vPortFreeStack is required when using separate heap.
224 //  <i> Default: 0
225 #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
226
227 //  <q>Use heap protector
228 //  <i> Enable or disable bounds checking and obfuscation to heap block pointers.
229 //  <i> This setting only applies to Heap_4 and Heap_5.
230 //  <i> Default: 0
231 #define configENABLE_HEAP_PROTECTOR               0
232 // </h>
233
234 // <h>Port Specific Configuration
235 // <i> Enable and configure port specific features.
236 // <i> Check FreeRTOS documentation for definitions that apply for the used port.
237
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.
241 //  <i> This setting is only relevant on ARMv8-M ports.
242 //  <i> Default: 1
243 #define configENABLE_FPU                          0
244
245 //  <q>Use M-Profile Vector Extension
246 //  <i> Using M-Profile Vector Extension (MVE) affects context handling.
247 //  <i> Enable MVE when application uses signal processing and ML algorithms.
248 //  <i> This setting is only relevant on ARMv8-M ports.
249 //  <i> Default: 0
250 #define configENABLE_MVE                          0
251
252 //  <q>Use Memory Protection Unit
253 //  <i> Using Memory Protection Unit (MPU) requires detailed memory map definition.
254 //  <i> This setting is only relevant on ARMv8-M MPU enabled ports.
255 //  <i> Default: 0
256 #define configENABLE_MPU                          0
257
258 //  <q>Use TrustZone Secure Side Only
259 //  <i> This settings prevents FreeRTOS contex switch to Non-Secure side.
260 //  <i> Enable this setting when FreeRTOS runs on the Secure side only.
261 //  <i> This setting is only relevant on ARMv8-M ports.
262 //  <i> Default: 0
263 #define configRUN_FREERTOS_SECURE_ONLY            0
264
265 //  <q>Use TrustZone Security Extension
266 //  <i> Using TrustZone affects context handling.
267 //  <i> Enable TrustZone when FreeRTOS runs on the Non-Secure side and calls functions from the Secure side.
268 //  <i> This setting is only relevant on ARMv8-M ports.
269 //  <i> Default: 1
270 #define configENABLE_TRUSTZONE                    0
271
272 //  <o>Minimal secure stack size [words] <0-65535>
273 //  <i> Stack for idle task Secure side context in words.
274 //  <i> This setting is only relevant on ARMv8-M ports when TrustZone extension is enabled.
275 //  <i> Default: 128
276 #define configMINIMAL_SECURE_STACK_SIZE           ((uint32_t)128)
277
278 //  <h>Interrupt Controller Configuration
279 //  <i> Configure Arm Generic Interrupt Controller (GIC) interrupt controller specific settings.
280 //  <i> Settings related to interrupt controller are relevant only on ARMv7-A ports.
281
282 //   <o>Interrupt controller base address
283 //   <i> Must be set to the base address of the interrupt controller peripheral.
284 //   <i> Default: 0x2C000000
285 #define configINTERRUPT_CONTROLLER_BASE_ADDRESS   0x2C000000UL
286
287 //   <o>Interrupt controller CPU interface offset
288 //   <i> Must be set to the offset from interrupt controller base address at which the CPU interface starts.
289 //   <i> Default: 0x1000
290 #define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET 0x00001000UL
291
292 //   <o>Interrupt controller unique priorities
293 //   <i> The number of unique priorities that can be specified in the interrupt controller peripheral.
294 //   <i> Default: 32
295 #define configUNIQUE_INTERRUPT_PRIORITIES         32
296 //  </h>
297 // </h>
298
299 // <h>Symmetric Multiprocessing Configuration
300 // <i> Enable and configure FreeRTOS for Symmetric Multiprocessing (SMP).
301
302 //  <o>Number of processor cores
303 //  <i> Sets the number of available processor cores.
304 //  <i> Default: 1
305 #define configNUMBER_OF_CORES                     1
306
307 //  <q>Use processor core affinity
308 //  <i> Enables the control for task to run on specific processor cores.
309 //  <i> Task that has no processor affinity set may run on any available core.
310 //  <i> Default: 0
311 #define configUSE_CORE_AFFINITY                   0
312
313 //  <q>Use passive idle hook
314 //  <i> Enable callback function call on each idle task iteration.
315 //  <i> Callback function vApplicationPassiveIdleHook implementation is required when idle hook is enabled.
316 //  <i> Default: 0
317 #define configUSE_PASSIVE_IDLE_HOOK               0
318 // </h>
319
320 //------------- <<< end of configuration section >>> ---------------------------
321
322 /* Defines needed by FreeRTOS to implement CMSIS RTOS2 API. Do not change! */
323 #define configCPU_CLOCK_HZ                        (SystemCoreClock)
324 #define configUSE_PREEMPTION                      1
325 #define configUSE_TIMERS                          1
326 #define configUSE_MUTEXES                         1
327 #define configUSE_RECURSIVE_MUTEXES               1
328 #define configUSE_COUNTING_SEMAPHORES             1
329 #define configUSE_TASK_NOTIFICATIONS              1
330 #define configUSE_TRACE_FACILITY                  1
331 #define configUSE_16_BIT_TICKS                    0
332 #define configUSE_PORT_OPTIMISED_TASK_SELECTION   0
333 #define configMAX_PRIORITIES                      56
334 #define configKERNEL_INTERRUPT_PRIORITY           255
335
336 /* Defines that include FreeRTOS functions which implement CMSIS RTOS2 API. Do not change! */
337 #define INCLUDE_xEventGroupSetBitsFromISR         1
338 #define INCLUDE_xSemaphoreGetMutexHolder          1
339 #define INCLUDE_vTaskDelay                        1
340 #define INCLUDE_xTaskDelayUntil                   1
341 #define INCLUDE_vTaskDelete                       1
342 #define INCLUDE_xTaskGetCurrentTaskHandle         1
343 #define INCLUDE_xTaskGetSchedulerState            1
344 #define INCLUDE_uxTaskGetStackHighWaterMark       1
345 #define INCLUDE_uxTaskPriorityGet                 1
346 #define INCLUDE_vTaskPrioritySet                  1
347 #define INCLUDE_eTaskGetState                     1
348 #define INCLUDE_vTaskSuspend                      1
349 #define INCLUDE_xTaskAbortDelay                   1
350 #define INCLUDE_xTimerPendFunctionCall            1
351
352 #if (__ARM_ARCH_7A__ == 1U)
353   /* Cortex-A specifics */
354   #include "os_tick.h"
355
356   /* Maximum API call interrupt priority:
357      - Interrupts assigned a priority at or below this priority can call interrupt safe FreeRTOS API function, and will nest.
358      - Interrupts assigned a priority above this priority will not be effected by RTOS critical sections, and will nest,
359        but cannot call any FreeRTOS API functions.
360      - Use configMAX_SYSCALL_INTERRUPT_PRIORITY to set this define as they are essentially the same.
361   */
362   #define configMAX_API_CALL_INTERRUPT_PRIORITY   configMAX_SYSCALL_INTERRUPT_PRIORITY
363
364   /* Map the FreeRTOS port timer configuration functions to their implementations */
365   #define configSETUP_TICK_INTERRUPT()                         \
366     OS_Tick_Setup (configTICK_RATE_HZ, FreeRTOS_Tick_Handler); \
367     OS_Tick_Enable();
368
369   #define configCLEAR_TICK_INTERRUPT()                         \
370     OS_Tick_AcknowledgeIRQ()
371 #else
372   /* Cortex-M specifics */
373   /* Map the FreeRTOS port interrupt handlers to their CMSIS standard names. */
374   #define xPortPendSVHandler                      PendSV_Handler
375   #define vPortSVCHandler                         SVC_Handler
376
377   /* Ensure Cortex-M port compatibility. */
378   #define SysTick_Handler                         xPortSysTickHandler
379
380   #if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
381   /* Include debug event definitions */
382   #include "freertos_evr.h"
383   #endif
384 #endif
385
386 #endif /* FREERTOS_CONFIG_H */