]> begriffs open source - freertos/blob - sample_configuration/FreeRTOSConfig.h
Rename CPU to Core (#849)
[freertos] / sample_configuration / FreeRTOSConfig.h
1 /*
2  * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28
29 /*******************************************************************************
30  * This file provides an example FreeRTOSConfig.h header file, inclusive of an
31  * abbreviated explanation of each configuration item.  Online and reference
32  * documentation provides more information.
33  * https://www.freertos.org/a00110.html
34  *
35  * Constant values enclosed in square brackets ('[' and ']') must be completed
36  * before this file will build.
37  *
38  * Use the FreeRTOSConfig.h supplied with the RTOS port in use rather than this
39  * generic file, if one is available.
40  ******************************************************************************/
41
42 #ifndef __FREERTOS_CONFIG_H__
43 #define __FREERTOS_CONFIG_H__
44
45 /******************************************************************************/
46 /* Hardware description related definitions. **********************************/
47 /******************************************************************************/
48
49 /* In most cases, configCPU_CLOCK_HZ must be set to the frequency of the clock
50  * that drives the peripheral used to generate the kernels periodic tick interrupt.
51  * The default value is set to 20MHz and matches the QEMU demo settings.  Your
52  * application will certainly need a different value so set this correctly.
53  * This is very often, but not always, equal to the main system clock frequency. */
54 #define configCPU_CLOCK_HZ    ( ( unsigned long ) 20000000 )
55
56 /* configSYSTICK_CLOCK_HZ is an optional parameter for ARM Cortex-M ports only.
57  *
58  * By default ARM Cortex-M ports generate the RTOS tick interrupt from the
59  * Cortex-M SysTick timer. Most Cortex-M MCUs run the SysTick timer at the same
60  * frequency as the MCU itself - when that is the case configSYSTICK_CLOCK_HZ is
61  * not needed and should be left undefined. If the SysTick timer is clocked at a
62  * different frequency to the MCU core then set configCPU_CLOCK_HZ to the MCU clock
63  * frequency, as normal, and configSYSTICK_CLOCK_HZ to the SysTick clock
64  * frequency.  Not used if left undefined.
65  * The default value is undefined (commented out).  If you need this value bring it
66  * back and set it to a suitable value */
67
68 /*
69  #define configSYSTICK_CLOCK_HZ                  [Platform specific]
70  */
71
72 /******************************************************************************/
73 /* Scheduling behaviour related definitions. **********************************/
74 /******************************************************************************/
75
76 /* configTICK_RATE_HZ sets frequency of the tick interrupt in Hz, normally
77  * calculated from the configCPU_CLOCK_HZ value. */
78 #define configTICK_RATE_HZ                         100
79
80 /* Set configUSE_PREEMPTION to 1 to use pre-emptive scheduling.  Set
81  * configUSE_PREEMPTION to 0 to use co-operative scheduling.
82  * See https://www.freertos.org/single-core-amp-smp-rtos-scheduling.html */
83 #define configUSE_PREEMPTION                       1
84
85 /* Set configUSE_TIME_SLICING to 1 to have the scheduler switch between Ready
86  * state tasks of equal priority on every tick interrupt.  Set
87  * configUSE_TIME_SLICING to 0 to prevent the scheduler switching between Ready
88  * state tasks just because there was a tick interrupt.  See
89  * https://freertos.org/single-core-amp-smp-rtos-scheduling.html */
90 #define configUSE_TIME_SLICING                     0
91
92 /* Set configUSE_PORT_OPTIMISED_TASK_SELECTION to 1 to select the next task to
93  * run using an algorithm optimised to the instruction set of the target hardware -
94  * normally using a count leading zeros assembly instruction.  Set to 0 to select
95  * the next task to run using a generic C algorithm that works for all FreeRTOS
96  * ports.  Not all FreeRTOS ports have this option.  Defaults to 0 if left
97  * undefined. */
98 #define configUSE_PORT_OPTIMISED_TASK_SELECTION    0
99
100 /* Set configUSE_TICKLESS_IDLE to 1 to use the low power tickless mode.  Set to
101  * 0 to keep the tick interrupt running at all times.  Not all FreeRTOS ports
102  * support tickless mode. See https://www.freertos.org/low-power-tickless-rtos.html
103  * Defaults to 0 if left undefined. */
104 #define configUSE_TICKLESS_IDLE                    0
105
106 /* configMAX_PRIORITIES Sets the number of available task priorities.  Tasks can
107  * be assigned priorities of 0 to (configMAX_PRIORITIES - 1).  Zero is the lowest
108  * priority. */
109 #define configMAX_PRIORITIES                       5
110
111 /* configMINIMAL_STACK_SIZE defines the size of the stack used by the Idle task
112  * (in words, not in bytes!).  The kernel does not use this constant for any other
113  * purpose.  Demo applications use the constant to make the demos somewhat portable
114  * across hardware architectures. */
115 #define configMINIMAL_STACK_SIZE                   128
116
117 /* configMAX_TASK_NAME_LEN sets the maximum length (in characters) of a task's
118  * human readable name.  Includes the NULL terminator. */
119 #define configMAX_TASK_NAME_LEN                    16
120
121 /* The tick count is held in a variable of type TickType_t.  Set
122  * configUSE_16_BIT_TICKS to 1 to make TickType_t a 16-bit type.  Set
123  * configUSE_16_BIT_TICKS to 0 to make TickType_t either a 32 or 64-bit type
124  * depending on the architecture.  Using a 16-bit type can greatly improve
125  * efficiency on 8-bit and 16-bit microcontrollers, but at the cost of limiting the
126  * maximum specifiable block time to 0xffff. */
127 #define configUSE_16_BIT_TICKS                     0
128
129 /* Set configIDLE_SHOULD_YIELD to 1 to have the Idle task yield to an
130  * application task if there is an Idle priority (priority 0) application task that
131  * can run.  Set to 0 to have the Idle task use all of its timeslice.  Default to 1
132  * if left undefined. */
133 #define configIDLE_SHOULD_YIELD                    1
134
135 /* Each task has an array of task notifications.
136  * configTASK_NOTIFICATION_ARRAY_ENTRIES sets the number of indexes in the array.
137  * See https://www.freertos.org/RTOS-task-notifications.html  Defaults to 1 if
138  * left undefined. */
139 #define configTASK_NOTIFICATION_ARRAY_ENTRIES      1
140
141 /* configQUEUE_REGISTRY_SIZE sets the maximum number of queues and semaphores
142  * that can be referenced from the queue registry.  Only required when using a
143  * kernel aware debugger.  Defaults to 0 if left undefined. */
144 #define configQUEUE_REGISTRY_SIZE                  0
145
146 /* Set configENABLE_BACKWARD_COMPATIBILITY to 1 to map function names and
147  * datatypes from old version of FreeRTOS to their latest equivalent.  Defaults to
148  * 1 if left undefined. */
149 #define configENABLE_BACKWARD_COMPATIBILITY        0
150
151 /* Each task has its own array of pointers that can be used as thread local
152  * storage.  configNUM_THREAD_LOCAL_STORAGE_POINTERS set the number of indexes in
153  * the array.  See https://www.freertos.org/thread-local-storage-pointers.html
154  * Defaults to 0 if left undefined. */
155 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS    0
156
157 /* Sets the type used by the parameter to xTaskCreate() that specifies the stack
158  * size of the task being created.  The same type is used to return information
159  * about stack usage in various other API calls.  Defaults to size_t if left
160  * undefined. */
161 #define configSTACK_DEPTH_TYPE                     size_t
162
163 /* configMESSAGE_BUFFER_LENGTH_TYPE sets the type used to store the length of
164  *  each message written to a FreeRTOS message buffer (the length is also written to
165  *  the message buffer.  Defaults to size_t if left undefined - but that may waste
166  *  space if messages never go above a length that could be held in a uint8_t. */
167 #define configMESSAGE_BUFFER_LENGTH_TYPE           size_t
168
169 /* Set configUSE_NEWLIB_REENTRANT to 1 to have a newlib reent structure
170  * allocated for each task.  Set to 0 to not support newlib reent structures.
171  * Default to 0 if left undefined.
172  *
173  * Note Newlib support has been included by popular demand, but is not used or
174  * tested by the FreeRTOS maintainers themselves. FreeRTOS is not responsible for
175  * resulting newlib operation. User must be familiar with newlib and must provide
176  * system-wide implementations of the necessary stubs. Note that (at the time of
177  * writing) the current newlib design implements a system-wide malloc() that must
178  * be provided with locks. */
179 #define configUSE_NEWLIB_REENTRANT                 0
180
181 /******************************************************************************/
182 /* Software timer related definitions. ****************************************/
183 /******************************************************************************/
184
185 /* Set configUSE_TIMERS to 1 to include software timer functionality in the
186  * build.  Set to 0 to exclude software timer functionality from the build.  The
187  * FreeRTOS/source/timers.c source file must be included in the build if
188  * configUSE_TIMERS is set to 1.  Default to 0 if left undefined.  See
189  * https://www.freertos.org/RTOS-software-timer.html */
190 #define configUSE_TIMERS                1
191
192 /* configTIMER_TASK_PRIORITY sets the priority used by the timer task.  Only
193  * used if configUSE_TIMERS is set to 1.  The timer task is a standard FreeRTOS
194  * task, so its priority is set like any other task.  See
195  * https://www.freertos.org/RTOS-software-timer-service-daemon-task.html  Only used
196  * if configUSE_TIMERS is set to 1. */
197 #define configTIMER_TASK_PRIORITY       ( configMAX_PRIORITIES - 1 )
198
199 /* configTIMER_TASK_STACK_DEPTH sets the size of the stack allocated to the
200  * timer task (in words, not in bytes!).  The timer task is a standard FreeRTOS
201  * task.  See https://www.freertos.org/RTOS-software-timer-service-daemon-task.html
202  * Only used if configUSE_TIMERS is set to 1. */
203 #define configTIMER_TASK_STACK_DEPTH    configMINIMAL_STACK_SIZE
204
205 /* configTIMER_QUEUE_LENGTH sets the length of the queue (the number of discrete
206  * items the queue can hold) used to send commands to the timer task.  See
207  * https://www.freertos.org/RTOS-software-timer-service-daemon-task.html  Only used
208  * if configUSE_TIMERS is set to 1. */
209 #define configTIMER_QUEUE_LENGTH        10
210
211 /******************************************************************************/
212 /* Memory allocation related definitions. *************************************/
213 /******************************************************************************/
214
215 /* Set configSUPPORT_STATIC_ALLOCATION to 1 to include FreeRTOS API functions
216  * that create FreeRTOS objects (tasks, queues, etc.) using statically allocated
217  * memory in the build.  Set to 0 to exclude the ability to create statically
218  * allocated objects from the build.  Defaults to 0 if left undefined.  See
219  * https://www.freertos.org/Static_Vs_Dynamic_Memory_Allocation.html */
220 #define configSUPPORT_STATIC_ALLOCATION              1
221
222 /* Set configSUPPORT_DYNAMIC_ALLOCATION to 1 to include FreeRTOS API functions
223  * that create FreeRTOS objects (tasks, queues, etc.) using dynamically allocated
224  * memory in the build.  Set to 0 to exclude the ability to create dynamically
225  * allocated objects from the build.  Defaults to 1 if left undefined.  See
226  * https://www.freertos.org/Static_Vs_Dynamic_Memory_Allocation.html */
227 #define configSUPPORT_DYNAMIC_ALLOCATION             1
228
229 /* Sets the total size of the FreeRTOS heap, in bytes, when heap_1.c, heap_2.c
230  * or heap_4.c are included in the build.  This value is defaulted to 4096 bytes but
231  * it must be tailored to each application.  Note the heap will appear in the .bss
232  * section.  See https://www.freertos.org/a00111.html */
233 #define configTOTAL_HEAP_SIZE                        4096
234
235 /* Set configAPPLICATION_ALLOCATED_HEAP to 1 to have the application allocate
236  * the array used as the FreeRTOS heap.  Set to 0 to have the linker allocate the
237  * array used as the FreeRTOS heap.  Defaults to 0 if left undefined. */
238 #define configAPPLICATION_ALLOCATED_HEAP             0
239
240 /* Set configSTACK_ALLOCATION_FROM_SEPARATE_HEAP to 1 to have task stacks
241  * allocated from somewhere other than the FreeRTOS heap.  This is useful if you
242  * want to ensure stacks are held in fast memory.  Set to 0 to have task stacks
243  * come from the standard FreeRTOS heap.  The application writer must provide
244  * implementations for pvPortMallocStack() and vPortFreeStack() if set to 1.
245  * Defaults to 0 if left undefined. */
246 #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP    0
247
248 /******************************************************************************/
249 /* Interrupt nesting behaviour configuration. *********************************/
250 /******************************************************************************/
251
252 /* configKERNEL_INTERRUPT_PRIORITY sets the priority of the tick and context
253  * switch performing interrupts.  The default value is set to the highest interrupt
254  * priority (0).  Not supported by all FreeRTOS ports.  See
255  * https://www.freertos.org/RTOS-Cortex-M3-M4.html for information specific to ARM
256  * Cortex-M devices. */
257 #define configKERNEL_INTERRUPT_PRIORITY          0
258
259 /* configMAX_SYSCALL_INTERRUPT_PRIORITY sets the interrupt priority above which
260  * FreeRTOS API calls must not be made.  Interrupts above this priority are never
261  * disabled, so never delayed by RTOS activity.  The default value is set to the
262  * highest interrupt priority (0).  Not supported by all FreeRTOS ports.
263  * See https://www.freertos.org/RTOS-Cortex-M3-M4.html for information specific to
264  * ARM Cortex-M devices. */
265 #define configMAX_SYSCALL_INTERRUPT_PRIORITY     0
266
267 /* Another name for configMAX_SYSCALL_INTERRUPT_PRIORITY - the name used depends
268  * on the FreeRTOS port. */
269 #define configMAX_API_CALL_INTERRUPT_PRIORITY    0
270
271 /******************************************************************************/
272 /* Hook and callback function related definitions. ****************************/
273 /******************************************************************************/
274
275 /* Set the following configUSE_* constants to 1 to include the named hook
276  * functionality in the build.  Set to 0 to exclude the hook functionality from the
277  * build.  The application writer is responsible for providing the hook function
278  * for any set to 1.  See https://www.freertos.org/a00016.html */
279 #define configUSE_IDLE_HOOK                   0
280 #define configUSE_TICK_HOOK                   0
281 #define configUSE_MALLOC_FAILED_HOOK          0
282 #define configUSE_DAEMON_TASK_STARTUP_HOOK    0
283
284 /* Set configCHECK_FOR_STACK_OVERFLOW to 1 or 2 for FreeRTOS to check for a
285  * stack overflow at the time of a context switch.  Set to 0 to not look for a
286  * stack overflow.  If configCHECK_FOR_STACK_OVERFLOW is 1 then the check only
287  * looks for the stack pointer being out of bounds when a task's context is saved
288  * to its stack - this is fast but somewhat ineffective.  If
289  * configCHECK_FOR_STACK_OVERFLOW is 2 then the check looks for a pattern written
290  * to the end of a task's stack having been overwritten.  This is slower, but will
291  * catch most (but not all) stack overflows.  The application writer must provide
292  * the stack overflow callback when configCHECK_FOR_STACK_OVERFLOW is set to 1.
293  * See https://www.freertos.org/Stacks-and-stack-overflow-checking.html  Defaults
294  * to 0 if left undefined. */
295 #define configCHECK_FOR_STACK_OVERFLOW        2
296
297 /******************************************************************************/
298 /* Run time and task stats gathering related definitions. *********************/
299 /******************************************************************************/
300
301 /* Set configGENERATE_RUN_TIME_STATS to 1 to have FreeRTOS collect data on the
302 * processing time used by each task.  Set to 0 to not collect the data.  The
303 * application writer needs to provide a clock source if set to 1.  Defaults to 0
304 * if left undefined.  See https://www.freertos.org/rtos-run-time-stats.html */
305 #define configGENERATE_RUN_TIME_STATS           0
306
307 /* Set configUSE_TRACE_FACILITY to include additional task structure members
308  * are used by trace and visualisation functions and tools.  Set to 0 to exclude
309  * the additional information from the structures.  Defaults to 0 if left
310  * undefined. */
311 #define configUSE_TRACE_FACILITY                0
312
313 /* Set to 1 to include the vTaskList() and vTaskGetRunTimeStats() functions in
314  * the build.  Set to 0 to exclude these functions from the build.  These two
315  * functions introduce a dependency on string formatting functions that would
316  * otherwise not exist - hence they are kept separate.  Defaults to 0 if left
317  * undefined. */
318 #define configUSE_STATS_FORMATTING_FUNCTIONS    0
319
320 /******************************************************************************/
321 /* Debugging assistance. ******************************************************/
322 /******************************************************************************/
323
324 /* configASSERT() has the same semantics as the standard C assert().  It can
325  * either be defined to take an action when the assertion fails, or not defined
326  * at all (i.e. comment out or delete the definitions) to completely remove
327  * assertions.  configASSERT() can be defined to anything you want, for example
328  * you can call a function if an assert fails that passes the filename and line
329  * number of the failing assert (for example, "vAssertCalled( __FILE__, __LINE__ )"
330  * or it can simple disable interrupts and sit in a loop to halt all execution
331  * on the failing line for viewing in a debugger. */
332 #define configASSERT( x )         \
333     if( ( x ) == 0 )              \
334     {                             \
335         taskDISABLE_INTERRUPTS(); \
336         for( ; ; )                \
337         ;                         \
338     }
339
340 /******************************************************************************/
341 /* Cortex-M MPU specific definitions. *****************************************/
342 /******************************************************************************/
343
344 /* If configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS is set to 1 then
345  * the application writer can provide functions that execute in privileged mode.
346  * See: https://www.freertos.org/a00110.html#configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
347  * Defaults to 0 if left undefined.  Only used by the FreeRTOS Cortex-M MPU ports,
348  * not the standard ARMv7-M Cortex-M port. */
349 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS    0
350
351 /* Set configTOTAL_MPU_REGIONS to the number of MPU regions implemented on your
352  * target hardware.  Normally 8 or 16.  Only used by the FreeRTOS Cortex-M MPU
353  * ports, not the standard ARMv7-M Cortex-M port.  Defaults to 8 if left
354  * undefined. */
355 #define configTOTAL_MPU_REGIONS                                   8
356
357 /* configTEX_S_C_B_FLASH allows application writers to override the default
358  * values for the for TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits for
359  * the MPU region covering Flash.  Defaults to 0x07UL (which means TEX=000, S=1,
360  * C=1, B=1) if left undefined.  Only used by the FreeRTOS Cortex-M MPU ports, not
361  * the standard ARMv7-M Cortex-M port. */
362 #define configTEX_S_C_B_FLASH                                     0x07UL
363
364 /* configTEX_S_C_B_SRAM allows application writers to override the default
365  * values for the for TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits for
366  * the MPU region covering RAM. Defaults to 0x07UL (which means TEX=000, S=1, C=1,
367  * B=1) if left undefined.  Only used by the FreeRTOS Cortex-M MPU ports, not
368  * the standard ARMv7-M Cortex-M port. */
369 #define configTEX_S_C_B_SRAM                                      0x07UL
370
371 /* Set configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY to 0 to prevent any privilege
372  * escalations originating from outside of the kernel code itself.  Set to 1 to
373  * allow application tasks to raise privilege.  Defaults to 1 if left undefined.
374  * Only used by the FreeRTOS Cortex-M MPU ports, not the standard ARMv7-M Cortex-M
375  * port.*/
376 #define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY               1
377
378 /* Set configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS to 1 to allow unprivileged
379  * tasks enter critical sections (effectively mask interrupts).  Set to 0 to
380  * prevent unprivileged tasks entering critical sections.  Defaults to 1 if left
381  * undefined.  Only used by the FreeRTOS Cortex-M MPU ports, not the standard
382  * ARMv7-M Cortex-M port.*/
383 #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS                0
384
385 /******************************************************************************/
386 /* ARMv8-M secure side port related definitions. ******************************/
387 /******************************************************************************/
388
389 /* secureconfigMAX_SECURE_CONTEXTS define the maximum number of tasks that can
390  *  call into the secure side of an ARMv8-M chip.  Not used by any other ports. */
391 #define secureconfigMAX_SECURE_CONTEXTS    5
392
393 /******************************************************************************/
394 /* Definitions that include or exclude functionality. *************************/
395 /******************************************************************************/
396
397 /* Set the following configUSE_* constants to 1 to include the named feature in
398  * the build, or 0 to exclude the named feature from the build. */
399 #define configUSE_TASK_NOTIFICATIONS           1
400 #define configUSE_MUTEXES                      1
401 #define configUSE_RECURSIVE_MUTEXES            1
402 #define configUSE_COUNTING_SEMAPHORES          1
403 #define configUSE_QUEUE_SETS                   0
404 #define configUSE_APPLICATION_TASK_TAG         0
405
406 /* Set the following INCLUDE_* constants to 1 to incldue the named API function,
407  * or 0 to exclude the named API function.  Most linkers will remove unused
408  * functions even when the constant is 1. */
409 #define INCLUDE_vTaskPrioritySet               1
410 #define INCLUDE_uxTaskPriorityGet              1
411 #define INCLUDE_vTaskDelete                    1
412 #define INCLUDE_vTaskSuspend                   1
413 #define INCLUDE_xResumeFromISR                 1
414 #define INCLUDE_vTaskDelayUntil                1
415 #define INCLUDE_vTaskDelay                     1
416 #define INCLUDE_xTaskGetSchedulerState         1
417 #define INCLUDE_xTaskGetCurrentTaskHandle      1
418 #define INCLUDE_uxTaskGetStackHighWaterMark    0
419 #define INCLUDE_xTaskGetIdleTaskHandle         0
420 #define INCLUDE_eTaskGetState                  0
421 #define INCLUDE_xEventGroupSetBitFromISR       1
422 #define INCLUDE_xTimerPendFunctionCall         0
423 #define INCLUDE_xTaskAbortDelay                0
424 #define INCLUDE_xTaskGetHandle                 0
425 #define INCLUDE_xTaskResumeFromISR             1
426
427 #endif /* __FREERTOS_CONFIG_H__ */