|
59 | 59 | #include <rthw.h> |
60 | 60 |
|
61 | 61 | /* Application specific configuration options. */ |
62 | | -#include "FreeRTOSConfig.h" |
| 62 | +#ifdef PKG_FREERTOS_USING_CONFIG_H |
| 63 | + #include <FreeRTOSConfig.h> |
| 64 | +#endif |
63 | 65 |
|
64 | 66 | /* Basic FreeRTOS definitions. */ |
65 | 67 | #include "projdefs.h" |
|
77 | 79 | #include <reent.h> |
78 | 80 | #endif |
79 | 81 |
|
80 | | -/* |
81 | | - * Check all the required application specific macros have been defined. |
82 | | - * These macros are application specific and (as downloaded) are defined |
83 | | - * within FreeRTOSConfig.h. |
84 | | - */ |
| 82 | +/* RT-Thread inherent definations */ |
| 83 | +#define configUSE_PREEMPTION 1 |
| 84 | +#define configUSE_TIME_SLICING 1 |
| 85 | +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 |
| 86 | +#define configUSE_16_BIT_TICKS 0 |
85 | 87 |
|
| 88 | +#define configTICK_RATE_HZ RT_TICK_PER_SECOND |
| 89 | +#define configMAX_PRIORITIES RT_THREAD_PRIORITY_MAX |
| 90 | +#define configMAX_TASK_NAME_LEN RT_NAME_MAX |
| 91 | +#define configASSERT( x ) RT_ASSERT( x ) |
| 92 | +#define configASSERT_DEFINED 1 |
86 | 93 | #ifndef configMINIMAL_STACK_SIZE |
87 | | - #error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value. |
| 94 | + #define configMINIMAL_STACK_SIZE 128 |
88 | 95 | #endif |
89 | 96 |
|
90 | | -#ifndef configMAX_PRIORITIES |
91 | | - #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details. |
| 97 | +#if defined(PKG_FREERTOS_USING_MEMMANG_HEAP1) || |
| 98 | + defined(PKG_FREERTOS_USING_MEMMANG_HEAP2) || |
| 99 | + defined(PKG_FREERTOS_USING_MEMMANG_HEAP4) |
| 100 | + #ifndef configTOTAL_HEAP_SIZE |
| 101 | + #define configTOTAL_HEAP_SIZE 10240 |
| 102 | + #endif |
| 103 | + #ifndef configAPPLICATION_ALLOCATED_HEAP |
| 104 | + #define configAPPLICATION_ALLOCATED_HEAP 0 |
| 105 | + #endif |
92 | 106 | #endif |
93 | 107 |
|
94 | | -#if configMAX_PRIORITIES < 1 |
95 | | - #error configMAX_PRIORITIES must be defined to be greater than or equal to 1. |
| 108 | +#if defined(PKG_FREERTOS_USING_MEMMANG_HEAP4) || |
| 109 | + defined(PKG_FREERTOS_USING_MEMMANG_HEAP5) |
| 110 | + #ifndef configUSE_FREERTOS_PROVIDED_HEAP |
| 111 | + #define configUSE_FREERTOS_PROVIDED_HEAP 1 |
| 112 | + #endif |
96 | 113 | #endif |
97 | 114 |
|
98 | | -#ifndef configUSE_PREEMPTION |
99 | | - #error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. |
100 | | -#endif |
| 115 | +/* Hook functions are not supported by RT-Thread */ |
| 116 | +#define configUSE_IDLE_HOOK 0 |
| 117 | +#define configUSE_TICK_HOOK 0 |
| 118 | +#define configCHECK_FOR_STACK_OVERFLOW 0 |
| 119 | +#define configUSE_MALLOC_FAILED_HOOK 0 |
| 120 | +#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 |
| 121 | + |
| 122 | +/* The following features are not supported by RT-Thread */ |
| 123 | +#define INCLUDE_xTimerPendFunctionCall 0 |
| 124 | +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0 |
| 125 | +#define configUSE_CO_ROUTINES 0 |
| 126 | +#define configQUEUE_REGISTRY_SIZE 0 |
| 127 | +#define configUSE_QUEUE_SETS 0 |
| 128 | +#define configUSE_TICKLESS_IDLE 0 |
| 129 | +#define configGENERATE_RUN_TIME_STATS 0 |
| 130 | +#define configUSE_TRACE_FACILITY 0 |
| 131 | +#define configUSE_STATS_FORMATTING_FUNCTIONS 0 |
| 132 | + |
| 133 | +/* |
| 134 | + * Check all the required application specific macros have been defined. |
| 135 | + * These macros are application specific and (as downloaded) are defined |
| 136 | + * within FreeRTOSConfig.h. |
| 137 | + */ |
101 | 138 |
|
102 | 139 | #ifndef configUSE_IDLE_HOOK |
103 | 140 | #error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. |
|
107 | 144 | #error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. |
108 | 145 | #endif |
109 | 146 |
|
110 | | -#ifndef configUSE_16_BIT_TICKS |
111 | | - #error Missing definition: configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. |
112 | | -#endif |
113 | | - |
114 | 147 | #ifndef configUSE_CO_ROUTINES |
115 | 148 | #define configUSE_CO_ROUTINES 0 |
116 | 149 | #endif |
117 | 150 |
|
118 | 151 | #ifndef INCLUDE_vTaskPrioritySet |
119 | | - #define INCLUDE_vTaskPrioritySet 0 |
| 152 | + #define INCLUDE_vTaskPrioritySet 1 |
120 | 153 | #endif |
121 | 154 |
|
122 | 155 | #ifndef INCLUDE_uxTaskPriorityGet |
123 | | - #define INCLUDE_uxTaskPriorityGet 0 |
| 156 | + #define INCLUDE_uxTaskPriorityGet 1 |
124 | 157 | #endif |
125 | 158 |
|
126 | 159 | #ifndef INCLUDE_vTaskDelete |
127 | | - #define INCLUDE_vTaskDelete 0 |
| 160 | + #define INCLUDE_vTaskDelete 1 |
128 | 161 | #endif |
129 | 162 |
|
130 | 163 | #ifndef INCLUDE_vTaskSuspend |
131 | | - #define INCLUDE_vTaskSuspend 0 |
| 164 | + #define INCLUDE_vTaskSuspend 1 |
132 | 165 | #endif |
133 | 166 |
|
134 | 167 | #ifdef INCLUDE_xTaskDelayUntil |
|
154 | 187 | #endif |
155 | 188 |
|
156 | 189 | #ifndef INCLUDE_xTaskDelayUntil |
157 | | - #define INCLUDE_xTaskDelayUntil 0 |
| 190 | + #define INCLUDE_xTaskDelayUntil 1 |
158 | 191 | #endif |
159 | 192 |
|
160 | 193 | #ifndef INCLUDE_vTaskDelay |
161 | | - #define INCLUDE_vTaskDelay 0 |
| 194 | + #define INCLUDE_vTaskDelay 1 |
162 | 195 | #endif |
163 | 196 |
|
164 | 197 | #ifndef INCLUDE_xTaskGetIdleTaskHandle |
165 | | - #define INCLUDE_xTaskGetIdleTaskHandle 0 |
| 198 | + #define INCLUDE_xTaskGetIdleTaskHandle 1 |
166 | 199 | #endif |
167 | 200 |
|
168 | 201 | #ifndef INCLUDE_xTaskAbortDelay |
169 | | - #define INCLUDE_xTaskAbortDelay 0 |
| 202 | + #define INCLUDE_xTaskAbortDelay 1 |
170 | 203 | #endif |
171 | 204 |
|
172 | 205 | #ifndef INCLUDE_xQueueGetMutexHolder |
173 | | - #define INCLUDE_xQueueGetMutexHolder 0 |
| 206 | + #define INCLUDE_xQueueGetMutexHolder 1 |
174 | 207 | #endif |
175 | 208 |
|
176 | 209 | #ifndef INCLUDE_xSemaphoreGetMutexHolder |
177 | 210 | #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder |
178 | 211 | #endif |
179 | 212 |
|
180 | 213 | #ifndef INCLUDE_xTaskGetHandle |
181 | | - #define INCLUDE_xTaskGetHandle 0 |
| 214 | + #define INCLUDE_xTaskGetHandle 1 |
182 | 215 | #endif |
183 | 216 |
|
184 | 217 | #ifndef INCLUDE_uxTaskGetStackHighWaterMark |
185 | | - #define INCLUDE_uxTaskGetStackHighWaterMark 0 |
| 218 | + #define INCLUDE_uxTaskGetStackHighWaterMark 1 |
186 | 219 | #endif |
187 | 220 |
|
188 | 221 | #ifndef INCLUDE_uxTaskGetStackHighWaterMark2 |
189 | | - #define INCLUDE_uxTaskGetStackHighWaterMark2 0 |
| 222 | + #define INCLUDE_uxTaskGetStackHighWaterMark2 1 |
190 | 223 | #endif |
191 | 224 |
|
192 | 225 | #ifndef INCLUDE_eTaskGetState |
193 | | - #define INCLUDE_eTaskGetState 0 |
| 226 | + #define INCLUDE_eTaskGetState 1 |
194 | 227 | #endif |
195 | 228 |
|
196 | 229 | #ifndef INCLUDE_xTaskResumeFromISR |
|
202 | 235 | #endif |
203 | 236 |
|
204 | 237 | #ifndef INCLUDE_xTaskGetSchedulerState |
205 | | - #define INCLUDE_xTaskGetSchedulerState 0 |
| 238 | + #define INCLUDE_xTaskGetSchedulerState 1 |
206 | 239 | #endif |
207 | 240 |
|
208 | 241 | #ifndef INCLUDE_xTaskGetCurrentTaskHandle |
209 | | - #define INCLUDE_xTaskGetCurrentTaskHandle 0 |
| 242 | + #define INCLUDE_xTaskGetCurrentTaskHandle 1 |
210 | 243 | #endif |
211 | 244 |
|
212 | 245 | #if configUSE_CO_ROUTINES != 0 |
|
220 | 253 | #endif |
221 | 254 |
|
222 | 255 | #ifndef configUSE_APPLICATION_TASK_TAG |
223 | | - #define configUSE_APPLICATION_TASK_TAG 0 |
| 256 | + #define configUSE_APPLICATION_TASK_TAG 1 |
224 | 257 | #endif |
225 | 258 |
|
226 | 259 | #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS |
227 | 260 | #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0 |
228 | 261 | #endif |
229 | 262 |
|
230 | 263 | #ifndef configUSE_RECURSIVE_MUTEXES |
231 | | - #define configUSE_RECURSIVE_MUTEXES 0 |
| 264 | + #ifdef RT_USING_MUTEX |
| 265 | + #define configUSE_RECURSIVE_MUTEXES 1 |
| 266 | + #else |
| 267 | + #define configUSE_RECURSIVE_MUTEXES 0 |
| 268 | + #endif |
232 | 269 | #endif |
233 | 270 |
|
234 | 271 | #ifndef configUSE_MUTEXES |
235 | | - #define configUSE_MUTEXES 0 |
| 272 | + #ifdef RT_USING_MUTEX |
| 273 | + #define configUSE_MUTEXES 1 |
| 274 | + #else |
| 275 | + #define configUSE_MUTEXES 0 |
| 276 | + #endif |
236 | 277 | #endif |
237 | 278 |
|
238 | 279 | #ifndef configUSE_TIMERS |
239 | | - #define configUSE_TIMERS 0 |
| 280 | + #ifdef RT_USING_TIMER_SOFT |
| 281 | + #define configUSE_TIMERS 1 |
| 282 | + #else |
| 283 | + #define configUSE_TIMERS 0 |
| 284 | + #endif |
240 | 285 | #endif |
241 | 286 |
|
242 | 287 | #ifndef configUSE_COUNTING_SEMAPHORES |
243 | | - #define configUSE_COUNTING_SEMAPHORES 0 |
| 288 | + #ifdef RT_USING_SEMAPHORE |
| 289 | + #define configUSE_COUNTING_SEMAPHORES 1 |
| 290 | + #else |
| 291 | + #define configUSE_COUNTING_SEMAPHORES 0 |
| 292 | + #endif |
244 | 293 | #endif |
245 | 294 |
|
246 | 295 | #ifndef configUSE_ALTERNATIVE_API |
|
251 | 300 | #define portCRITICAL_NESTING_IN_TCB 0 |
252 | 301 | #endif |
253 | 302 |
|
254 | | -#ifndef configMAX_TASK_NAME_LEN |
255 | | - #define configMAX_TASK_NAME_LEN 16 |
256 | | -#endif |
257 | | - |
258 | 303 | #ifndef configIDLE_SHOULD_YIELD |
259 | 304 | #define configIDLE_SHOULD_YIELD 1 |
260 | 305 | #endif |
261 | 306 |
|
262 | | -#if configMAX_TASK_NAME_LEN < 1 |
263 | | - #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h |
264 | | -#endif |
265 | | - |
266 | | -#ifndef configASSERT |
267 | | - #define configASSERT( x ) |
268 | | - #define configASSERT_DEFINED 0 |
269 | | -#else |
270 | | - #define configASSERT_DEFINED 1 |
271 | | -#endif |
272 | | - |
273 | 307 | /* configPRECONDITION should be defined as configASSERT. |
274 | 308 | * The CBMC proofs need a way to track assumptions and assertions. |
275 | 309 | * A configPRECONDITION statement should express an implicit invariant or |
|
292 | 326 |
|
293 | 327 | /* The timers module relies on xTaskGetSchedulerState(). */ |
294 | 328 | #if configUSE_TIMERS == 1 |
295 | | - |
296 | | - #ifndef configTIMER_TASK_PRIORITY |
297 | | - #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined. |
298 | | - #endif /* configTIMER_TASK_PRIORITY */ |
299 | | - |
300 | | - #ifndef configTIMER_QUEUE_LENGTH |
301 | | - #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined. |
302 | | - #endif /* configTIMER_QUEUE_LENGTH */ |
303 | | - |
304 | | - #ifndef configTIMER_TASK_STACK_DEPTH |
305 | | - #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined. |
306 | | - #endif /* configTIMER_TASK_STACK_DEPTH */ |
307 | | - |
| 329 | + #define configTIMER_TASK_PRIORITY (RT_THREAD_PRIORITY_MAX - 1 - RT_TIMER_THREAD_PRIO) |
| 330 | + #define configTIMER_QUEUE_LENGTH 0 /* RT-Thread does not use a timer queue. This option is not used. */ |
| 331 | + #define configTIMER_TASK_STACK_DEPTH RT_TIMER_THREAD_STACK_SIZE |
308 | 332 | #endif /* configUSE_TIMERS */ |
309 | 333 |
|
310 | 334 | #ifndef portSET_INTERRUPT_MASK_FROM_ISR |
|
847 | 871 | #define portDONT_DISCARD |
848 | 872 | #endif |
849 | 873 |
|
850 | | -#ifndef configUSE_TIME_SLICING |
851 | | - #define configUSE_TIME_SLICING 1 |
852 | | -#endif |
853 | | - |
854 | 874 | #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS |
855 | 875 | #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0 |
856 | 876 | #endif |
|
879 | 899 | #define portASSERT_IF_IN_ISR() |
880 | 900 | #endif |
881 | 901 |
|
882 | | -#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION |
883 | | - #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 |
884 | | -#endif |
885 | | - |
886 | 902 | #ifndef configAPPLICATION_ALLOCATED_HEAP |
887 | 903 | #define configAPPLICATION_ALLOCATED_HEAP 0 |
888 | 904 | #endif |
889 | 905 |
|
890 | 906 | #ifndef configUSE_TASK_NOTIFICATIONS |
891 | | - #define configUSE_TASK_NOTIFICATIONS 1 |
| 907 | + #define configUSE_TASK_NOTIFICATIONS 1 |
892 | 908 | #endif |
893 | 909 |
|
894 | 910 | #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES |
895 | | - #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1 |
| 911 | + #define configTASK_NOTIFICATION_ARRAY_ENTRIES 3 |
896 | 912 | #endif |
897 | 913 |
|
898 | 914 | #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1 |
|
908 | 924 | #endif |
909 | 925 |
|
910 | 926 | #ifndef configSUPPORT_STATIC_ALLOCATION |
911 | | - /* Defaults to 0 for backward compatibility. */ |
912 | | - #define configSUPPORT_STATIC_ALLOCATION 0 |
| 927 | + #define configSUPPORT_STATIC_ALLOCATION 1 |
913 | 928 | #endif |
914 | 929 |
|
| 930 | +//TODO: using rt-thread rt_malloc/rt_free by default |
915 | 931 | #ifndef configSUPPORT_DYNAMIC_ALLOCATION |
916 | | - /* Defaults to 1 for backward compatibility. */ |
917 | | - #define configSUPPORT_DYNAMIC_ALLOCATION 1 |
| 932 | + #ifdef RT_USING_HEAP |
| 933 | + #define configSUPPORT_DYNAMIC_ALLOCATION 1 |
| 934 | + #else |
| 935 | + #define configSUPPORT_DYNAMIC_ALLOCATION 0 |
| 936 | + #endif |
918 | 937 | #endif |
919 | 938 |
|
920 | 939 | #ifndef configSTACK_DEPTH_TYPE |
|
0 commit comments