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