xref: /aosp_15_r20/external/pigweed/targets/rp2040/config/FreeRTOSConfig.h (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2022 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 #pragma once
15 
16 #include <stdint.h>
17 
18 // Disable formatting to make it easier to compare with other config files.
19 // clang-format off
20 
21 extern uint32_t SystemCoreClock;
22 
23 #define vPortSVCHandler         SVC_Handler
24 #define xPortPendSVHandler      PendSV_Handler
25 #define xPortSysTickHandler     SysTick_Handler
26 
27 #if defined(__ARM_FP) && __ARM_FP
28 #define configENABLE_FPU                        1
29 #else
30 #define configENABLE_FPU                        0
31 #endif  // defined(__ARM_FP) && __ARM_FP
32 
33 // TODO: https://pwbug.dev/353570428 - Set up the MPU.
34 #define configENABLE_MPU                        0
35 #define configENABLE_TRUSTZONE                  0
36 #define configRUN_FREERTOS_SECURE_ONLY          1
37 
38 #define configUSE_PREEMPTION                    1
39 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
40 #define configUSE_TICKLESS_IDLE                 0
41 #if defined(_PW_PICO_GN_BUILD) && _PW_PICO_GN_BUILD
42 // GN Pico build is less complete than Bazel, so SystemCoreClock isn't properly
43 // referenced.
44 #define configCPU_CLOCK_HZ                      133000000
45 #else
46 #define configCPU_CLOCK_HZ                      (SystemCoreClock)
47 #endif  // defined(_PW_PICO_GN_BUILD) && _PW_PICO_GN_BUILD
48 #define configTICK_RATE_HZ                      ((TickType_t)1000)
49 #define configMAX_PRIORITIES                    5
50 #define configMINIMAL_STACK_SIZE                ((uint32_t)(256))
51 #define configMAX_TASK_NAME_LEN                 16
52 #define configUSE_16_BIT_TICKS                  0
53 #define configIDLE_SHOULD_YIELD                 1
54 #define configUSE_TASK_NOTIFICATIONS            1
55 #define configTASK_NOTIFICATION_ARRAY_ENTRIES   3
56 #define configUSE_MUTEXES                       1
57 #define configUSE_RECURSIVE_MUTEXES             0
58 #define configUSE_COUNTING_SEMAPHORES           1
59 #define configQUEUE_REGISTRY_SIZE               10
60 #define configUSE_QUEUE_SETS                    0
61 #define configUSE_TIME_SLICING                  1
62 #define configUSE_NEWLIB_REENTRANT              0
63 #define configENABLE_BACKWARD_COMPATIBILITY     0
64 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
65 #define configSTACK_DEPTH_TYPE                  uint32_t
66 #define configMESSAGE_BUFFER_LENGTH_TYPE        size_t
67 
68 #define configSUPPORT_STATIC_ALLOCATION         1
69 #define configSUPPORT_DYNAMIC_ALLOCATION        0
70 #define configTOTAL_HEAP_SIZE                   ((size_t)(1 * 1024))
71 #define configAPPLICATION_ALLOCATED_HEAP        1
72 
73 #define configUSE_IDLE_HOOK                     0
74 #define configUSE_TICK_HOOK                     0
75 #define configCHECK_FOR_STACK_OVERFLOW          0
76 #define configUSE_MALLOC_FAILED_HOOK            0
77 #define configUSE_DAEMON_TASK_STARTUP_HOOK      0
78 
79 #define configGENERATE_RUN_TIME_STATS           0
80 // #define portGET_RUN_TIME_COUNTER_VALUE          getRunTimeCounterValue
81 #define configUSE_TRACE_FACILITY                0
82 #define configUSE_STATS_FORMATTING_FUNCTIONS    0
83 
84 #define configUSE_CO_ROUTINES                   0
85 #define configMAX_CO_ROUTINE_PRIORITIES         1
86 
87 #define configUSE_TIMERS                        1
88 #define configTIMER_TASK_PRIORITY               3
89 #define configTIMER_QUEUE_LENGTH                10
90 #define configTIMER_TASK_STACK_DEPTH            configMINIMAL_STACK_SIZE
91 
92 #define configRECORD_STACK_HIGH_ADDRESS         1
93 
94 /* __NVIC_PRIO_BITS in CMSIS */
95 #define configPRIO_BITS 4
96 
97 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1U << (configPRIO_BITS)) - 1)
98 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
99 #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
100 #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
101 
102 // Instead of defining configASSERT(), include a header that provides a
103 // definition that redirects to pw_assert.
104 #include "pw_third_party/freertos/config_assert.h"
105 
106 #define INCLUDE_vTaskPrioritySet                1
107 #define INCLUDE_uxTaskPriorityGet               1
108 #define INCLUDE_vTaskDelete                     1
109 #define INCLUDE_vTaskSuspend                    1
110 #define INCLUDE_xResumeFromISR                  1
111 #define INCLUDE_vTaskDelayUntil                 1
112 #define INCLUDE_vTaskDelay                      1
113 #define INCLUDE_xTaskGetSchedulerState          1
114 #define INCLUDE_xTaskGetCurrentTaskHandle       1
115 #define INCLUDE_uxTaskGetStackHighWaterMark     1
116 #define INCLUDE_xTaskGetIdleTaskHandle          0
117 #define INCLUDE_eTaskGetState                   0
118 #define INCLUDE_xEventGroupSetBitFromISR        1
119 #define INCLUDE_xTimerPendFunctionCall          0
120 #define INCLUDE_xTaskAbortDelay                 0
121 #define INCLUDE_xTaskGetHandle                  0
122 #define INCLUDE_xTaskResumeFromISR              1
123