FreeRTOSConfig.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /*
  2. *
  3. * Copyright (c) 2022 Project CHIP Authors
  4. * All rights reserved.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef FREERTOS_CONFIG_H
  19. #define FREERTOS_CONFIG_H
  20. /*-----------------------------------------------------------
  21. * Application specific definitions.
  22. *
  23. * These definitions should be adjusted for your particular hardware and
  24. * application requirements.
  25. *
  26. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
  27. * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
  28. *
  29. * See http://www.freertos.org/a00110.html
  30. *----------------------------------------------------------*/
  31. #if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
  32. #include <stdint.h>
  33. extern uint32_t SystemCoreClock;
  34. #endif
  35. // <o>Minimal stack size [words] <0-65535>
  36. // <i> Stack for idle task and default task stack in words.
  37. // <i> Default: 128
  38. #define configMINIMAL_STACK_SIZE ((uint16_t)(4 * 1024))
  39. // <o>Total heap size [bytes] <0-0xFFFFFFFF>
  40. // <i> Heap memory size in bytes.
  41. // <i> Default: 8192
  42. #define configTOTAL_HEAP_SIZE ((size_t) 8192)
  43. // <o>Kernel tick frequency [Hz] <0-0xFFFFFFFF>
  44. // <i> Kernel tick rate in Hz.
  45. // <i> Default: 1000
  46. #define configTICK_RATE_HZ ((TickType_t) 1000)
  47. // <o>Timer task stack depth [words] <0-65535>
  48. // <i> Stack for timer task in words.
  49. // <i> Default: 80
  50. #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
  51. // <o>Timer task priority <0-56>
  52. // <i> Timer task priority.
  53. // <i> Default: 40 (High)
  54. #define configTIMER_TASK_PRIORITY 40
  55. // <o>Timer queue length <0-1024>
  56. // <i> Timer command queue length.
  57. // <i> Default: 5
  58. #define configTIMER_QUEUE_LENGTH 5
  59. // <o>Preemption interrupt priority
  60. // <i> Maximum priority of interrupts that are safe to call FreeRTOS API.
  61. // <i> Default: 16
  62. #define configMAX_SYSCALL_INTERRUPT_PRIORITY (5 << (8 - configPRIO_BITS))
  63. // <q>Use time slicing
  64. // <i> Enable setting to use timeslicing.
  65. // <i> Default: 1
  66. #define configUSE_TIME_SLICING 1
  67. // <q>Idle should yield
  68. // <i> Control Yield behaviour of the idle task.
  69. // <i> Default: 1
  70. #define configIDLE_SHOULD_YIELD 1
  71. // <o>Check for stack overflow
  72. // <0=>Disable <1=>Method one <2=>Method two
  73. // <i> Enable or disable stack overflow checking.
  74. // <i> Callback function vApplicationStackOverflowHook implementation is required when stack checking is enabled.
  75. // <i> Default: 0
  76. #define configCHECK_FOR_STACK_OVERFLOW 2
  77. // <q>Use idle hook
  78. // <i> Enable callback function call on each idle task iteration.
  79. // <i> Callback function vApplicationIdleHook implementation is required when idle hook is enabled.
  80. // <i> Default: 0
  81. #define configUSE_IDLE_HOOK 0
  82. // <q>Use tick hook
  83. // <i> Enable callback function call during each tick interrupt.
  84. // <i> Callback function vApplicationTickHook implementation is required when tick hook is enabled.
  85. // <i> Default: 0
  86. #define configUSE_TICK_HOOK 0
  87. // <q>Use deamon task startup hook
  88. // <i> Enable callback function call when timer service starts.
  89. // <i> Callback function vApplicationDaemonTaskStartupHook implementation is required when deamon task startup hook is
  90. // enabled. <i> Default: 0
  91. #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
  92. // <q>Use malloc failed hook
  93. // <i> Enable callback function call when out of dynamic memory.
  94. // <i> Callback function vApplicationMallocFailedHook implementation is required when malloc failed hook is enabled.
  95. // <i> Default: 0
  96. #define configUSE_MALLOC_FAILED_HOOK 0
  97. // <o>Queue registry size
  98. // <i> Define maximum number of queue objects registered for debug purposes.
  99. // <i> The queue registry is used by kernel aware debuggers to locate queue and semaphore structures and display
  100. // associated text names. <i> Default: 0
  101. #define configQUEUE_REGISTRY_SIZE 0
  102. // <h>Event Recorder configuration
  103. // <i> Initialize and setup Event Recorder level filtering.
  104. // <i> Settings have no effect when Event Recorder is not present.
  105. // <q>Initialize Event Recorder
  106. // <i> Initialize Event Recorder before FreeRTOS kernel start.
  107. // <i> Default: 1
  108. #define configEVR_INITIALIZE 1
  109. // <e>Setup recording level filter
  110. // <i> Enable configuration of FreeRTOS events recording level
  111. // <i> Default: 1
  112. #define configEVR_SETUP_LEVEL 1
  113. // <o>Tasks functions
  114. // <i> Define event recording level bitmask for events generated from Tasks functions.
  115. // <i> Default: 0x05
  116. // <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All
  117. #define configEVR_LEVEL_TASKS 0x05
  118. // <o>Queue functions
  119. // <i> Define event recording level bitmask for events generated from Queue functions.
  120. // <i> Default: 0x05
  121. // <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All
  122. #define configEVR_LEVEL_QUEUE 0x05
  123. // <o>Timer functions
  124. // <i> Define event recording level bitmask for events generated from Timer functions.
  125. // <i> Default: 0x05
  126. // <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All
  127. #define configEVR_LEVEL_TIMERS 0x05
  128. // <o>Event Groups functions
  129. // <i> Define event recording level bitmask for events generated from Event Groups functions.
  130. // <i> Default: 0x05
  131. // <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All
  132. #define configEVR_LEVEL_EVENTGROUPS 0x05
  133. // <o>Heap functions
  134. // <i> Define event recording level bitmask for events generated from Heap functions.
  135. // <i> Default: 0x05
  136. // <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All
  137. #define configEVR_LEVEL_HEAP 0x05
  138. // <o>Stream Buffer functions
  139. // <i> Define event recording level bitmask for events generated from Stream Buffer functions.
  140. // <i> Default: 0x05
  141. // <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All
  142. #define configEVR_LEVEL_STREAMBUFFER 0x05
  143. // </e>
  144. // </h>
  145. // <h> Port Specific Features
  146. // <i> Enable and configure port specific features.
  147. // <i> Check FreeRTOS documentation for definitions that apply for the used port.
  148. // <q>Use Floating Point Unit
  149. // <i> Using Floating Point Unit (FPU) affects context handling.
  150. // <i> Enable FPU when application uses floating point operations.
  151. // <i> Default: 1
  152. #define configENABLE_FPU 1
  153. // <q>Use Memory Protection Unit
  154. // <i> Using Memory Protection Unit (MPU) requires detailed memory map definition.
  155. // <i> This setting is only releavant for MPU enabled ports.
  156. // <i> Default: 0
  157. #define configENABLE_MPU 0
  158. // <q> Use TrustZone Secure Side Only
  159. // <i> This settings prevents FreeRTOS contex switch to Non-Secure side.
  160. // <i> Enable this setting when FreeRTOS runs on the Secure side only.
  161. #define configRUN_FREERTOS_SECURE_ONLY 0
  162. // <q>Use TrustZone Security Extension
  163. // <i> Using TrustZone affects context handling.
  164. // <i> Enable TrustZone when FreeRTOS runs on the Non-Secure side and calls functions from the Secure side.
  165. // <i> Default: 1
  166. #define configENABLE_TRUSTZONE 0
  167. // <o>Minimal secure stack size [words] <0-65535>
  168. // <i> Stack for idle task Secure side context in words.
  169. // <i> This setting is only relevant when TrustZone extension is enabled.
  170. // <i> Default: 128
  171. #define configMINIMAL_SECURE_STACK_SIZE ((uint32_t) 128)
  172. // </h>
  173. #ifdef __NVIC_PRIO_BITS
  174. #define configPRIO_BITS __NVIC_PRIO_BITS
  175. #else
  176. #define configPRIO_BITS 4
  177. #endif
  178. //------------- <<< end of configuration section >>> ---------------------------
  179. /* Defines needed by FreeRTOS to implement CMSIS RTOS2 API. Do not change! */
  180. #define configCPU_CLOCK_HZ (SystemCoreClock)
  181. #define configSUPPORT_STATIC_ALLOCATION 1
  182. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  183. #define configUSE_PREEMPTION 1
  184. #define configUSE_TIMERS 1
  185. #define configUSE_MUTEXES 1
  186. #define configUSE_RECURSIVE_MUTEXES 1
  187. #define configUSE_COUNTING_SEMAPHORES 1
  188. #define configUSE_TASK_NOTIFICATIONS 1
  189. #define configUSE_TRACE_FACILITY 1
  190. #define configUSE_16_BIT_TICKS 0
  191. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
  192. #define configMAX_PRIORITIES 56
  193. #define configKERNEL_INTERRUPT_PRIORITY (0x07 << (8 - configPRIO_BITS))
  194. /* Defines that include FreeRTOS functions which implement CMSIS RTOS2 API. Do not change! */
  195. #define INCLUDE_xEventGroupSetBitsFromISR 1
  196. #define INCLUDE_xSemaphoreGetMutexHolder 1
  197. #define INCLUDE_vTaskDelay 1
  198. #define INCLUDE_xTaskDelayUntil 1
  199. #define INCLUDE_vTaskDelete 1
  200. #define INCLUDE_xTaskGetCurrentTaskHandle 1
  201. #define INCLUDE_xTaskGetSchedulerState 1
  202. #define INCLUDE_uxTaskGetStackHighWaterMark 1
  203. #define INCLUDE_uxTaskPriorityGet 1
  204. #define INCLUDE_vTaskPrioritySet 1
  205. #define INCLUDE_eTaskGetState 1
  206. #define INCLUDE_vTaskSuspend 1
  207. #define INCLUDE_xTimerPendFunctionCall 1
  208. /* Map the FreeRTOS port interrupt handlers to their CMSIS standard names. */
  209. #define xPortPendSVHandler PendSV_Handler
  210. #define vPortSVCHandler SVC_Handler
  211. /* Ensure Cortex-M port compatibility. */
  212. #define SysTick_Handler xPortSysTickHandler
  213. #include "RTE_Components.h"
  214. #include CMSIS_device_header
  215. #endif /* FREERTOS_CONFIG_H */