]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/FreeRTOS_Plus_Trace_Recorder/Trace_Recorder_Configuration/trcConfig.h
Remove test of trace functions from the Win32/GCC build as it messes up the trace...
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / FreeRTOS_Plus_Trace_Recorder / Trace_Recorder_Configuration / trcConfig.h
1 /*******************************************************************************\r
2  * Tracealyzer v2.4.1 Recorder Library\r
3  * Percepio AB, www.percepio.com\r
4  *\r
5  * trcConfig.h\r
6  *\r
7  * Configuration parameters for the trace recorder library. Before using the \r
8  * trace recorder library, please check that the default settings are \r
9  * appropriate for your system, and if necessary adjust these. Most likely, you \r
10  * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to \r
11  * reflect the number of such objects in your system. These may be \r
12  * over-approximated, although larger values values implies more RAM usage.\r
13  *\r
14  * Terms of Use\r
15  * This software is copyright Percepio AB. The recorder library is free for\r
16  * use together with Percepio products. You may distribute the recorder library\r
17  * in its original form, including modifications in trcHardwarePort.c/.h\r
18  * given that these modification are clearly marked as your own modifications\r
19  * and documented in the initial comment section of these source files. \r
20  * This software is the intellectual property of Percepio AB and may not be \r
21  * sold or in other ways commercially redistributed without explicit written \r
22  * permission by Percepio AB.\r
23  *\r
24  * Disclaimer \r
25  * The trace tool and recorder library is being delivered to you AS IS and \r
26  * Percepio AB makes no warranty as to its use or performance. Percepio AB does \r
27  * not and cannot warrant the performance or results you may obtain by using the \r
28  * software or documentation. Percepio AB make no warranties, express or \r
29  * implied, as to noninfringement of third party rights, merchantability, or \r
30  * fitness for any particular purpose. In no event will Percepio AB, its \r
31  * technology partners, or distributors be liable to you for any consequential, \r
32  * incidental or special damages, including any lost profits or lost savings, \r
33  * even if a representative of Percepio AB has been advised of the possibility \r
34  * of such damages, or for any claim by any third party. Some jurisdictions do \r
35  * not allow the exclusion or limitation of incidental, consequential or special \r
36  * damages, or the exclusion of implied warranties or limitations on how long an \r
37  * implied warranty may last, so the above limitations may not apply to you.\r
38  *\r
39  * Copyright Percepio AB, 2013.\r
40  * www.percepio.com\r
41  ******************************************************************************/\r
42 \r
43 #ifndef TRCCONFIG_H\r
44 #define TRCCONFIG_H\r
45 \r
46 #include <stdint.h>\r
47 \r
48 /*******************************************************************************\r
49  * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION \r
50  ******************************************************************************/\r
51 \r
52 /*******************************************************************************\r
53  * EVENT_BUFFER_SIZE\r
54  *\r
55  * Macro which should be defined as an integer value.\r
56  *\r
57  * This defines the capacity of the event buffer, i.e., the number of records\r
58  * it may store. Each registered event typically use one record (4 byte), but\r
59  * vTracePrintF may use multiple records depending on the number of data args.\r
60  ******************************************************************************/\r
61 \r
62 #define EVENT_BUFFER_SIZE 5000 /* Adjust wrt. to available RAM */\r
63 \r
64 \r
65 /*******************************************************************************\r
66  * USE_LINKER_PRAGMA\r
67  *\r
68  * Macro which should be defined as an integer value, default is 0.\r
69  *\r
70  * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
71  * before the declaration of RecorderData (in trcBase.c), i.e., the trace data \r
72  * structure. This allows the user to specify a pragma with linker options. \r
73  *\r
74  * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
75  * #pragma location="AHB_RAM_MEMORY"\r
76  * \r
77  * This example instructs the IAR linker to place RecorderData in another RAM \r
78  * bank, the AHB RAM. This can also be used for other compilers with a similar\r
79  * pragmas for linker options.\r
80  * \r
81  * Note that this only applies if using static allocation, see below.\r
82  ******************************************************************************/\r
83 #define USE_LINKER_PRAGMA 0\r
84 \r
85 \r
86 /*******************************************************************************\r
87  * SYMBOL_TABLE_SIZE\r
88  *\r
89  * Macro which should be defined as an integer value.\r
90  *\r
91  * This defines the capacity of the symbol table, in bytes. This symbol table \r
92  * stores User Events labels and names of deleted tasks, queues, or other kernel\r
93  * objects. Note that the names of active objects not stored here but in the \r
94  * Object Table. Thus, if you don't use User Events or delete any kernel \r
95  * objects you set this to zero (0) to minimize RAM usage.\r
96  ******************************************************************************/\r
97 #define SYMBOL_TABLE_SIZE 5000\r
98 \r
99 /*******************************************************************************\r
100  * USE_SEPARATE_USER_EVENT_BUFFER\r
101  *\r
102  * Macro which should be defined as an integer value.\r
103  * Default is zero (0).\r
104  *\r
105  * This enables and disables the use of the separate user event buffer.\r
106  *\r
107  * Note: When using the separate user event buffer, you may get an artificial\r
108  * task instance named "Unknown actor". This is added as a placeholder when the \r
109  * user event history is longer than the task scheduling history.\r
110  ******************************************************************************/\r
111 #define USE_SEPARATE_USER_EVENT_BUFFER 0\r
112 \r
113 /*******************************************************************************\r
114  * USER_EVENT_BUFFER_SIZE\r
115  *\r
116  * Macro which should be defined as an integer value.\r
117  *\r
118  * This defines the capacity of the user event buffer, in number of slots.\r
119  * A single user event can use between 1 and X slots, depending on the data.\r
120  *\r
121  * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
122  ******************************************************************************/\r
123 #define USER_EVENT_BUFFER_SIZE 500\r
124 \r
125 /*******************************************************************************\r
126  * USER_EVENT_CHANNELS\r
127  *\r
128  * Macro which should be defined as an integer value.\r
129  *\r
130  * This defines the number of allowed user event channels.\r
131  *\r
132  * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
133  ******************************************************************************/\r
134 #define CHANNEL_FORMAT_PAIRS 32\r
135 \r
136 /*******************************************************************************\r
137  * NTask, NISR, NQueue, NSemaphore, NMutex\r
138  *\r
139  * A group of Macros which should be defined as an integer value of zero (0) \r
140  * or larger.\r
141  *\r
142  * This defines the capacity of the Object Property Table - the maximum number\r
143  * of objects active at any given point within each object class.\r
144  * \r
145  * NOTE: In case objects are deleted and created during runtime, this setting\r
146  * does not limit the total amount of objects, only the number of concurrently\r
147  * active objects. \r
148  *\r
149  * Using too small values will give an error message through the vTraceError\r
150  * routine, which makes the error message appear when opening the trace data\r
151  * in Tracealyzer. If you are using the recorder status monitor task,\r
152  * any error messages are displayed in console prints, assuming that the\r
153  * print macro has been defined properly (vConsolePrintMessage). \r
154  *\r
155  * It can be wise to start with very large values for these constants, \r
156  * unless you are very confident on these numbers. Then do a recording and\r
157  * check the actual usage in Tracealyzer. This is shown by selecting\r
158  * View -> Trace Details -> Resource Usage -> Object Table\r
159  * \r
160  * NOTE 2: Remember to account for all tasks created by the kernel, such as the \r
161  * IDLE task, timer task, and any tasks created by other 3rd party \r
162  * software components, such as communication stacks. The recorder also has an \r
163  * optional monitor task to account for, if this is used.\r
164  * Moreover, one task slot is used to indicate "(startup)", i.e., a fictive \r
165  * task that represent the time before the scheduler starts. \r
166  * NTask should thus be at least 2-3 slots larger than your application task count.\r
167  *\r
168  ******************************************************************************/\r
169 #define NTask             15\r
170 #define NISR              10\r
171 #define NQueue            10\r
172 #define NSemaphore        10\r
173 #define NMutex            10\r
174 \r
175 /* Maximum object name length for each class (includes zero termination) */\r
176 #define NameLenTask       15\r
177 #define NameLenISR        15\r
178 #define NameLenQueue      15\r
179 #define NameLenSemaphore  15\r
180 #define NameLenMutex      15\r
181 \r
182 /******************************************************************************\r
183  * TRACE_DESCRIPTION\r
184  *\r
185  * Macro which should be defined as a string.\r
186  *\r
187  * This string is stored in the trace and displayed in Tracealyzer. Can be\r
188  * used to store, e.g., system version or build date. This is also used to store\r
189  * internal error messages from the recorder, which if occurs overwrites the\r
190  * value defined here. This may be maximum 256 chars.\r
191  *****************************************************************************/\r
192 #define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"\r
193 \r
194 /******************************************************************************\r
195  * TRACE_DESCRIPTION_MAX_LENGTH\r
196  *\r
197  * The maximum length (including zero termination) for the TRACE_DESCRIPTION\r
198  * string. Since this string also is used for internal error messages from the \r
199  * recorder do not make it too short, as this may truncate the error messages.\r
200  * Default is 80. \r
201  * Maximum allowed length is 256 - the trace will fail to load if longer.\r
202  *****************************************************************************/\r
203 #define TRACE_DESCRIPTION_MAX_LENGTH 80\r
204 \r
205 \r
206 /******************************************************************************\r
207  * TRACE_DATA_ALLOCATION\r
208  *\r
209  * This defines how to allocate the recorder data structure, i.e., using a \r
210  * static declaration or using a dynamic allocation in runtime (malloc).\r
211  *\r
212  * Should be one of these two options:\r
213  * - TRACE_DATA_ALLOCATION_STATIC (default)\r
214  * - TRACE_DATA_ALLOCATION_DYNAMIC\r
215  *\r
216  * Using static allocation has the benefits of compile-time errors if the buffer \r
217  * is too large (too large constants in trcConfig.h) and no need to call the \r
218  * initialization routine (xTraceInitTraceData).\r
219  *\r
220  * Using dynamic allocation may give more flexibility in some cases.\r
221  *****************************************************************************/\r
222 \r
223 #define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
224 \r
225 \r
226 /******************************************************************************\r
227  * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE\r
228  *****************************************************************************/\r
229 \r
230 /******************************************************************************\r
231  * USE_TRACE_ASSERT\r
232  *\r
233  * Macro which should be defined as either zero (0) or one (1). \r
234  * Default is 0.\r
235  *\r
236  * If this is one (1), the TRACE_ASSERT macro will verify that a condition is \r
237  * true. If the condition is false, vTraceError() will be called.\r
238  *****************************************************************************/\r
239 #define USE_TRACE_ASSERT 1\r
240 \r
241 /******************************************************************************\r
242  * INCLUDE_FLOAT_SUPPORT\r
243  *\r
244  * Macro which should be defined as either zero (0) or one (1). \r
245  * Default is 1.\r
246  *\r
247  * If this is zero (0), all references to floating point values are removed,\r
248  * in case floating point values are not supported by the platform used.\r
249  * Floating point values are only used in vTracePrintF and its subroutines, to \r
250  * store float (%f) or double (%lf) argments. \r
251  *\r
252  * Note: vTracePrintF can still be used with integer and string arguments in\r
253  * either case.\r
254  *****************************************************************************/\r
255 #define INCLUDE_FLOAT_SUPPORT 0\r
256 \r
257 /******************************************************************************\r
258  * INCLUDE_USER_EVENTS\r
259  *\r
260  * Macro which should be defined as either zero (0) or one (1). \r
261  * Default is 1.\r
262  *\r
263  * If this is zero (0) the code for creating User Events is excluded to\r
264  * reduce code size. User Events are application-generated events, like \r
265  * "printf" but for the trace log instead of console output. User Events are \r
266  * much faster than a printf and can therefore be used in timing critical code.\r
267  * See vTraceUserEvent() and vTracePrintF() in trcUser.h\r
268  * \r
269  * Note that Tracealyzer Standard Edition or Professional Edition is required\r
270  * for User Events, they are not displayed in Tracealyzer Free Edition.\r
271  *****************************************************************************/\r
272 #define INCLUDE_USER_EVENTS 1\r
273 \r
274 /*****************************************************************************\r
275  * INCLUDE_READY_EVENTS\r
276  *\r
277  * Macro which should be defined as either zero (0) or one (1). \r
278  * Default is 1.\r
279  *\r
280  * If this is zero (0), the code for recording Ready events is \r
281  * excluded. Note, this will make it impossible to calculate the correct\r
282  * response times.\r
283  *****************************************************************************/\r
284 #define INCLUDE_READY_EVENTS 1\r
285 \r
286 /*****************************************************************************\r
287  * INCLUDE_NEW_TIME_EVENTS\r
288  *\r
289  * Macro which should be defined as either zero (0) or one (1). \r
290  * Default is 0.\r
291  *\r
292  * If this is zero (1), events will be generated whenever the os clock is\r
293  * increased.\r
294  *****************************************************************************/\r
295 #define INCLUDE_NEW_TIME_EVENTS 0\r
296 \r
297 /*****************************************************************************\r
298  * INCLUDE_ISR_TRACING\r
299  *\r
300  * Macro which should be defined as either zero (0) or one (1). \r
301  * Default is 1.\r
302  *\r
303  * If this is zero (0), the code for recording Interrupt Service Routines is \r
304  * excluded to reduce code size.\r
305  * \r
306  * Note, if the kernel has no central interrupt dispatcher, recording ISRs \r
307  * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd \r
308  * in your interrupt handlers.\r
309  *****************************************************************************/\r
310 #define INCLUDE_ISR_TRACING 1\r
311 \r
312 /******************************************************************************\r
313  * INCLUDE_OBJECT_DELETE\r
314  * \r
315  * Macro which should be defined as either zero (0) or one (1). \r
316  * Default is 1.\r
317  *\r
318  * This must be enabled (1) if tasks, queues or other \r
319  * traced kernel objects are deleted at runtime. If no deletes are made, this \r
320  * can be set to 0 in order to exclude the delete-handling code.\r
321  *****************************************************************************/\r
322 #define INCLUDE_OBJECT_DELETE 0\r
323 \r
324 /******************************************************************************\r
325  * CONFIGURATION RELATED TO BEHAVIOR\r
326  *****************************************************************************/\r
327 \r
328 /******************************************************************************\r
329  * TRACE_RECORDER_STORE_MODE\r
330  *\r
331  * Macro which should be defined as one of:\r
332  * - TRACE_STORE_MODE_RING_BUFFER\r
333  * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
334  * Default is TRACE_STORE_MODE_RING_BUFFER.\r
335  *\r
336  * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are \r
337  * stored in a ring buffer, i.e., where the oldest events are overwritten when \r
338  * the buffer becomes full. This allows you to get the last events leading up \r
339  * to an interesting state, e.g., an error, without having a large trace buffer\r
340  * for string the whole run since startup. In this mode, the recorder can run\r
341  * "forever" as the buffer never gets full, i.e., in the sense that it always\r
342  * has room for more events.\r
343  *\r
344  * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the\r
345  * system using your debugger and then do a RAM dump, or to explicitly stop the\r
346  * recorder using vTraceStop() and then store/upload the trace data using a\r
347  * task that you need to provide yourself. The trace data is found in the struct\r
348  * RecorderData, initialized in trcBase.c.\r
349  *\r
350  * Note that, if you upload the trace using a RAM dump, i.e., when the system is \r
351  * halted on a breakpoint or by a debugger command, there is no need to stop the \r
352  * recorder first.\r
353  *\r
354  * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is\r
355  * stopped when the buffer becomes full. When the recorder stops itself this way\r
356  * vTracePortEnd() is called which allows for custom actions, such as triggering\r
357  * a task that stores the trace buffer, i.e., in case taking a RAM dump\r
358  * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd\r
359  * saves the trace to file directly, but this is not recommended in a real-time\r
360  * system since the scheduler is blocked during the processing of vTracePortEnd.\r
361  *****************************************************************************/\r
362 \r
363 #define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
364 \r
365 /******************************************************************************\r
366  * STOP_AFTER_N_EVENTS\r
367  *\r
368  * Macro which should be defined as an integer value, or not defined.\r
369  * Default is -1\r
370  *\r
371  * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when\r
372  * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when\r
373  * the specified number of events has been observed. This value can be larger\r
374  * than the buffer size, to allow for test of the "wrapping around" that occurs\r
375  * in ring buffer mode . A negative value (or no definition of this macro)\r
376  * disables this feature.\r
377  *****************************************************************************/\r
378 #define STOP_AFTER_N_EVENTS -1\r
379 \r
380 /******************************************************************************\r
381  * USE_IMPLICIT_IFE_RULES\r
382  *\r
383  * Macro which should be defined as either zero (0) or one (1). \r
384  * Default is 1.\r
385  *\r
386  * ### Instance Finish Events (IFE) ###\r
387  *\r
388  * For tasks with "infinite" main loops (non-terminating tasks), the concept\r
389  * of a task instance has no clear definition, it is an application-specific\r
390  * thing. Tracealyzer allows you to define Instance Finish Events (IFEs),\r
391  * which marks the point in a cyclic task when the "task instance" ends.\r
392  * The IFE is a blocking kernel call, typically in the main loop of a task\r
393  * which typically reads a message queue, waits for a semaphore or performs\r
394  * an explicit delay.\r
395  *\r
396  * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)\r
397  * will define what kernel calls are considered by default to be IFEs.\r
398  *\r
399  * However, Implicit IFEs only applies to blocking kernel calls. If a\r
400  * service reads a message without blocking, it does not create a new\r
401  * instance since no blocking occurred.\r
402  *\r
403  * Moreover, the actual IFE might sometimes be another blocking call. We \r
404  * therefore allow for user-defined Explicit IFEs by calling\r
405  *\r
406  *     vTraceTaskInstanceIsFinished()\r
407  *\r
408  * right before the kernel call considered as IFE. This does not create an\r
409  * additional event but instead stores the service code and object handle\r
410  * of the IFE call as properties of the task.\r
411  *\r
412  * If using Explicit IFEs and the task also calls an Implicit IFE, this may \r
413  * result in additional incorrect task instances.\r
414  * This is solved by disabling the Implicit IFEs for the task, by adding\r
415  * a call to\r
416  * \r
417  *     vTraceTaskSkipDefaultInstanceFinishedEvents()\r
418  * \r
419  * in the very beginning of that task. This allows you to combine Explicit IFEs\r
420  * for some tasks with Implicit IFEs for the rest of the tasks, if\r
421  * USE_IMPLICIT_IFE_RULES is 1.\r
422  *\r
423  * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled\r
424  * for all tasks. Tasks will then be considered to have a single instance only, \r
425  * covering all execution fragments, unless you define an explicit IFE in each\r
426  * task by calling vTraceTaskInstanceIsFinished before the blocking call.\r
427  *****************************************************************************/\r
428 #define USE_IMPLICIT_IFE_RULES 1\r
429 \r
430 /******************************************************************************\r
431  * INCLUDE_SAVE_TO_FILE\r
432  *\r
433  * Macro which should be defined as either zero (0) or one (1).\r
434  * Default is 0.\r
435  *\r
436  * If enabled (1), the recorder will include code for saving the trace\r
437  * to a local file system.\r
438  ******************************************************************************/\r
439 #ifdef WIN32\r
440     #define INCLUDE_SAVE_TO_FILE 1\r
441 #else\r
442     #define INCLUDE_SAVE_TO_FILE 0\r
443 #endif\r
444 \r
445 /******************************************************************************\r
446  * TRACE_PROGRESS_MONITOR_TASK_PRIORITY\r
447  *\r
448  * Macro which sets the priority of the "recorder status monitor" task.\r
449  *\r
450  * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
451  * the recorder status using the vTraceConsoleMessage macro, which is to\r
452  * be mapped to your console "printf" routine. The task is named TraceMon but \r
453  * is intentionally excluded from the demo trace.\r
454  *\r
455  * Default is tskIDLE_PRIORITY + 1\r
456  * Note that if your system constantly has a high CPU load from high-priority \r
457  * tasks, this might not be get a chance to execute.\r
458  * \r
459  * See vTraceMonitorTask in trcUser.c\r
460  *****************************************************************************/\r
461 #define TRACE_PROGRESS_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)\r
462 \r
463 /******************************************************************************\r
464  * TRACE_PROGRESS_MONITOR_TASK_STACKSIZE\r
465  *\r
466  * Macro which sets the stack size of the "recorder status monitor" task.\r
467  *\r
468  * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
469  * the recorder status using the vTraceConsoleMessage macro, which is to\r
470  * be mapped to your console "printf" routine. The task is intentionally \r
471  * excluded from the demo trace.\r
472  *\r
473  * See vTraceMonitorTask in trcUser.c\r
474  *****************************************************************************/\r
475 #define TRACE_PROGRESS_MONITOR_TASK_STACKSIZE 500\r
476 \r
477 /******************************************************************************\r
478  * TRACE_PROGRESS_MONITOR_TASK_PERIOD\r
479  *\r
480  * Macro which sets the period of the "recorder status monitor" task.\r
481  *\r
482  * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
483  * the recorder status using the vTraceConsoleMessage macro, which is to\r
484  * be mapped to your console "printf" routine. The task is named TraceMon but \r
485  * is intentionally excluded from the demo trace.\r
486  *\r
487  * Default is 1000 ticks (typically 1 second). On the Windows port, a lower \r
488  * value is suggested since the Windows port runs very slowly, often 20-40\r
489  * times slower than the simulated time.\r
490  *\r
491  * See vTraceMonitorTask in trcUser.c\r
492  *****************************************************************************/\r
493 #ifdef WIN32\r
494     #define TRACE_PROGRESS_MONITOR_TASK_PERIOD 100\r
495 #else\r
496     #define TRACE_PROGRESS_MONITOR_TASK_PERIOD 1000\r
497 #endif\r
498 \r
499 /******************************************************************************\r
500  * TEAM_LICENSE_CODE\r
501  *\r
502  * Macro which defines a string - the team license code.\r
503  * If no team license is available, this should be an empty string "".\r
504  * This should be maximum 32 chars, including zero-termination.\r
505  *****************************************************************************/\r
506 #define TEAM_LICENSE_CODE ""\r
507 \r
508 #endif\r
509 \r