97
97
1 tab == 4 spaces!
98
98
*/
99
99
100
- #pragma once
101
-
102
- #ifdef __cplusplus
103
- extern "C" {
104
- #endif
100
+ #ifndef FREERTOS_CONFIG_H
101
+ #define FREERTOS_CONFIG_H
105
102
106
103
#include "platform.h"
107
104
#include <stdio.h>
@@ -118,116 +115,101 @@ extern "C" {
118
115
* See http://www.freertos.org/a00110.html.
119
116
*----------------------------------------------------------*/
120
117
121
- /* Tickless mode is not used. */
122
-
123
- /* Some of the standard demo test tasks assume a tick rate of 1KHz, even
124
- though that is faster than would normally be warranted by a real
125
- application. */
126
- #define configTICK_RATE_HZ (1000)
127
-
128
- /* The full demo always has tasks to run so the tick will never be turned
129
- off. The blinky demo will use the default tickless idle implementation to
130
- turn the tick off. */
131
- #define configUSE_TICKLESS_IDLE (0)
118
+ #define configSUPPORT_STATIC_ALLOCATION 1
132
119
133
- /* Hook function related definitions. */
134
- #define configUSE_TICK_HOOK (0)
135
- #define configCHECK_FOR_STACK_OVERFLOW (2)
136
- #define configUSE_MALLOC_FAILED_HOOK (1)
137
- #define configUSE_IDLE_HOOK (0)
138
-
139
- #define configENERGY_MODE (sleepEM1)
140
-
141
- /* Main functions*/
142
- /* Run time stats gathering related definitions. */
143
- #define configGENERATE_RUN_TIME_STATS (0)
144
-
145
- /* Co-routine related definitions. */
146
- #define configUSE_CO_ROUTINES (0)
120
+ #define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR
121
+ #define configCLIC_TIMER_ENABLE_ADDRESS (0x02800407)
122
+ #define configUSE_PREEMPTION 1
123
+ #define configUSE_IDLE_HOOK 1
124
+ #define configUSE_TICK_HOOK 0
125
+ #ifndef configUSE_TICKLESS_IDLE
126
+ // Maybe Compile flags is passed by command line
127
+ #define configUSE_TICKLESS_IDLE 1
128
+ #endif
129
+ #define configCPU_CLOCK_HZ (10 * 1000 * 1000) /*QEMU*/
130
+ #define configTICK_RATE_HZ ((TickType_t) 1000)
131
+ #define configMAX_PRIORITIES (32)
132
+ /* Creating idle task */
133
+ /* -1 -> prvInitialiseNewTask: (subtract 1 to get top of stack) pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1
134
+ * ] ); */
135
+ /* -1 -> prvInitialiseNewTask: (subtract 1 in case not matching 8 bytes alignment) pxTopOfStack = ( StackType_t * ) ( ( (
136
+ * portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); */
137
+ /* Running idle task */
138
+ /* -12 -> prvIdleTask: addi sp, sp, -48 */
139
+ /* -16 -> prvIdleTask.xTaskResumeAll: addi sp, sp, -64 */
140
+ /* Here comes an interrupt after prvIdleTask.xTaskResumeAll.vTaskExitCritical */
141
+ /* -30 -> freertos_risc_v_trap_handler: addi sp, sp, -portCONTEXT_SIZE */
142
+ /* -34 -> portasmSAVE_ADDITIONAL_REGISTERS: addi sp, sp, -(portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE) */
143
+ /* Checking for stack overflow */
144
+ /* 4 -> taskCHECK_FOR_STACK_OVERFLOW: if( ( pulStack[ 0 ] != ulCheckValue ) || ( pulStack[ 1 ] != ulCheckValue ) || ( pulStack[ 2
145
+ * ] != ulCheckValue ) || ( pulStack[ 3 ] != ulCheckValue ) ) */
146
+ #define configMINIMAL_STACK_SIZE ((unsigned short) 114) /* SIZE-1-1-12-16-30-34>=4 */
147
+ #define configTOTAL_HEAP_SIZE ((size_t) 14100)
148
+ #define configMAX_TASK_NAME_LEN (16)
149
+ #define configUSE_TRACE_FACILITY 1
150
+ #define configUSE_STATS_FORMATTING_FUNCTIONS 1
151
+ #define configUSE_16_BIT_TICKS 0
152
+ #define configIDLE_SHOULD_YIELD 1
153
+ #define configUSE_MUTEXES 1
154
+ #define configQUEUE_REGISTRY_SIZE 8
155
+ #define configCHECK_FOR_STACK_OVERFLOW 2
156
+ #define configUSE_RECURSIVE_MUTEXES 1
157
+ #define configUSE_MALLOC_FAILED_HOOK 1
158
+ #define configUSE_APPLICATION_TASK_TAG 0
159
+ #define configUSE_COUNTING_SEMAPHORES 1
160
+ #define configGENERATE_RUN_TIME_STATS 0
161
+ #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
162
+
163
+ /* Co-routine definitions. */
164
+ #define configUSE_CO_ROUTINES 0
147
165
#define configMAX_CO_ROUTINE_PRIORITIES (2)
148
166
149
- /* Software timer related definitions. */
150
- #define configUSE_TIMERS (1)
151
- #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* Highest priority */
152
- #define configTIMER_QUEUE_LENGTH (4)
167
+ /* Software timer definitions. */
168
+ #define configUSE_TIMERS 1
169
+ #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
170
+ #define configTIMER_QUEUE_LENGTH 4
153
171
#define configTIMER_TASK_STACK_DEPTH (400)
154
172
155
- /* Cortex-M specific definitions. */
156
- #ifdef __NVIC_PRIO_BITS
157
- /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
158
- #define configPRIO_BITS (__NVIC_PRIO_BITS)
159
- #else
160
- #define configPRIO_BITS 3 /* 7 priority levels */
173
+ /* Task priorities. Allow these to be overridden. */
174
+ #ifndef uartPRIMARY_PRIORITY
175
+ #define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3)
161
176
#endif
162
177
163
- /* The lowest interrupt priority that can be used in a call to a "set priority"
164
- function. */
165
- #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY (0x07)
166
-
167
- /* The highest interrupt priority that can be used by any interrupt service
168
- routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
169
- INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
170
- PRIORITY THAN THIS! (higher priorities are lower numeric values. */
171
- #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY (0x03)
172
-
173
- /* Interrupt priorities used by the kernel port layer itself. These are generic
174
- to all Cortex-M ports, and do not rely on any particular library functions. */
175
- #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
176
- /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
177
- See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
178
- #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
179
-
180
- /* FreeRTOS MPU specific definitions. */
181
- #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS (0)
182
-
183
- #define configCPU_CLOCK_HZ (10 * 1000 * 1000)
184
- #define configUSE_PREEMPTION (1)
185
- #define configUSE_TIME_SLICING (1)
186
- #define configUSE_PORT_OPTIMISED_TASK_SELECTION (1)
187
- #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */
188
- #define configMAX_PRIORITIES (32)
189
- #define configMINIMAL_STACK_SIZE ((unsigned short) 112) /* Number of words to use for Idle and Timer stacks */
190
- #define configMAX_TASK_NAME_LEN (16)
191
- #define configUSE_16_BIT_TICKS (0)
192
- #define configIDLE_SHOULD_YIELD (1)
193
- #define configUSE_MUTEXES (1)
194
- #define configUSE_RECURSIVE_MUTEXES (1)
195
- #define configUSE_COUNTING_SEMAPHORES (1)
196
- #define configQUEUE_REGISTRY_SIZE (8)
197
- // #define configUSE_QUEUE_SETS (0)
198
- // #define configUSE_NEWLIB_REENTRANT (0)
199
- #define configENABLE_BACKWARD_COMPATIBILITY (1)
200
- #define configSUPPORT_STATIC_ALLOCATION (1)
201
-
202
178
/* Optional functions - most linkers will remove unused functions anyway. */
203
- #define INCLUDE_vTaskPrioritySet (1)
204
- #define INCLUDE_uxTaskPriorityGet (1)
205
- #define INCLUDE_vTaskDelete (1)
206
- #define INCLUDE_vTaskSuspend (1)
207
- // #define INCLUDE_xResumeFromISR (1)
208
- #define INCLUDE_vTaskDelayUntil (1)
209
- #define INCLUDE_vTaskDelay (1)
210
- #define INCLUDE_xTaskGetSchedulerState (0)
211
- #define INCLUDE_xTaskGetCurrentTaskHandle (0)
212
- #define INCLUDE_uxTaskGetStackHighWaterMark (1)
213
- #define INCLUDE_xTaskGetIdleTaskHandle (0)
214
- // #define INCLUDE_xTimerGetTimerDaemonTaskHandle (1)
215
- // #define INCLUDE_pcTaskGetTaskName (1)
216
- #define INCLUDE_eTaskGetState (1)
217
- // #define INCLUDE_xEventGroupSetBitFromISR (1)
218
- #define INCLUDE_xTimerPendFunctionCall (1)
219
-
179
+ #define INCLUDE_vTaskPrioritySet 1
180
+ #define INCLUDE_uxTaskPriorityGet 1
181
+ #define INCLUDE_vTaskDelete 1
182
+ #define INCLUDE_vTaskCleanUpResources 1
183
+ #define INCLUDE_vTaskSuspend 1
184
+ #define INCLUDE_vTaskDelayUntil 1
185
+ #define INCLUDE_vTaskDelay 1
186
+ #define INCLUDE_eTaskGetState 1
187
+ #define INCLUDE_xTimerPendFunctionCall 1
188
+ #define INCLUDE_xTimerPendFunctionCall 1
189
+ #define INCLUDE_uxTaskGetStackHighWaterMark 1
190
+
191
+ /* Overwrite some of the stack sizes allocated to various test and demo tasks.
192
+ Like all task stack sizes, the value is the number of words, not bytes. */
193
+ #define bktBLOCK_TIME_TASK_STACK_SIZE 100
194
+ #define notifyNOTIFIED_TASK_STACK_SIZE 120
195
+ #define priSUSPENDED_RX_TASK_STACK_SIZE 90
196
+ #define tmrTIMER_TEST_TASK_STACK_SIZE 100
197
+ #define ebRENDESVOUS_TEST_TASK_STACK_SIZE 100
198
+ #define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE 115
199
+ #define genqMUTEX_TEST_TASK_STACK_SIZE 90
200
+ #define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE 100
201
+ #define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE 90
202
+
203
+ extern void vAssertCalled (void );
220
204
/* Stop if an assertion fails. */
221
205
#define configASSERT (x ) \
222
206
if ((x) == 0) \
223
207
vAssertCalled()
224
208
225
- /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
226
- standard names. */
227
- // #define vPortSVCHandler SVC_Handler
228
- // #define xPortPendSVHandler PendSV_Handler
229
- #define xPortSysTickHandler SysTick_Handler
209
+ #if ( configUSE_TICKLESS_IDLE != 0 )
210
+ #include "portmacro.h"
211
+ extern void vApplicationSleep ( TickType_t xExpectedIdleTime );
212
+ #define portSUPPRESS_TICKS_AND_SLEEP ( xExpectedIdleTime ) vApplicationSleep(xExpectedIdleTime)
213
+ #endif
230
214
231
- #ifdef __cplusplus
232
- }
233
215
#endif
0 commit comments