FreeRTOSConfig_template.h 7.0 KB

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