|
48 | 48 | * Default -1 see heap.c
|
49 | 49 | */
|
50 | 50 | /*#define configMEMMANG_HEAP_NB 3*/
|
| 51 | + |
| 52 | +/* configUSE_CMSIS_RTOS_V2 has to be defined and set to 1 to use CMSIS-RTOSv2 */ |
| 53 | +/*#define configUSE_CMSIS_RTOS_V2 1*/ |
| 54 | + |
51 | 55 | /* End custom definitions for STM32 */
|
52 | 56 |
|
53 | 57 | /* Ensure stdint is only used by the compiler, and not the assembler. */
|
54 | 58 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
55 | 59 | #include <stdint.h>
|
56 | 60 | extern uint32_t SystemCoreClock;
|
57 | 61 | #endif
|
| 62 | + |
| 63 | +#if defined(configUSE_CMSIS_RTOS_V2) && (configUSE_CMSIS_RTOS_V2 == 1) |
| 64 | +/*------------- CMSIS-RTOS V2 specific defines -----------*/ |
| 65 | +/* When using CMSIS-RTOSv2 set configSUPPORT_STATIC_ALLOCATION to 1 |
| 66 | + * is mandatory to avoid compile errors. |
| 67 | + * CMSIS-RTOS V2 implmentation requires the following defines |
| 68 | + */ |
| 69 | +/* cmsis_os threads are created using xTaskCreateStatic() API */ |
| 70 | +#define configSUPPORT_STATIC_ALLOCATION 1 |
| 71 | +/* CMSIS-RTOSv2 defines 56 levels of priorities. To be able to use them |
| 72 | + * all and avoid application misbehavior, configUSE_PORT_OPTIMISED_TASK_SELECTION |
| 73 | + * must be set to 0 and configMAX_PRIORITIES to 56 |
| 74 | + * |
| 75 | + */ |
| 76 | +#define configMAX_PRIORITIES (56) |
| 77 | +/* |
| 78 | + * When set to 1, configMAX_PRIORITIES can't be more than 32 |
| 79 | + * which is not suitable for the new CMSIS-RTOS v2 priority range |
| 80 | + */ |
| 81 | +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 |
| 82 | + |
| 83 | +#define configMINIMAL_STACK_SIZE ((uint16_t)128) |
| 84 | +#define configTOTAL_HEAP_SIZE ((size_t)(15 * 1024)) |
| 85 | + |
| 86 | +#else |
58 | 87 | extern char _end; /* Defined in the linker script */
|
59 | 88 | extern char _estack; /* Defined in the linker script */
|
60 | 89 | extern char _Min_Stack_Size; /* Defined in the linker script */
|
61 | 90 |
|
62 |
| -#define configUSE_PREEMPTION 1 |
63 |
| -#define configUSE_IDLE_HOOK 1 |
64 |
| -#define configUSE_TICK_HOOK 1 |
65 |
| -#define configCPU_CLOCK_HZ (SystemCoreClock) |
66 |
| -#define configTICK_RATE_HZ ((TickType_t)1000) |
67 | 91 | #define configMAX_PRIORITIES (7)
|
| 92 | + |
68 | 93 | /*
|
69 | 94 | * _Min_Stack_Size is often set to 0x400 in the linker script
|
70 | 95 | * Use it divided by 8 to set minmimal stack size of a task to 128 by default.
|
71 | 96 | * End user will have to properly configure those value depending to their needs.
|
72 | 97 | */
|
73 | 98 | #define configMINIMAL_STACK_SIZE ((uint16_t)((uint32_t)&_Min_Stack_Size/8))
|
74 | 99 | #define configTOTAL_HEAP_SIZE ((size_t)(&_estack - _Min_Stack_Size - &_end))
|
| 100 | + |
| 101 | +#endif /* configUSE_CMSIS_RTOS_V2 */ |
| 102 | + |
| 103 | +#define configUSE_PREEMPTION 1 |
| 104 | +#define configUSE_IDLE_HOOK 1 |
| 105 | +#define configUSE_TICK_HOOK 1 |
| 106 | +#define configCPU_CLOCK_HZ (SystemCoreClock) |
| 107 | +#define configTICK_RATE_HZ ((TickType_t)1000) |
75 | 108 | #define configMAX_TASK_NAME_LEN (16)
|
76 | 109 | #define configUSE_TRACE_FACILITY 1
|
77 | 110 | #define configUSE_16_BIT_TICKS 0
|
@@ -154,9 +187,18 @@ header file. */
|
154 | 187 | #define vPortSVCHandler SVC_Handler
|
155 | 188 | #define xPortPendSVHandler PendSV_Handler
|
156 | 189 |
|
157 |
| -/* IMPORTANT: This define MUST be commented when used with STM32Cube firmware, |
158 |
| - to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ |
| 190 | +/* |
| 191 | + * IMPORTANT: |
| 192 | + * osSystickHandler is called in the core SysTick_Handler definition |
| 193 | + * and is defined as weak. |
| 194 | + * For CMSIS-RTOSv2: osSystickHandler is defined as xPortSysTickHandler |
| 195 | + * For CMSIS-RTOS: osSystickHandler is defined by the cmsis_os and xPortSysTickHandler |
| 196 | + * must not be defined to prevent overwriting SysTick_Handler |
| 197 | + */ |
159 | 198 | /* #define xPortSysTickHandler SysTick_Handler */
|
| 199 | +#if defined(configUSE_CMSIS_RTOS_V2) && (configUSE_CMSIS_RTOS_V2 == 1) |
| 200 | +#define xPortSysTickHandler osSystickHandler |
| 201 | +#endif |
160 | 202 |
|
161 | 203 | #endif /* FREERTOS_CONFIG_H */
|
162 | 204 |
|
0 commit comments