FreeRTOSConfig.h
Go to the documentation of this file.
1 /*
2  FreeRTOS V8.0 - Copyright (C) 2011 Real Time Engineers Ltd.
3 
4 
5  ***************************************************************************
6  * *
7  * FreeRTOS tutorial books are available in pdf and paperback. *
8  * Complete, revised, and edited pdf reference manuals are also *
9  * available. *
10  * *
11  * Purchasing FreeRTOS documentation will not only help you, by *
12  * ensuring you get running as quickly as possible and with an *
13  * in-depth knowledge of how to use FreeRTOS, it will also help *
14  * the FreeRTOS project to continue with its mission of providing *
15  * professional grade, cross platform, de facto standard solutions *
16  * for microcontrollers - completely free of charge! *
17  * *
18  * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
19  * *
20  * Thank you for using FreeRTOS, and thank you for your support! *
21  * *
22  ***************************************************************************
23 
24 
25  This file is part of the FreeRTOS distribution.
26 
27  FreeRTOS is free software; you can redistribute it and/or modify it under
28  the terms of the GNU General Public License (version 2) as published by the
29  Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
30  >>>NOTE<<< The modification to the GPL is included to allow you to
31  distribute a combined work that includes FreeRTOS without being obliged to
32  provide the source code for proprietary components outside of the FreeRTOS
33  kernel. FreeRTOS is distributed in the hope that it will be useful, but
34  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
35  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
36  more details. You should have received a copy of the GNU General Public
37  License and the FreeRTOS license exception along with FreeRTOS; if not it
38  can be viewed here: http://www.freertos.org/a00114.html and also obtained
39  by writing to Richard Barry, contact details for whom are available on the
40  FreeRTOS WEB site.
41 
42  1 tab == 4 spaces!
43 
44  http://www.FreeRTOS.org - Documentation, latest information, license and
45  contact details.
46 
47  http://www.SafeRTOS.com - A version that is certified for use in safety
48  critical systems.
49 
50  http://www.OpenRTOS.com - Commercial support, development, porting,
51  licensing and training services.
52 */
53 
54 #ifndef FREERTOS_CONFIG_H
55 #define FREERTOS_CONFIG_H
56 
57 
58 
59 /*-----------------------------------------------------------
60  * Application specific definitions.
61  *
62  * These definitions should be adjusted for your particular hardware and
63  * application requirements.
64  *
65  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
66  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
67  *----------------------------------------------------------*/
68 #include "sys_config.h"
69 #define configUSE_PREEMPTION 1
70 #define configUSE_IDLE_HOOK 1
71 #define configUSE_TICK_HOOK 0
72 #define configUSE_MALLOC_FAILED_HOOK 1
73 
74 #define configCPU_CLOCK_HZ (SYS_CFG_DESIRED_CPU_CLK)
75 #define configTICK_RATE_HZ ( 1000 )
76 #define configENABLE_BACKWARD_COMPATIBILITY 0
77 
78 /* Avoid using IDLE priority since I have found that the logger task corrupts the file system at IDLE priority.
79  * This probably has to do with SPI(with DMA) bus not functioning correctly when IDLE task puts the CPU to sleep.
80  *
81  * configMAX_PRIORITIES should include +1 for idle task priority, and + periodic scheduler priority.
82  */
83 #define PERIODIC_SCH_PRIORITIES (5)
84 #define configMAX_PRIORITIES (1 + 4 + PERIODIC_SCH_PRIORITIES)
85 
86 // Idle priority of 0 should not be used
87 #define PRIORITY_LOW 1
88 #define PRIORITY_MEDIUM 2
89 #define PRIORITY_HIGH 3
90 // Critical priority is the highest priority before the periodic scheduler priorities start
91 #define PRIORITY_CRITICAL (configMAX_PRIORITIES - PERIODIC_SCH_PRIORITIES - 1)
92 
93 
103 #define configMEM_MANG_TYPE 3
104 #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24 * 1024 ) )
105 
107 /* Stack size and utility functions */
108 #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
109 #define STACK_BYTES(x) ((x)/4)
110 #define MS_PER_TICK() ( 1000 / configTICK_RATE_HZ)
111 #define OS_MS(x) ( x / MS_PER_TICK() )
112 #define vTaskDelayMs(x) vTaskDelay(OS_MS((x)))
113 #define xTaskGetMsCount() (xTaskGetTickCount() * MS_PER_TICK())
114 
115 /* General config */
116 #define configMAX_TASK_NAME_LEN ( 8 )
117 #define configUSE_16_BIT_TICKS 0
118 #define configIDLE_SHOULD_YIELD 1
119 #define configCHECK_FOR_STACK_OVERFLOW 2
120 #define configUSE_ALTERNATIVE_API 0
121 #define configQUEUE_REGISTRY_SIZE 0
122 
123 /* FreeRTOS Co-routine */
124 #define configUSE_CO_ROUTINES 0
125 #define configMAX_CO_ROUTINE_PRIORITIES ( 1 )
126 
127 /* Run time and task stats gathering related definitions. */
128 #define configGENERATE_RUN_TIME_STATS 1
129 #define configUSE_TRACE_FACILITY 0
130 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
131 #define INCLUDE_eTaskGetState 1
132 
133 
134 /* Features config */
135 #define configUSE_MUTEXES 1
136 #define configUSE_RECURSIVE_MUTEXES 0
137 #define configUSE_COUNTING_SEMAPHORES 1
138 #define configUSE_QUEUE_SETS 1
139 #define INCLUDE_vTaskPrioritySet 0
140 #define INCLUDE_uxTaskPriorityGet 0
141 #define INCLUDE_vTaskDelete 0
142 #define INCLUDE_vTaskCleanUpResources 0
143 #define INCLUDE_vTaskSuspend 1
144 #define INCLUDE_vTaskDelayUntil 1
145 #define INCLUDE_vTaskDelay 1
146 #define INCLUDE_uxTaskGetStackHighWaterMark 1
147 #define INCLUDE_xTaskGetSchedulerState 1
148 #define INCLUDE_xTaskGetIdleTaskHandle 1
149 
150 /* FreeRTOS Timer or daemon task configuration */
151 #define configUSE_TIMERS 0
152 #define configTIMER_TASK_PRIORITY PRIORITY_HIGH
153 #define configTIMER_QUEUE_LENGTH 10
154 #define configTIMER_TASK_STACK_DEPTH STACK_BYTES(2048)
155 #define INCLUDE_xTimerPendFunctionCall 0
156 
157 
158 
159 /* Use the system definition, if there is one */
160 #ifdef __NVIC_PRIO_BITS
161  #define configPRIO_BITS __NVIC_PRIO_BITS
162 #else
163  #define configPRIO_BITS 5 /* 32 priority levels */
164 #endif
165 
166 #include "lpc_isr.h"
167 /* The lowest priority. */
168 #define configKERNEL_INTERRUPT_PRIORITY ( IP_KERNEL << (8 - configPRIO_BITS) )
169 /* Priority 5, or 160 as only the top three bits are implemented. */
170 #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( IP_SYSCALL << (8 - configPRIO_BITS) )
171 /* ARM Cortex M3 has hardware instruction to count leading zeroes */
172 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
173 
174 
175 
176 #if (0 == configUSE_TRACE_FACILITY)
177  /*
178  * If trace facility is enabled, also track the last running task.
179  * We do this by copying the name of the last task that got switched in
180  * to an auxiliary memory location.
181  *
182  * Poor man's trace just records the last task that was running before a potential system crash ;(
183  */
184  #include "fault_registers.h"
185  #define traceTASK_SWITCHED_IN() \
186  do { \
187  uint32_t *pTaskName = (uint32_t*)(pxCurrentTCB->pcTaskName); \
188  FAULT_LAST_RUNNING_TASK_NAME = *pTaskName; \
189  } while (0)
190 
191  #ifdef __cplusplus
192  extern "C" {
193  #endif
194  void rts_not_full_trace_init( void );
195  unsigned int rts_not_full_trace_get();
197  #ifdef __cplusplus
198  }
199  #endif
200 
201  #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() rts_not_full_trace_init()
202  #define portGET_RUN_TIME_COUNTER_VALUE() rts_not_full_trace_get()
203  #define portRESET_TIMER_FOR_RUN_TIME_STATS() rts_not_full_trace_reset()
204 
205  // Stub out macros for the trace facility to avoid conditional compilation everywhere
206  #include "trace/trcUser.h"
207 
208 // The real trace facility
209 #else
210  unsigned trace_get_run_time_counter(void);
211  #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() /* Sys tick is initted by vPortSetupTimerInterrupt() */
212  #define portGET_RUN_TIME_COUNTER_VALUE() trace_get_run_time_counter()
213  #define portRESET_TIMER_FOR_RUN_TIME_STATS() /* Resetting not supported */
214  #include "trace/trcKernelPort.h" /* Must be included last */
215 #endif /* (1 == configUSE_TRACE_FACILITY) */
216 
217 #endif /* FREERTOS_CONFIG_H */
void rts_not_full_trace_reset()
Interrupt Service Routine (ISR) functions.
This file simply provides registers that are used to detect faults. These registers should be defined...
unsigned trace_get_run_time_counter(void)
Definition: run_time_counter.c:8
void rts_not_full_trace_init(void)
This file provides the configurable parameters for your project.
unsigned int rts_not_full_trace_get()