FreeRTOSConfig.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. #elif CONFIG_FREERTOS_CORETIMER_2
  74. #define XT_TIMER_INDEX 2
  75. #elif CONFIG_FREERTOS_CORETIMER_3
  76. #define XT_TIMER_INDEX 3
  77. #endif
  78. #define configNUM_THREAD_LOCAL_STORAGE_POINTERS CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
  79. #define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
  80. /* TODO: config freq by menuconfig */
  81. #define XT_CLOCK_FREQ (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000)
  82. /* Required for configuration-dependent settings */
  83. #include "xtensa_config.h"
  84. /* configASSERT behaviour */
  85. #ifndef __ASSEMBLER__
  86. #include <stdlib.h> /* for abort() */
  87. #include "rom/ets_sys.h"
  88. #if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
  89. #define configASSERT(a) /* assertions disabled */
  90. #elif defined(CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE)
  91. #define configASSERT(a) if (!(a)) { \
  92. ets_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
  93. __FUNCTION__); \
  94. }
  95. #else /* CONFIG_FREERTOS_ASSERT_FAIL_ABORT */
  96. #define configASSERT(a) if (!(a)) { \
  97. ets_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
  98. __FUNCTION__); \
  99. abort(); \
  100. }
  101. #endif
  102. #if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
  103. #define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
  104. #else
  105. #define UNTESTED_FUNCTION()
  106. #endif
  107. #endif /* def __ASSEMBLER__ */
  108. /*-----------------------------------------------------------
  109. * Application specific definitions.
  110. *
  111. * These definitions should be adjusted for your particular hardware and
  112. * application requirements.
  113. *
  114. * Note that the default heap size is deliberately kept small so that
  115. * the build is more likely to succeed for configurations with limited
  116. * memory.
  117. *
  118. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
  119. * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
  120. *----------------------------------------------------------*/
  121. #define configUSE_PREEMPTION 1
  122. #define configUSE_IDLE_HOOK ( CONFIG_FREERTOS_LEGACY_IDLE_HOOK )
  123. #define configUSE_TICK_HOOK ( CONFIG_FREERTOS_LEGACY_TICK_HOOK )
  124. #define configTICK_RATE_HZ ( CONFIG_FREERTOS_HZ )
  125. /* Default clock rate for simulator */
  126. //#define configCPU_CLOCK_HZ 80000000
  127. /* This has impact on speed of search for highest priority */
  128. #ifdef SMALL_TEST
  129. #define configMAX_PRIORITIES ( 7 )
  130. #else
  131. #define configMAX_PRIORITIES ( 25 )
  132. #endif
  133. /* Minimal stack size. This may need to be increased for your application */
  134. /* NOTE: The FreeRTOS demos may not work reliably with stack size < 4KB. */
  135. /* The Xtensa-specific examples should be fine with XT_STACK_MIN_SIZE. */
  136. #if !(defined XT_STACK_MIN_SIZE)
  137. #error XT_STACK_MIN_SIZE not defined, did you include xtensa_config.h ?
  138. #endif
  139. #define configMINIMAL_STACK_SIZE (XT_STACK_MIN_SIZE > 1024 ? XT_STACK_MIN_SIZE : 1024)
  140. /* The Xtensa port uses a separate interrupt stack. Adjust the stack size */
  141. /* to suit the needs of your specific application. */
  142. #ifndef configISR_STACK_SIZE
  143. #define configISR_STACK_SIZE CONFIG_FREERTOS_ISR_STACKSIZE
  144. #endif
  145. /* Minimal heap size to make sure examples can run on memory limited
  146. configs. Adjust this to suit your system. */
  147. //We define the heap to span all of the non-statically-allocated shared RAM. ToDo: Make sure there
  148. //is some space left for the app and main cpu when running outside of a thread.
  149. #define configAPPLICATION_ALLOCATED_HEAP 1
  150. #define configTOTAL_HEAP_SIZE (&_heap_end - &_heap_start)//( ( size_t ) (64 * 1024) )
  151. #define configMAX_TASK_NAME_LEN ( 16 )
  152. #define configUSE_TRACE_FACILITY 0 /* Used by vTaskList in main.c */
  153. #define configUSE_STATS_FORMATTING_FUNCTIONS 0 /* Used by vTaskList in main.c */
  154. #define configUSE_TRACE_FACILITY_2 0 /* Provided by Xtensa port patch */
  155. #define configBENCHMARK 0 /* Provided by Xtensa port patch */
  156. #define configUSE_16_BIT_TICKS 0
  157. #define configIDLE_SHOULD_YIELD 0
  158. #define configQUEUE_REGISTRY_SIZE 0
  159. #define configUSE_MUTEXES 1
  160. #define configUSE_RECURSIVE_MUTEXES 1
  161. #define configUSE_COUNTING_SEMAPHORES 1
  162. #if CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE
  163. #define configCHECK_FOR_STACK_OVERFLOW 0
  164. #elif CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL
  165. #define configCHECK_FOR_STACK_OVERFLOW 1
  166. #elif CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY
  167. #define configCHECK_FOR_STACK_OVERFLOW 2
  168. #endif
  169. /* Co-routine definitions. */
  170. #define configUSE_CO_ROUTINES 0
  171. #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
  172. /* Set the following definitions to 1 to include the API function, or zero
  173. to exclude the API function. */
  174. #define INCLUDE_vTaskPrioritySet 1
  175. #define INCLUDE_uxTaskPriorityGet 1
  176. #define INCLUDE_vTaskDelete 1
  177. #define INCLUDE_vTaskCleanUpResources 0
  178. #define INCLUDE_vTaskSuspend 1
  179. #define INCLUDE_vTaskDelayUntil 1
  180. #define INCLUDE_vTaskDelay 1
  181. #define INCLUDE_uxTaskGetStackHighWaterMark 1
  182. #define INCLUDE_pcTaskGetTaskName 1
  183. #if CONFIG_ENABLE_MEMORY_DEBUG
  184. #define configENABLE_MEMORY_DEBUG 1
  185. #else
  186. #define configENABLE_MEMORY_DEBUG 0
  187. #endif
  188. #define INCLUDE_xSemaphoreGetMutexHolder 1
  189. /* The priority at which the tick interrupt runs. This should probably be
  190. kept at 1. */
  191. #define configKERNEL_INTERRUPT_PRIORITY 1
  192. /* The maximum interrupt priority from which FreeRTOS.org API functions can
  193. be called. Only API functions that end in ...FromISR() can be used within
  194. interrupts. */
  195. #define configMAX_SYSCALL_INTERRUPT_PRIORITY XCHAL_EXCM_LEVEL
  196. #define configUSE_NEWLIB_REENTRANT 1
  197. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  198. /* Test FreeRTOS timers (with timer task) and more. */
  199. /* Some files don't compile if this flag is disabled */
  200. #define configUSE_TIMERS 1
  201. #define configTIMER_TASK_PRIORITY 1
  202. #define configTIMER_QUEUE_LENGTH 10
  203. #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
  204. #define INCLUDE_xTimerPendFunctionCall 1
  205. #define INCLUDE_eTaskGetState 1
  206. #define configUSE_QUEUE_SETS 1
  207. #define configXT_BOARD 1 /* Board mode */
  208. #define configXT_SIMULATOR 0
  209. #endif /* FREERTOS_CONFIG_H */