FreeRTOSConfig.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. /*
  2. FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.
  3. All rights reserved
  4. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
  5. This file is part of the FreeRTOS distribution.
  6. FreeRTOS is free software; you can redistribute it and/or modify it under
  7. the terms of the GNU General Public License (version 2) as published by the
  8. Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
  9. ***************************************************************************
  10. >>! NOTE: The modification to the GPL is included to allow you to !<<
  11. >>! distribute a combined work that includes FreeRTOS without being !<<
  12. >>! obliged to provide the source code for proprietary components !<<
  13. >>! outside of the FreeRTOS kernel. !<<
  14. ***************************************************************************
  15. FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
  16. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17. FOR A PARTICULAR PURPOSE. Full license text is available on the following
  18. link: http://www.freertos.org/a00114.html
  19. ***************************************************************************
  20. * *
  21. * FreeRTOS provides completely free yet professionally developed, *
  22. * robust, strictly quality controlled, supported, and cross *
  23. * platform software that is more than just the market leader, it *
  24. * is the industry's de facto standard. *
  25. * *
  26. * Help yourself get started quickly while simultaneously helping *
  27. * to support the FreeRTOS project by purchasing a FreeRTOS *
  28. * tutorial book, reference manual, or both: *
  29. * http://www.FreeRTOS.org/Documentation *
  30. * *
  31. ***************************************************************************
  32. http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
  33. the FAQ page "My application does not run, what could be wrong?". Have you
  34. defined configASSERT()?
  35. http://www.FreeRTOS.org/support - In return for receiving this top quality
  36. embedded software for free we request you assist our global community by
  37. participating in the support forum.
  38. http://www.FreeRTOS.org/training - Investing in training allows your team to
  39. be as productive as possible as early as possible. Now you can receive
  40. FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
  41. Ltd, and the world's leading authority on the world's leading RTOS.
  42. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  43. including FreeRTOS+Trace - an indispensable productivity tool, a DOS
  44. compatible FAT file system, and our tiny thread aware UDP/IP stack.
  45. http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
  46. Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
  47. http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
  48. Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
  49. licenses offer ticketed support, indemnification and commercial middleware.
  50. http://www.SafeRTOS.com - High Integrity Systems also provide a safety
  51. engineered and independently SIL3 certified version for use in safety and
  52. mission critical applications that require provable dependability.
  53. 1 tab == 4 spaces!
  54. */
  55. #ifndef FREERTOS_CONFIG_H
  56. #define FREERTOS_CONFIG_H
  57. #include "sdkconfig.h"
  58. /* ESP31 and ESP32 are dualcore processors. */
  59. #ifndef CONFIG_FREERTOS_UNICORE
  60. #define portNUM_PROCESSORS 2
  61. #else
  62. #define portNUM_PROCESSORS 1
  63. #endif
  64. #define XT_USE_THREAD_SAFE_CLIB 0
  65. #define configASSERT_2 0
  66. #define portUSING_MPU_WRAPPERS 0
  67. #define configUSE_MUTEX 1
  68. #undef XT_USE_SWPRI
  69. #if CONFIG_FREERTOS_CORETIMER_0
  70. #define XT_TIMER_INDEX 0
  71. #elif CONFIG_FREERTOS_CORETIMER_1
  72. #define XT_TIMER_INDEX 1
  73. #endif
  74. #define configNUM_THREAD_LOCAL_STORAGE_POINTERS CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
  75. #define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
  76. #ifndef __ASSEMBLER__
  77. /**
  78. * This function is defined to provide a deprecation warning whenever
  79. * XT_CLOCK_FREQ macro is used.
  80. * Update the code to use esp_clk_cpu_freq function instead.
  81. * @return current CPU clock frequency, in Hz
  82. */
  83. int xt_clock_freq(void) __attribute__((deprecated));
  84. #define XT_CLOCK_FREQ (xt_clock_freq())
  85. #endif // __ASSEMBLER__
  86. /* Required for configuration-dependent settings */
  87. #include "xtensa_config.h"
  88. /* configASSERT behaviour */
  89. #ifndef __ASSEMBLER__
  90. #include <stdlib.h> /* for abort() */
  91. #if CONFIG_IDF_TARGET_ESP32
  92. #include "esp32/rom/ets_sys.h"
  93. #elif CONFIG_IDF_TARGET_ESP32S2BETA
  94. #include "esp32s2beta/rom/ets_sys.h"
  95. #endif
  96. #if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
  97. #define configASSERT(a) /* assertions disabled */
  98. #elif defined(CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE)
  99. #define configASSERT(a) if (!(a)) { \
  100. ets_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
  101. __FUNCTION__); \
  102. }
  103. #else /* CONFIG_FREERTOS_ASSERT_FAIL_ABORT */
  104. #define configASSERT(a) if (!(a)) { \
  105. ets_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
  106. __FUNCTION__); \
  107. abort(); \
  108. }
  109. #endif
  110. #if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
  111. #define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
  112. #else
  113. #define UNTESTED_FUNCTION()
  114. #endif
  115. #endif /* def __ASSEMBLER__ */
  116. /*-----------------------------------------------------------
  117. * Application specific definitions.
  118. *
  119. * These definitions should be adjusted for your particular hardware and
  120. * application requirements.
  121. *
  122. * Note that the default heap size is deliberately kept small so that
  123. * the build is more likely to succeed for configurations with limited
  124. * memory.
  125. *
  126. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
  127. * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
  128. *----------------------------------------------------------*/
  129. #define configUSE_PREEMPTION 1
  130. #define configUSE_IDLE_HOOK 1
  131. #define configUSE_TICK_HOOK 1
  132. #define configTICK_RATE_HZ ( CONFIG_FREERTOS_HZ )
  133. /* Default clock rate for simulator */
  134. //#define configCPU_CLOCK_HZ 80000000
  135. /* This has impact on speed of search for highest priority */
  136. #ifdef SMALL_TEST
  137. #define configMAX_PRIORITIES ( 7 )
  138. #else
  139. #define configMAX_PRIORITIES ( 25 )
  140. #endif
  141. #ifndef CONFIG_ESP32_APPTRACE_ENABLE
  142. #define configMINIMAL_STACK_SIZE 768
  143. #else
  144. /* apptrace module requires at least 2KB of stack per task */
  145. #define configMINIMAL_STACK_SIZE 2048
  146. #endif
  147. #ifndef configIDLE_TASK_STACK_SIZE
  148. #define configIDLE_TASK_STACK_SIZE CONFIG_FREERTOS_IDLE_TASK_STACKSIZE
  149. #endif
  150. /* The Xtensa port uses a separate interrupt stack. Adjust the stack size */
  151. /* to suit the needs of your specific application. */
  152. #ifndef configISR_STACK_SIZE
  153. #define configISR_STACK_SIZE CONFIG_FREERTOS_ISR_STACKSIZE
  154. #endif
  155. /* Minimal heap size to make sure examples can run on memory limited
  156. configs. Adjust this to suit your system. */
  157. //We define the heap to span all of the non-statically-allocated shared RAM. ToDo: Make sure there
  158. //is some space left for the app and main cpu when running outside of a thread.
  159. #define configAPPLICATION_ALLOCATED_HEAP 1
  160. #define configTOTAL_HEAP_SIZE (&_heap_end - &_heap_start)//( ( size_t ) (64 * 1024) )
  161. #define configMAX_TASK_NAME_LEN ( CONFIG_FREERTOS_MAX_TASK_NAME_LEN )
  162. #ifdef CONFIG_FREERTOS_USE_TRACE_FACILITY
  163. #define configUSE_TRACE_FACILITY 1 /* Used by uxTaskGetSystemState(), and other trace facility functions */
  164. #endif
  165. #ifdef CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  166. #define configUSE_STATS_FORMATTING_FUNCTIONS 1 /* Used by vTaskList() */
  167. #endif
  168. #ifdef CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
  169. #define configTASKLIST_INCLUDE_COREID 1
  170. #endif
  171. #ifdef CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
  172. #define configGENERATE_RUN_TIME_STATS 1 /* Used by vTaskGetRunTimeStats() */
  173. #endif
  174. #define configUSE_TRACE_FACILITY_2 0 /* Provided by Xtensa port patch */
  175. #define configBENCHMARK 0 /* Provided by Xtensa port patch */
  176. #define configUSE_16_BIT_TICKS 0
  177. #define configIDLE_SHOULD_YIELD 0
  178. #define configQUEUE_REGISTRY_SIZE CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE
  179. #define configUSE_MUTEXES 1
  180. #define configUSE_RECURSIVE_MUTEXES 1
  181. #define configUSE_COUNTING_SEMAPHORES 1
  182. #if CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE
  183. #define configCHECK_FOR_STACK_OVERFLOW 0
  184. #elif CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL
  185. #define configCHECK_FOR_STACK_OVERFLOW 1
  186. #elif CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY
  187. #define configCHECK_FOR_STACK_OVERFLOW 2
  188. #endif
  189. /* Co-routine definitions. */
  190. #define configUSE_CO_ROUTINES 0
  191. #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
  192. /* Set the following definitions to 1 to include the API function, or zero
  193. to exclude the API function. */
  194. #define INCLUDE_vTaskPrioritySet 1
  195. #define INCLUDE_uxTaskPriorityGet 1
  196. #define INCLUDE_vTaskDelete 1
  197. #define INCLUDE_vTaskCleanUpResources 0
  198. #define INCLUDE_vTaskSuspend 1
  199. #define INCLUDE_vTaskDelayUntil 1
  200. #define INCLUDE_vTaskDelay 1
  201. #define INCLUDE_uxTaskGetStackHighWaterMark 1
  202. #define INCLUDE_pcTaskGetTaskName 1
  203. #define INCLUDE_xTaskGetIdleTaskHandle 1
  204. #define INCLUDE_pxTaskGetStackStart 1
  205. #define INCLUDE_xSemaphoreGetMutexHolder 1
  206. /* The priority at which the tick interrupt runs. This should probably be
  207. kept at 1. */
  208. #define configKERNEL_INTERRUPT_PRIORITY 1
  209. /* The maximum interrupt priority from which FreeRTOS.org API functions can
  210. be called. Only API functions that end in ...FromISR() can be used within
  211. interrupts. */
  212. #define configMAX_SYSCALL_INTERRUPT_PRIORITY XCHAL_EXCM_LEVEL
  213. #define configUSE_NEWLIB_REENTRANT 1
  214. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  215. #define configSUPPORT_STATIC_ALLOCATION CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION
  216. #ifndef __ASSEMBLER__
  217. #if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
  218. extern void vPortCleanUpTCB ( void *pxTCB );
  219. #define portCLEAN_UP_TCB( pxTCB ) vPortCleanUpTCB( pxTCB )
  220. #endif
  221. #endif
  222. /* Test FreeRTOS timers (with timer task) and more. */
  223. /* Some files don't compile if this flag is disabled */
  224. #define configUSE_TIMERS 1
  225. #define configTIMER_TASK_PRIORITY CONFIG_FREERTOS_TIMER_TASK_PRIORITY
  226. #define configTIMER_QUEUE_LENGTH CONFIG_FREERTOS_TIMER_QUEUE_LENGTH
  227. #define configTIMER_TASK_STACK_DEPTH CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH
  228. #define INCLUDE_xTimerPendFunctionCall 1
  229. #define INCLUDE_eTaskGetState 1
  230. #define configUSE_QUEUE_SETS 1
  231. #define configUSE_TICKLESS_IDLE CONFIG_FREERTOS_USE_TICKLESS_IDLE
  232. #if configUSE_TICKLESS_IDLE
  233. #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP CONFIG_FREERTOS_IDLE_TIME_BEFORE_SLEEP
  234. #endif //configUSE_TICKLESS_IDLE
  235. #define configXT_BOARD 1 /* Board mode */
  236. #define configXT_SIMULATOR 0
  237. #if CONFIG_ESP32_ENABLE_COREDUMP
  238. #define configENABLE_TASK_SNAPSHOT 1
  239. #endif
  240. #ifndef configENABLE_TASK_SNAPSHOT
  241. #define configENABLE_TASK_SNAPSHOT 1
  242. #endif
  243. #if CONFIG_SYSVIEW_ENABLE
  244. #ifndef __ASSEMBLER__
  245. #include "SEGGER_SYSVIEW_FreeRTOS.h"
  246. #undef INLINE // to avoid redefinition
  247. #endif /* def __ASSEMBLER__ */
  248. #endif
  249. #if CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER
  250. #define configCHECK_MUTEX_GIVEN_BY_OWNER 1
  251. #else
  252. #define configCHECK_MUTEX_GIVEN_BY_OWNER 0
  253. #endif
  254. #endif /* FREERTOS_CONFIG_H */