@@ -35,119 +35,157 @@ your application. */
3535#include <modm/architecture/utils.hpp>
3636#include <modm/platform/device.hpp>
3737
38+ /* Define to trap errors during development. */
39+ #define configASSERT ( x ) { modm_assert((x), "freertos", __FILE__, MODM_STRINGIFY(__LINE__)); }
40+
3841// declared in modm:platform:clock
3942#ifdef __cplusplus
4043 extern "C" uint32_t SystemCoreClock ;
4144#else
4245 extern uint32_t SystemCoreClock ;
4346#endif
4447
45- #define configUSE_PREEMPTION 1
46- #define configUSE_PORT_OPTIMISED_TASK_SELECTION {{ ("m0" not in core) | int }}
47- #define configUSE_TICKLESS_IDLE 0
4848#define configCPU_CLOCK_HZ ( SystemCoreClock )
49- #define configTICK_RATE_HZ ( {{ options["::frequency"] }} )
50- #define configMAX_PRIORITIES 5
51- #define configMINIMAL_STACK_SIZE 128
52- #define configMAX_TASK_NAME_LEN 16
53- #define configUSE_16_BIT_TICKS 0
54- #define configIDLE_SHOULD_YIELD 1
55- #define configUSE_TASK_NOTIFICATIONS 1
56- #define configUSE_MUTEXES 1
57- #define configUSE_RECURSIVE_MUTEXES 1
58- #define configUSE_COUNTING_SEMAPHORES 1
59- #define configQUEUE_REGISTRY_SIZE 10
60- #define configUSE_QUEUE_SETS 0
61- #define configUSE_TIME_SLICING 0
62- #define configUSE_NEWLIB_REENTRANT 0
63- #define configENABLE_BACKWARD_COMPATIBILITY 0
64- #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
65-
66-
49+ #define configTICK_RATE_HZ ( {{ frequency }} )
6750/* Memory allocation related definitions. */
6851#define configSUPPORT_STATIC_ALLOCATION 0
6952#define configSUPPORT_DYNAMIC_ALLOCATION 1
70- #define configTOTAL_HEAP_SIZE 0 // modm provides heap
71- #define configAPPLICATION_ALLOCATED_HEAP 1
72-
73- /* Hook function related definitions. */
74- #define configUSE_IDLE_HOOK 0
7553// used by modm:platform:clock for modm::Clock::increment(): vApplicationTickHook()
7654#define configUSE_TICK_HOOK 1
77- #define configCHECK_FOR_STACK_OVERFLOW 1
78- #define configUSE_MALLOC_FAILED_HOOK 0 // modm provides heap assertions
79- #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
80-
81- /* Run time and task stats gathering related definitions. */
82- #define configGENERATE_RUN_TIME_STATS 0
83- #define configUSE_TRACE_FACILITY 0
84- #define configUSE_STATS_FORMATTING_FUNCTIONS 0
85-
86- /* Co-routine related definitions. */
87- #define configUSE_CO_ROUTINES 0
88- #define configMAX_CO_ROUTINE_PRIORITIES 1
89-
90- /* Software timer related definitions. */
91- #define configUSE_TIMERS 1
92- #define configTIMER_TASK_PRIORITY 3
93- #define configTIMER_QUEUE_LENGTH 10
94- #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
95-
96- /* Define to trap errors during development. */
97- #define configASSERT ( x ) { modm_assert((x), "freertos.assert", __FILE__, MODM_STRINGIFY(__LINE__)); }
98-
99- /* FreeRTOS MPU specific definitions. */
100- #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
101-
102- /* Optional functions - most linkers will remove unused functions anyway. */
103- #define INCLUDE_vTaskPrioritySet 1
104- #define INCLUDE_uxTaskPriorityGet 1
105- #define INCLUDE_vTaskDelete 1
106- #define INCLUDE_vTaskSuspend 1
107- #define INCLUDE_xResumeFromISR 1
108- #define INCLUDE_vTaskDelayUntil 1
109- #define INCLUDE_vTaskDelay 1
110- #define INCLUDE_xTaskGetSchedulerState 1
111- #define INCLUDE_xTaskGetCurrentTaskHandle 1
112- #define INCLUDE_uxTaskGetStackHighWaterMark 0
113- #define INCLUDE_xTaskGetIdleTaskHandle 0
114- #define INCLUDE_eTaskGetState 0
115- #define INCLUDE_xEventGroupSetBitFromISR 1
116- #define INCLUDE_xTimerPendFunctionCall 0
117- #define INCLUDE_xTaskAbortDelay 0
118- #define INCLUDE_xTaskGetHandle 0
119- #define INCLUDE_xTaskResumeFromISR 1
120-
121-
122- /* __NVIC_PRIO_BITS will be specified when CMSIS is being used. */
123- #define configPRIO_BITS __NVIC_PRIO_BITS
124-
125- /* The lowest interrupt priority that can be used in a call to a "set priority"
126- function. */
127- #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
128-
129- /* The highest interrupt priority that can be used by any interrupt service
130- routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
131- INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
132- PRIORITY THAN THIS! (higher priorities are lower numeric values. */
133- #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 4
13455
13556/* Interrupt priorities used by the kernel port layer itself. These are generic
13657to all Cortex-M ports, and do not rely on any particular library functions. */
137- #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
138- /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
139- See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
140- #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
58+ #define configKERNEL_INTERRUPT_PRIORITY (((1u << __NVIC_PRIO_BITS) - 1u) << (8u - __NVIC_PRIO_BITS))
14159
14260/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
14361standard names. */
144- #define xPortPendSVHandler PendSV_Handler
145- #define vPortSVCHandler SVC_Handler
146- #define xPortSysTickHandler SysTick_Handler
62+ #define xPortPendSVHandler PendSV_Handler
63+ #define vPortSVCHandler SVC_Handler
64+ #define xPortSysTickHandler SysTick_Handler
65+
14766
14867/* A header file that overwrites with local project settings. */
14968#if __has_include (< FreeRTOSConfigLocal .h > )
150- #include <FreeRTOSConfigLocal.h>
69+ # include <FreeRTOSConfigLocal.h>
70+ #endif
71+
72+
73+ /* Required config by FreeRTOS and defaulted by modm */
74+
75+ /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
76+ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
77+ #ifndef configMAX_SYSCALL_INTERRUPT_PRIORITY
78+ # define configMAX_SYSCALL_INTERRUPT_PRIORITY (__NVIC_PRIO_BITS << (8u - __NVIC_PRIO_BITS))
79+ #endif
80+
81+ #ifndef configMINIMAL_STACK_SIZE
82+ # define configMINIMAL_STACK_SIZE 128
83+ #endif
84+ #ifndef configMAX_PRIORITIES
85+ # define configMAX_PRIORITIES 5
86+ #endif
87+ #ifndef configUSE_PREEMPTION
88+ # define configUSE_PREEMPTION 1
89+ #endif
90+ #ifndef configUSE_IDLE_HOOK
91+ # define configUSE_IDLE_HOOK 0
92+ #endif
93+ #ifndef configUSE_16_BIT_TICKS
94+ # define configUSE_16_BIT_TICKS 0
95+ #endif
96+
97+ /* Defaulted by FreeRTOS but changed by modm */
98+
99+ #ifndef configUSE_MUTEXES
100+ # define configUSE_MUTEXES 1
101+ #endif
102+ #ifndef configUSE_RECURSIVE_MUTEXES
103+ # define configUSE_RECURSIVE_MUTEXES 1
104+ #endif
105+ #ifndef configUSE_COUNTING_SEMAPHORES
106+ # define configUSE_COUNTING_SEMAPHORES 1
107+ #endif
108+ #ifndef configQUEUE_REGISTRY_SIZE
109+ # define configQUEUE_REGISTRY_SIZE 10
110+ #endif
111+ #ifndef configENABLE_BACKWARD_COMPATIBILITY
112+ # define configENABLE_BACKWARD_COMPATIBILITY 0
113+ #endif
114+ #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
115+ # define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
116+ #endif
117+ #ifndef configCHECK_FOR_STACK_OVERFLOW
118+ # define configCHECK_FOR_STACK_OVERFLOW 1
119+ #endif
120+
121+ /* The timers module relies on xTaskGetSchedulerState(). */
122+ #ifndef configUSE_TIMERS
123+ # define configUSE_TIMERS 1
124+ #endif
125+ #ifndef configTIMER_TASK_PRIORITY
126+ # define configTIMER_TASK_PRIORITY 3
127+ #endif
128+ #ifndef configTIMER_QUEUE_LENGTH
129+ # define configTIMER_QUEUE_LENGTH 10
130+ #endif
131+ #ifndef configTIMER_TASK_STACK_DEPTH
132+ # define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
133+ #endif
134+
135+ /* Optional functions all enabled. */
136+ #ifndef INCLUDE_vTaskPrioritySet
137+ # define INCLUDE_vTaskPrioritySet 1
138+ #endif
139+ #ifndef INCLUDE_uxTaskPriorityGet
140+ # define INCLUDE_uxTaskPriorityGet 1
141+ #endif
142+ #ifndef INCLUDE_vTaskDelete
143+ # define INCLUDE_vTaskDelete 1
144+ #endif
145+ #ifndef INCLUDE_vTaskSuspend
146+ # define INCLUDE_vTaskSuspend 1
147+ #endif
148+ #ifndef INCLUDE_xTaskDelayUntil
149+ # define INCLUDE_xTaskDelayUntil 1
150+ #endif
151+ #ifndef INCLUDE_vTaskDelay
152+ # define INCLUDE_vTaskDelay 1
153+ #endif
154+ #ifndef INCLUDE_xTaskGetIdleTaskHandle
155+ # define INCLUDE_xTaskGetIdleTaskHandle 1
156+ #endif
157+ #ifndef INCLUDE_xTaskAbortDelay
158+ # define INCLUDE_xTaskAbortDelay 1
159+ #endif
160+ #ifndef INCLUDE_xQueueGetMutexHolder
161+ # define INCLUDE_xQueueGetMutexHolder 1
162+ #endif
163+ #ifndef INCLUDE_xSemaphoreGetMutexHolder
164+ # define INCLUDE_xSemaphoreGetMutexHolder 1
165+ #endif
166+ #ifndef INCLUDE_xTaskGetHandle
167+ # define INCLUDE_xTaskGetHandle 1
168+ #endif
169+ #ifndef INCLUDE_uxTaskGetStackHighWaterMark
170+ # define INCLUDE_uxTaskGetStackHighWaterMark 1
171+ #endif
172+ #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
173+ # define INCLUDE_uxTaskGetStackHighWaterMark2 1
174+ #endif
175+ #ifndef INCLUDE_eTaskGetState
176+ # define INCLUDE_eTaskGetState 1
177+ #endif
178+ #ifndef INCLUDE_xTaskResumeFromISR
179+ # define INCLUDE_xTaskResumeFromISR 1
180+ #endif
181+ #ifndef INCLUDE_xTimerPendFunctionCall
182+ # define INCLUDE_xTimerPendFunctionCall 1
183+ #endif
184+ #ifndef INCLUDE_xTaskGetSchedulerState
185+ # define INCLUDE_xTaskGetSchedulerState 1
186+ #endif
187+ #ifndef INCLUDE_xTaskGetCurrentTaskHandle
188+ # define INCLUDE_xTaskGetCurrentTaskHandle 1
151189#endif
152190
153191#endif /* FREERTOS_CONFIG_H */
0 commit comments