FreeRTOSConfig.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Copyright (c) 2022 OpenLuat & AirM2M
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. * this software and associated documentation files (the "Software"), to deal in
  6. * the Software without restriction, including without limitation the rights to
  7. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  8. * the Software, and to permit persons to whom the Software is furnished to do so,
  9. * subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in all
  12. * copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. */
  21. /*
  22. * FreeRTOS Kernel V10.2.1
  23. * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  24. *
  25. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26. * this software and associated documentation files (the "Software"), to deal in
  27. * the Software without restriction, including without limitation the rights to
  28. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  29. * the Software, and to permit persons to whom the Software is furnished to do so,
  30. * subject to the following conditions:
  31. *
  32. * The above copyright notice and this permission notice shall be included in all
  33. * copies or substantial portions of the Software.
  34. *
  35. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  37. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  38. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  39. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  40. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  41. *
  42. * http://www.FreeRTOS.org
  43. * http://aws.amazon.com/freertos
  44. *
  45. * 1 tab == 4 spaces!
  46. */
  47. #ifndef FREERTOS_CONFIG_H
  48. #define FREERTOS_CONFIG_H
  49. /*-----------------------------------------------------------
  50. * this is a template configuration files
  51. *
  52. * These definitions should be adjusted for your particular hardware and
  53. * application requirements.
  54. *
  55. * These parameters and more are described within the 'configuration' section of the
  56. * FreeRTOS API documentation available on the FreeRTOS.org web site.
  57. *
  58. * See http://www.freertos.org/a00110.html
  59. *----------------------------------------------------------*/
  60. /* Ensure stdint is only used by the compiler, and not the assembler. */
  61. #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
  62. #include <stdint.h>
  63. extern uint32_t SystemCoreClock;
  64. #endif
  65. #ifdef __AIR105_BSP__
  66. #include "../chip/include/air105.h"
  67. #endif
  68. /* CMSIS-RTOSv2 defines 56 levels of priorities. To be able to use them
  69. * all and avoid application misbehavior, configUSE_PORT_OPTIMISED_TASK_SELECTION
  70. * must be set to 0 and configMAX_PRIORITIES to 56
  71. *
  72. */
  73. /* #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0*/
  74. /* #define configMAX_PRIORITIES ( 56 ) */
  75. #define configUSE_PREEMPTION 1
  76. #define configUSE_IDLE_HOOK 1
  77. #define configUSE_TICK_HOOK 0
  78. #define configMAX_PRIORITIES (7)
  79. #define configSUPPORT_STATIC_ALLOCATION 0
  80. #define configCPU_CLOCK_HZ (SystemCoreClock)
  81. #define configTICK_RATE_HZ ((TickType_t)100)
  82. #define configMINIMAL_STACK_SIZE ((uint16_t)512)
  83. #define configTOTAL_HEAP_SIZE ((size_t)(264 * 1024))
  84. #define configMAX_TASK_NAME_LEN (16)
  85. #define configUSE_TRACE_FACILITY 0
  86. #define configUSE_16_BIT_TICKS 0
  87. #define configIDLE_SHOULD_YIELD 1
  88. #define configUSE_MUTEXES 0
  89. #define configQUEUE_REGISTRY_SIZE 8
  90. #define configCHECK_FOR_STACK_OVERFLOW 0
  91. #define configUSE_RECURSIVE_MUTEXES 0
  92. #define configUSE_MALLOC_FAILED_HOOK 0
  93. #define configUSE_APPLICATION_TASK_TAG 0
  94. #define configUSE_COUNTING_SEMAPHORES 1
  95. #define configGENERATE_RUN_TIME_STATS 0
  96. #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 4
  97. #define configUSE_TASK_NOTIFICATIONS 1
  98. #define configTASK_NOTIFICATION_ARRAY_ENTRIES 2
  99. /* Co-routine definitions. */
  100. #define configUSE_CO_ROUTINES 0
  101. #define configMAX_CO_ROUTINE_PRIORITIES (2)
  102. /* Software timer definitions. */
  103. #define configUSE_TIMERS 1
  104. #define configTIMER_TASK_PRIORITY (2)
  105. #define configTIMER_QUEUE_LENGTH 100
  106. #define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)
  107. /* Set the following definitions to 1 to include the API function, or zero
  108. to exclude the API function. */
  109. #define INCLUDE_vTaskPrioritySet 1
  110. #define INCLUDE_uxTaskPriorityGet 1
  111. #define INCLUDE_vTaskDelete 1
  112. #define INCLUDE_vTaskCleanUpResources 0
  113. #define INCLUDE_vTaskSuspend 1
  114. #define INCLUDE_vTaskDelayUntil 1
  115. #define INCLUDE_vTaskDelay 1
  116. #define INCLUDE_xTaskGetSchedulerState 1
  117. /*------------- CMSIS-RTOS V2 specific defines -----------*/
  118. /* When using CMSIS-RTOSv2 set configSUPPORT_STATIC_ALLOCATION to 1
  119. * is mandatory to avoid compile errors.
  120. * CMSIS-RTOS V2 implmentation requires the following defines
  121. *
  122. #define configSUPPORT_STATIC_ALLOCATION 1 <-- cmsis_os threads are created using xTaskCreateStatic() API
  123. #define configMAX_PRIORITIES (56) <-- Priority range in CMSIS-RTOS V2 is [0 .. 56]
  124. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 <-- when set to 1, configMAX_PRIORITIES can't be more than 32 which is not suitable for the new CMSIS-RTOS v2 priority range
  125. */
  126. /* the CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used
  127. * by the application thus the correct define need to be enabled from the list
  128. * below
  129. *
  130. //define USE_FreeRTOS_HEAP_1
  131. //define USE_FreeRTOS_HEAP_2
  132. //define USE_FreeRTOS_HEAP_3
  133. //define USE_FreeRTOS_HEAP_4
  134. //define USE_FreeRTOS_HEAP_5
  135. */
  136. /* Cortex-M specific definitions. */
  137. #ifdef __NVIC_PRIO_BITS
  138. /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
  139. #define configPRIO_BITS __NVIC_PRIO_BITS
  140. #else
  141. #define configPRIO_BITS 3 /* 15 priority levels */
  142. #endif
  143. /* The lowest interrupt priority that can be used in a call to a "set priority"
  144. function. */
  145. #if (configPRIO_BITS > 3)
  146. #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
  147. /* The highest interrupt priority that can be used by any interrupt service
  148. routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
  149. INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
  150. PRIORITY THAN THIS! (higher priorities are lower numeric values. */
  151. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
  152. #else
  153. #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 7
  154. /* The highest interrupt priority that can be used by any interrupt service
  155. routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
  156. INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
  157. PRIORITY THAN THIS! (higher priorities are lower numeric values. */
  158. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
  159. #endif
  160. /* Interrupt priorities used by the kernel port layer itself. These are generic
  161. to all Cortex-M ports, and do not rely on any particular library functions. */
  162. #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
  163. /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
  164. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
  165. #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
  166. /* Normal assert() semantics without relying on the provision of an assert.h
  167. header file. */
  168. //#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
  169. #if(defined(__DEBUG__) || defined(DEBUG))
  170. #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); DBG_Trace("\r\nassert %s,%d", __FUNCTION__, __LINE__); for( ;; ); }
  171. #else
  172. #define configASSERT( x )
  173. #endif
  174. /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
  175. standard names. */
  176. #define vPortSVCHandler SVC_Handler
  177. #define xPortPendSVHandler PendSV_Handler
  178. /* IMPORTANT: FreeRTOS is using the SysTick as internal time base, thus make sure the system and peripherials are
  179. using a different time base (TIM based for example).
  180. */
  181. #define xPortSysTickHandler SysTick_Handler
  182. #define traceTASK_SWITCHED_IN OS_SetStartFlag
  183. #define configUSE_TIME_SLICING 0
  184. #endif /* FREERTOS_CONFIG_H */