xref: /aosp_15_r20/external/pigweed/targets/mimxrt595_evk_freertos/FreeRTOSConfig.h (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2021 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 
15 #pragma once
16 
17 // Disable formatting to make it easier to compare with other config files.
18 // clang-format off
19 
20 extern uint32_t SystemCoreClock;
21 
22 /*-----------------------------------------------------------
23  * Application specific definitions.
24  *
25  * These definitions should be adjusted for your particular hardware and
26  * application requirements.
27  *
28  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
29  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
30  *
31  * See http://www.freertos.org/a00110.html.
32  *----------------------------------------------------------*/
33 #ifndef configENABLE_FPU
34   #define configENABLE_FPU                      1
35 #endif
36 #ifndef configENABLE_MPU
37   #define configENABLE_MPU                      0
38 #endif
39 #ifndef configENABLE_TRUSTZONE
40   #define configENABLE_TRUSTZONE                0
41 #endif
42 #ifndef configRUN_FREERTOS_SECURE_ONLY
43   #define configRUN_FREERTOS_SECURE_ONLY        1
44 #endif
45 
46 #define configUSE_PREEMPTION                    1
47 #define configUSE_TICKLESS_IDLE                 0
48 #define configCPU_CLOCK_HZ                      (SystemCoreClock)
49 #define configTICK_RATE_HZ                      ((TickType_t)1000)
50 #define configMAX_PRIORITIES                    20
51 #define configMINIMAL_STACK_SIZE                ((unsigned short)256)
52 #define configMAX_TASK_NAME_LEN                 20
53 #define configUSE_16_BIT_TICKS                  0
54 #define configIDLE_SHOULD_YIELD                 1
55 #define configUSE_TASK_NOTIFICATIONS            1
56 #define configUSE_MUTEXES                       1
57 #define configUSE_RECURSIVE_MUTEXES             1
58 #define configUSE_COUNTING_SEMAPHORES           1
59 #define configUSE_ALTERNATIVE_API               0 /* Deprecated! */
60 #define configQUEUE_REGISTRY_SIZE               8
61 #define configUSE_QUEUE_SETS                    1
62 #define configUSE_TIME_SLICING                  1
63 #define configUSE_NEWLIB_REENTRANT              0
64 #define configENABLE_BACKWARD_COMPATIBILITY     1
65 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
66 #define configUSE_APPLICATION_TASK_TAG          0
67 
68 /* Used memory allocation (heap_x.c) */
69 #define configFRTOS_MEMORY_SCHEME               4
70 /* Tasks.c additions (e.g. Thread Aware Debug capability) */
71 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
72 
73 /* Memory allocation related definitions. */
74 #define configSUPPORT_STATIC_ALLOCATION         1
75 #define configSUPPORT_DYNAMIC_ALLOCATION        1
76 #define configTOTAL_HEAP_SIZE                   ((size_t)(200 * 1024))
77 #define configAPPLICATION_ALLOCATED_HEAP        0
78 
79 /* Hook function related definitions. */
80 #define configUSE_IDLE_HOOK                     0
81 #define configUSE_TICK_HOOK                     0
82 #define configCHECK_FOR_STACK_OVERFLOW          0
83 #define configUSE_MALLOC_FAILED_HOOK            0
84 #define configUSE_DAEMON_TASK_STARTUP_HOOK      0
85 
86 /* Run time and task stats gathering related definitions. */
87 #define configGENERATE_RUN_TIME_STATS           0
88 #define configUSE_TRACE_FACILITY                1
89 #define configUSE_STATS_FORMATTING_FUNCTIONS    1
90 
91 /* Task aware debugging. */
92 #define configRECORD_STACK_HIGH_ADDRESS         1
93 
94 /* Co-routine related definitions. */
95 #define configUSE_CO_ROUTINES                   0
96 #define configMAX_CO_ROUTINE_PRIORITIES         2
97 
98 /* Software timer related definitions. */
99 #define configUSE_TIMERS                        1
100 #define configTIMER_TASK_PRIORITY               (configMAX_PRIORITIES - 1)
101 #define configTIMER_QUEUE_LENGTH                10
102 #define configTIMER_TASK_STACK_DEPTH            (configMINIMAL_STACK_SIZE * 2)
103 
104 // Instead of defining configASSERT(), include a header that provides a
105 // definition that redirects to pw_assert.
106 #include "pw_third_party/freertos/config_assert.h"
107 
108 /* Optional functions - most linkers will remove unused functions anyway. */
109 #define INCLUDE_vTaskPrioritySet                1
110 #define INCLUDE_uxTaskPriorityGet               1
111 #define INCLUDE_vTaskDelete                     1
112 #define INCLUDE_vTaskSuspend                    1
113 #define INCLUDE_xResumeFromISR                  1
114 #define INCLUDE_vTaskDelayUntil                 1
115 #define INCLUDE_vTaskDelay                      1
116 #define INCLUDE_xTaskGetSchedulerState          1
117 #define INCLUDE_xTaskGetCurrentTaskHandle       1
118 #define INCLUDE_uxTaskGetStackHighWaterMark     0
119 #define INCLUDE_xTaskGetIdleTaskHandle          0
120 #define INCLUDE_eTaskGetState                   0
121 #define INCLUDE_xEventGroupSetBitFromISR        1
122 #define INCLUDE_xTimerPendFunctionCall          1
123 #define INCLUDE_xTaskAbortDelay                 0
124 #define INCLUDE_xTaskGetHandle                  0
125 #define INCLUDE_xTaskResumeFromISR              1
126 
127 #ifdef __NVIC_PRIO_BITS
128 /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
129 #define configPRIO_BITS __NVIC_PRIO_BITS
130 #else
131 #define configPRIO_BITS 4 /* 15 priority levels */
132 #endif
133 
134 /* The lowest interrupt priority that can be used in a call to a "set priority"
135 function. */
136 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1U << (configPRIO_BITS)) - 1)
137 
138 /* The highest interrupt priority that can be used by any interrupt service
139 routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
140 INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
141 PRIORITY THAN THIS! (higher priorities are lower numeric values. */
142 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
143 
144 /* Interrupt priorities used by the kernel port layer itself.  These are generic
145 to all Cortex-M ports, and do not rely on any particular library functions. */
146 #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
147 /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
148 See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
149 #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
150 
151 /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
152 standard names. */
153 #define vPortSVCHandler SVC_Handler
154 #define vPortPendSVHandler PendSV_Handler
155 #define vPortSysTickHandler SysTick_Handler
156