FreeRTOSConfig.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #pragma once
  2. #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
  3. #include <stdint.h>
  4. #pragma GCC diagnostic ignored "-Wredundant-decls"
  5. extern uint32_t SystemCoreClock;
  6. #endif
  7. #ifndef CMSIS_device_header
  8. #define CMSIS_device_header "stm32wbxx.h"
  9. #endif /* CMSIS_device_header */
  10. #define configENABLE_FPU 1
  11. #define configENABLE_MPU 0
  12. #define configUSE_PREEMPTION 1
  13. #define configSUPPORT_STATIC_ALLOCATION 1
  14. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  15. #define configUSE_IDLE_HOOK 0
  16. #define configUSE_TICK_HOOK 0
  17. #define configCPU_CLOCK_HZ (SystemCoreClock)
  18. #define configTICK_RATE_HZ_RAW 1000
  19. #define configTICK_RATE_HZ ((TickType_t)configTICK_RATE_HZ_RAW)
  20. #define configMAX_PRIORITIES (32)
  21. #define configMINIMAL_STACK_SIZE ((uint16_t)128)
  22. /* Heap size determined automatically by linker */
  23. // #define configTOTAL_HEAP_SIZE ((size_t)0)
  24. #define configMAX_TASK_NAME_LEN (16)
  25. #define configGENERATE_RUN_TIME_STATS 0
  26. #define configUSE_TRACE_FACILITY 1
  27. #define configUSE_16_BIT_TICKS 0
  28. #define configUSE_MUTEXES 1
  29. #define configQUEUE_REGISTRY_SIZE 0
  30. #define configCHECK_FOR_STACK_OVERFLOW 0
  31. #define configUSE_RECURSIVE_MUTEXES 1
  32. #define configUSE_COUNTING_SEMAPHORES 1
  33. #define configENABLE_BACKWARD_COMPATIBILITY 0
  34. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
  35. #define configUSE_TICKLESS_IDLE 2
  36. #define configRECORD_STACK_HIGH_ADDRESS 1
  37. #define configUSE_NEWLIB_REENTRANT 0
  38. /* Defaults to size_t for backward compatibility, but can be changed
  39. if lengths will always be less than the number of bytes in a size_t. */
  40. #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
  41. #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1
  42. #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 4
  43. /* Co-routine definitions. */
  44. #define configUSE_CO_ROUTINES 0
  45. /* Software timer definitions. */
  46. #define configUSE_TIMERS 1
  47. #define configTIMER_TASK_PRIORITY (2)
  48. #define configTIMER_QUEUE_LENGTH 32
  49. #define configTIMER_TASK_STACK_DEPTH 256
  50. #define configTIMER_SERVICE_TASK_NAME "TimersSrv"
  51. #define configIDLE_TASK_NAME "(-_-)"
  52. /* Set the following definitions to 1 to include the API function, or zero
  53. to exclude the API function. */
  54. #define INCLUDE_xTaskGetHandle 1
  55. #define INCLUDE_eTaskGetState 1
  56. #define INCLUDE_uxTaskGetStackHighWaterMark 1
  57. #define INCLUDE_uxTaskPriorityGet 1
  58. #define INCLUDE_vTaskCleanUpResources 0
  59. #define INCLUDE_vTaskDelay 1
  60. #define INCLUDE_vTaskDelayUntil 1
  61. #define INCLUDE_vTaskDelete 1
  62. #define INCLUDE_vTaskPrioritySet 1
  63. #define INCLUDE_vTaskSuspend 1
  64. #define INCLUDE_xQueueGetMutexHolder 1
  65. #define INCLUDE_xTaskGetCurrentTaskHandle 1
  66. #define INCLUDE_xTaskGetSchedulerState 1
  67. #define INCLUDE_xTimerPendFunctionCall 1
  68. /* Furi-specific */
  69. #define configTASK_NOTIFICATION_ARRAY_ENTRIES 2
  70. extern __attribute__((__noreturn__)) void furi_thread_catch();
  71. #define configTASK_RETURN_ADDRESS (furi_thread_catch + 2)
  72. /*
  73. * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used
  74. * by the application thus the correct define need to be enabled below
  75. */
  76. #define USE_FreeRTOS_HEAP_4
  77. /* Cortex-M specific definitions. */
  78. #ifdef __NVIC_PRIO_BITS
  79. /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
  80. #define configPRIO_BITS __NVIC_PRIO_BITS
  81. #else
  82. #define configPRIO_BITS 4
  83. #endif
  84. /* The lowest interrupt priority that can be used in a call to a "set priority"
  85. function. */
  86. #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
  87. /* The highest interrupt priority that can be used by any interrupt service
  88. routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
  89. INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
  90. PRIORITY THAN THIS! (higher priorities are lower numeric values. */
  91. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
  92. /* Interrupt priorities used by the kernel port layer itself. These are generic
  93. to all Cortex-M ports, and do not rely on any particular library functions. */
  94. #define configKERNEL_INTERRUPT_PRIORITY \
  95. (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
  96. /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
  97. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
  98. #define configMAX_SYSCALL_INTERRUPT_PRIORITY \
  99. (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
  100. /* Normal assert() semantics without relying on the provision of an assert.h
  101. header file. */
  102. #ifdef DEBUG
  103. #include <core/check.h>
  104. #define configASSERT(x) \
  105. if((x) == 0) { \
  106. furi_crash("FreeRTOS Assert"); \
  107. }
  108. #endif
  109. /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
  110. standard names. */
  111. #define vPortSVCHandler SVC_Handler
  112. #define xPortPendSVHandler PendSV_Handler
  113. #define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 1
  114. #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION \
  115. 1 /* required only for Keil but does not hurt otherwise */
  116. #define traceTASK_SWITCHED_IN() \
  117. extern void furi_hal_mpu_set_stack_protection(uint32_t* stack); \
  118. furi_hal_mpu_set_stack_protection((uint32_t*)pxCurrentTCB->pxStack)