]> begriffs open source - cmsis-freertos/blob - Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcConfig.h
Initial commit
[cmsis-freertos] / Demo / WIN32-MSVC / Trace_Recorder_Configuration / trcConfig.h
1 /*******************************************************************************
2  * Tracealyzer v2.7.0 Recorder Library
3  * Percepio AB, www.percepio.com
4  *
5  * trcConfig.h
6  *
7  * Configuration parameters for the trace recorder library. Before using the
8  * trace recorder library, please check that the default settings are
9  * appropriate for your system, and if necessary adjust these. Most likely, you
10  * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to
11  * reflect the number of such objects in your system. These may be
12  * over-approximated, although larger values values implies more RAM usage.
13  *
14  * Terms of Use
15  * This software is copyright Percepio AB. The recorder library is free for
16  * use together with Percepio products. You may distribute the recorder library
17  * in its original form, including modifications in trcHardwarePort.c/.h
18  * given that these modification are clearly marked as your own modifications
19  * and documented in the initial comment section of these source files.
20  * This software is the intellectual property of Percepio AB and may not be
21  * sold or in other ways commercially redistributed without explicit written
22  * permission by Percepio AB.
23  *
24  * Disclaimer
25  * The trace tool and recorder library is being delivered to you AS IS and
26  * Percepio AB makes no warranty as to its use or performance. Percepio AB does
27  * not and cannot warrant the performance or results you may obtain by using the
28  * software or documentation. Percepio AB make no warranties, express or
29  * implied, as to noninfringement of third party rights, merchantability, or
30  * fitness for any particular purpose. In no event will Percepio AB, its
31  * technology partners, or distributors be liable to you for any consequential,
32  * incidental or special damages, including any lost profits or lost savings,
33  * even if a representative of Percepio AB has been advised of the possibility
34  * of such damages, or for any claim by any third party. Some jurisdictions do
35  * not allow the exclusion or limitation of incidental, consequential or special
36  * damages, or the exclusion of implied warranties or limitations on how long an
37  * implied warranty may last, so the above limitations may not apply to you.
38  *
39  * Tabs are used for indent in this file (1 tab = 4 spaces)
40  *
41  * Copyright Percepio AB, 2014.
42  * www.percepio.com
43  ******************************************************************************/
44
45 #ifndef TRCCONFIG_H
46 #define TRCCONFIG_H
47
48 /******************************************************************************
49  * SELECTED_PORT
50  *
51  * Macro that specifies what hardware port that should be used.
52  * Available ports are:
53  *
54  * Port Name                                                    Code     Official       OS supported
55  * PORT_APPLICATION_DEFINED                             -2              -                       -
56  * PORT_NOT_SET                                                 -1              -                       -
57  * PORT_HWIndependent                                   0               Yes                     Any
58  * PORT_Win32                                                   1               Yes                     FreeRTOS on Win32
59  * PORT_Atmel_AT91SAM7                                  2               No                      Any
60  * PORT_Atmel_UC3A0                                             3               No                      Any
61  * PORT_ARM_CortexM                                             4               Yes                     Any
62  * PORT_Renesas_RX600                                   5               Yes                     Any
63  * PORT_Microchip_dsPIC_AND_PIC24               6               Yes                     Any
64  * PORT_TEXAS_INSTRUMENTS_TMS570                7               No                      Any
65  * PORT_TEXAS_INSTRUMENTS_MSP430                8               No                      Any
66  * PORT_MICROCHIP_PIC32MX                               9               Yes                     Any
67  * PORT_XILINX_PPC405                                   10              No                      FreeRTOS
68  * PORT_XILINX_PPC440                                   11              No                      FreeRTOS
69  * PORT_XILINX_MICROBLAZE                               12              No                      Any
70  * PORT_NXP_LPC210X                                             13              No                      Any
71  * PORT_MICROCHIP_PIC32MZ                               14              Yes                     Any
72  * PORT_ARM_CORTEX_A9                                   15              No                      Any
73  *****************************************************************************/
74
75 #ifndef WIN32
76         // Set the port setting here!
77         #define SELECTED_PORT PORT_NOT_SET
78
79         #if (SELECTED_PORT == PORT_NOT_SET)
80                 #error "You need to define SELECTED_PORT here!"
81         #endif
82 #else
83         // For Win32 demo projects this is set automatically
84         #define SELECTED_PORT PORT_Win32
85 #endif
86
87 /******************************************************************************
88  * FREERTOS_VERSION
89  *
90  * Specify what version of FreeRTOS that is used. This is necessary compensate
91  * for renamed symbols in the FreeRTOS kernel (does not build if incorrect).
92  *
93  * FREERTOS_VERSION_7_3_OR_7_4 (= 1)            If using FreeRTOS v7.3.0 - v7.4.2
94  * FREERTOS_VERSION_7_5_OR_7_6 (= 2)            If using FreeRTOS v7.5.0 - v7.6.0
95  * FREERTOS_VERSION_8_0_OR_LATER (= 3)          If using FreeRTOS v8.0.0 or later
96  *****************************************************************************/
97 #define FREERTOS_VERSION        FREERTOS_VERSION_8_0_OR_LATER
98
99 /******************************************************************************
100  * TRACE_RECORDER_STORE_MODE
101  *
102  * Macro which should be defined as one of:
103  * - TRACE_STORE_MODE_RING_BUFFER
104  * - TRACE_STORE_MODE_STOP_WHEN_FULL
105  * Default is TRACE_STORE_MODE_RING_BUFFER.
106  *
107  * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the
108  * events are stored in a ring buffer, i.e., where the oldest events are
109  * overwritten when the buffer becomes full. This allows you to get the last
110  * events leading up to an interesting state, e.g., an error, without having
111  * to store the whole run since startup.
112  *
113  * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the
114  * recording is stopped when the buffer becomes full. This is useful for
115  * recording events following a specific state, e.g., the startup sequence.
116  *****************************************************************************/
117 #define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
118
119 /*******************************************************************************
120  * TRACE_SCHEDULING_ONLY
121  *
122  * Macro which should be defined as an integer value.
123  *
124  * If this setting is enabled (= 1), only scheduling events are recorded.
125  * If disabled (= 0), all events are recorded.
126  *
127  * Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this
128  * option can be used to avoid storing unsupported events.
129  *
130  * Default value is 0 (store all enabled events).
131  *
132  ******************************************************************************/
133 #define TRACE_SCHEDULING_ONLY 0
134
135 /*******************************************************************************
136  * EVENT_BUFFER_SIZE
137  *
138  * Macro which should be defined as an integer value.
139  *
140  * This defines the capacity of the event buffer, i.e., the number of records
141  * it may store. Most events use one record (4 byte), although some events
142  * require multiple 4-byte records. You should adjust this to the amount of RAM
143  * available in the target system.
144  *
145  * Default value is 1000, which means that 4000 bytes is allocated for the
146  * event buffer.
147  ******************************************************************************/
148 #define EVENT_BUFFER_SIZE 15000
149
150 /*******************************************************************************
151  * NTask, NISR, NQueue, NSemaphore, NMutex
152  *
153  * A group of macros which should be defined as integer values, zero or larger.
154  *
155  * These define the capacity of the Object Property Table, i.e., the maximum
156  * number of objects active at any given point, within each object class (e.g.,
157  * task, queue, semaphore, ...).
158  *
159  * If tasks or other other objects are deleted in your system, this
160  * setting does not limit the total amount of objects created, only the number
161  * of objects that have been successfully created but not yet deleted.
162  *
163  * Using too small values will cause vTraceError to be called, which stores an
164  * error message in the trace that is shown when opening the trace file.
165  *
166  * It can be wise to start with large values for these constants,
167  * unless you are very confident on these numbers. Then do a recording and
168  * check the actual usage by selecting View menu -> Trace Details ->
169  * Resource Usage -> Object Table.
170  ******************************************************************************/
171 #define NTask                   150
172 #define NISR                    90
173 #define NQueue                  90
174 #define NSemaphore              90
175 #define NMutex                  90
176 #define NTimer                  300
177 #define NEventGroup             90
178
179 /******************************************************************************
180  * INCLUDE_MEMMANG_EVENTS
181  *
182  * Macro which should be defined as either zero (0) or one (1).
183  *
184  * This controls if malloc and free calls should be traced. Set this to zero to
185  * exclude malloc/free calls, or one (1) to include such events in the trace.
186  *
187  * Default value is 1.
188  *****************************************************************************/
189 #define INCLUDE_MEMMANG_EVENTS 1
190
191 /******************************************************************************
192  * INCLUDE_USER_EVENTS
193  *
194  * Macro which should be defined as either zero (0) or one (1).
195  *
196  * If this is zero (0) the code for creating User Events is excluded to
197  * reduce code size. User Events are application-generated events, like
198  * "printf" but for the trace log instead of console output. User Events are
199  * much faster than a printf and can therefore be used in timing critical code.
200  * See vTraceUserEvent() and vTracePrintF() in trcUser.h
201  *
202  * Default value is 1.
203  *
204  * Note that User Events are only displayed in Professional Edition.
205  *****************************************************************************/
206 #define INCLUDE_USER_EVENTS 1
207
208 /*****************************************************************************
209  * INCLUDE_ISR_TRACING
210  *
211  * Macro which should be defined as either zero (0) or one (1).
212  *
213  * If this is zero (0), the code for recording Interrupt Service Routines is
214  * excluded to reduce code size.
215  *
216  * Default value is 1.
217  *
218  * Note, if the kernel has no central interrupt dispatcher, recording ISRs
219  * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
220  * in your interrupt handlers.
221  *****************************************************************************/
222 #define INCLUDE_ISR_TRACING 1
223
224 /*****************************************************************************
225  * INCLUDE_READY_EVENTS
226  *
227  * Macro which should be defined as either zero (0) or one (1).
228  *
229  * If one (1), events are recorded when tasks enter scheduling state "ready".
230  * This uses a lot of space in the event buffer, so excluding "ready events"
231  * will allow for longer traces. Including ready events however allows for
232  * showing the initial pending time before tasks enter the execution state, and
233  * for presenting accurate response times.
234  *
235  * Default value is 1.
236  *****************************************************************************/
237 #define INCLUDE_READY_EVENTS 1
238
239 /*****************************************************************************
240  * INCLUDE_NEW_TIME_EVENTS
241  *
242  * Macro which should be defined as either zero (0) or one (1).
243  *
244  * If this is zero (1), events will be generated whenever the OS clock is
245  * increased.
246  *
247  * Default value is 0.
248  *****************************************************************************/
249 #define INCLUDE_NEW_TIME_EVENTS 1
250
251 /******************************************************************************
252  * INCLUDE_FLOAT_SUPPORT
253  *
254  * Macro which should be defined as either zero (0) or one (1).
255  *
256  * If this is zero (0), all references to floating point values are removed,
257  * in case floating point values are not supported by the platform used.
258  * Floating point values are only used in vTracePrintF and its subroutines, to
259  * store float (%f) or double (%lf) arguments.
260  *
261  * vTracePrintF can be used with integer and string arguments in either case.
262  *
263  * Default value is 1.
264  *****************************************************************************/
265 #define INCLUDE_FLOAT_SUPPORT 0
266
267 /******************************************************************************
268  * INCLUDE_OBJECT_DELETE
269  *
270  * Macro which should be defined as either zero (0) or one (1).
271  *
272  * This must be enabled (1) if tasks, queues or other
273  * traced kernel objects are deleted at runtime. If no deletes are made, this
274  * can be set to 0 in order to exclude the delete-handling code.
275  *
276  * Default value is 1.
277  *****************************************************************************/
278 #define INCLUDE_OBJECT_DELETE 1
279
280 /*******************************************************************************
281  * SYMBOL_TABLE_SIZE
282  *
283  * Macro which should be defined as an integer value.
284  *
285  * This defines the capacity of the symbol table, in bytes. This symbol table
286  * stores User Events labels and names of deleted tasks, queues, or other kernel
287  * objects. If you don't use User Events or delete any kernel
288  * objects you set this to a very low value. The minimum recommended value is 4.
289  * A size of zero (0) is not allowed since a zero-sized array may result in a
290  * 32-bit pointer, i.e., using 4 bytes rather than 0.
291  *
292  * Default value is 800.
293  ******************************************************************************/
294 #define SYMBOL_TABLE_SIZE 5000
295
296 #if (SYMBOL_TABLE_SIZE == 0)
297 #error "SYMBOL_TABLE_SIZE may not be zero!"
298 #endif
299
300 /******************************************************************************
301  * NameLenTask, NameLenQueue, ...
302  *
303  * Macros that specify the maximum lengths (number of characters) for names of
304  * kernel objects, such as tasks and queues. If longer names are used, they will
305  * be truncated when stored in the recorder.
306  *****************************************************************************/
307 #define NameLenTask                     15
308 #define NameLenISR                      15
309 #define NameLenQueue            15
310 #define NameLenSemaphore        15
311 #define NameLenMutex            15
312 #define NameLenTimer            15
313 #define NameLenEventGroup       15
314
315 /******************************************************************************
316  * TRACE_DATA_ALLOCATION
317  *
318  * This defines how to allocate the recorder data structure, i.e., using a
319  * static declaration or using a dynamic allocation in runtime (malloc).
320  *
321  * Should be one of these two options:
322  * - TRACE_DATA_ALLOCATION_STATIC (default)
323  * - TRACE_DATA_ALLOCATION_DYNAMIC
324  *
325  * Using static allocation has the benefits of compile-time errors if the buffer
326  * is too large (too large constants in trcConfig.h) and no need to call the
327  * initialization routine (xTraceInitTraceData).
328  *
329  * Using dynamic allocation may give more flexibility in some cases.
330  *****************************************************************************/
331 #define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
332
333
334
335 /******************************************************************************
336  *** ADVANCED SETTINGS ********************************************************
337  ******************************************************************************
338  * The remaining settings are not necessary to modify but allows for optimizing
339  * the recorder setup for your specific needs, e.g., to exclude events that you
340  * are not interested in, in order to get longer traces.
341  *****************************************************************************/
342
343 /******************************************************************************
344 * HEAP_SIZE_BELOW_16M
345 *
346 * An integer constant that can be used to reduce the buffer usage of memory
347 * allocation events (malloc/free). This value should be 1 if the heap size is
348 * below 16 MB (2^24 byte), and you can live with reported addresses showing the
349 * lower 24 bits only. If 0, you get the full 32-bit addresses.
350 *
351 * Default value is 0.
352 ******************************************************************************/
353 #define HEAP_SIZE_BELOW_16M 0
354
355 /******************************************************************************
356  * USE_LINKER_PRAGMA
357  *
358  * Macro which should be defined as an integer value, default is 0.
359  *
360  * If this is 1, the header file "recorderdata_linker_pragma.h" is included just
361  * before the declaration of RecorderData (in trcBase.c), i.e., the trace data
362  * structure. This allows the user to specify a pragma with linker options.
363  *
364  * Example (for IAR Embedded Workbench and NXP LPC17xx):
365  * #pragma location="AHB_RAM_MEMORY"
366  *
367  * This example instructs the IAR linker to place RecorderData in another RAM
368  * bank, the AHB RAM. This can also be used for other compilers with a similar
369  * pragmas for linker options.
370  *
371  * Note that this only applies if using static allocation, see below.
372  ******************************************************************************/
373 #define USE_LINKER_PRAGMA 0
374
375 /******************************************************************************
376  * USE_IMPLICIT_IFE_RULES
377  *
378  * Macro which should be defined as either zero (0) or one (1).
379  * Default is 1.
380  *
381  * Tracealyzer groups the events into actor instances, based on context-switches
382  * and a definition of "Instance Finish Events", or IFEs. These are kernel calls
383  * considered to be the last event in a task instance. Some kernel calls are
384  * considered IFEs by default (e.g., delay functions), but it is also possible
385  * to specify this individually for each task (see vTraceTaskInstanceFinish).
386  *
387  * If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which
388  * gives a "typical" grouping of events into instances. You can combine this
389  * with calls to vTraceTaskInstanceFinish for specific tasks.
390  *
391  * If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all
392  * events withing each task is then shown as a single instance, unless  you call
393  * vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.
394  *****************************************************************************/
395 #define USE_IMPLICIT_IFE_RULES 1
396
397 /******************************************************************************
398  * USE_16BIT_OBJECT_HANDLES
399  *
400  * Macro which should be defined as either zero (0) or one (1).
401  *
402  * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
403  * objects such as tasks and queues. This limits the supported number of
404  * concurrently active objects to 255 of each type (object class).
405  *
406  * If set to 1 (one), the recorder uses 16-bit handles to identify kernel
407  * objects such as tasks and queues. This limits the supported number of
408  * concurrent objects to 65535 of each type (object class). However, since the
409  * object property table is limited to 64 KB, the practical limit is about
410  * 3000 objects in total.
411  *
412  * Default is 0.
413  *
414  * NOTE: An object with handle above 255 will use an extra 4-byte record in
415  * the event buffer whenever referenced. Moreover, some internal tables in the
416  * recorder gets larger when using 16-bit handles. The additional RAM usage is
417  * 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.
418  *****************************************************************************/
419 #define USE_16BIT_OBJECT_HANDLES 0
420
421 /******************************************************************************
422  * USE_TRACE_ASSERT
423  *
424  * Macro which should be defined as either zero (0) or one (1).
425  * Default is 1.
426  *
427  * If this is one (1), the TRACE_ASSERT macro will verify that a condition is
428  * true. If the condition is false, vTraceError() will be called.
429  * This is used on several places in the recorder code for sanity checks on
430  * parameters. Can be switched off to reduce CPU usage of the tracing.
431  *****************************************************************************/
432 #define USE_TRACE_ASSERT 1
433
434 /*******************************************************************************
435  * USE_SEPARATE_USER_EVENT_BUFFER
436  *
437  * Macro which should be defined as an integer value.
438  * Default is zero (0).
439  *
440  * This enables and disables the use of the separate user event buffer. Using
441  * this separate buffer has the benefit of not overwriting the user events with
442  * kernel events (usually generated at a much higher rate), i.e., when using
443  * ring-buffer mode.
444  *
445  * Note: When using the separate user event buffer, you may get an artificial
446  * task instance named "Unknown actor". This is added as a placeholder when the
447  * user event history is longer than the task scheduling history.
448  ******************************************************************************/
449 #define USE_SEPARATE_USER_EVENT_BUFFER 0
450
451 /*******************************************************************************
452  * USER_EVENT_BUFFER_SIZE
453  *
454  * Macro which should be defined as an integer value.
455  *
456  * This defines the capacity of the user event buffer, in number of slots.
457  * A single user event can use between 1 and X slots, depending on the data.
458  *
459  * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
460  ******************************************************************************/
461 #define USER_EVENT_BUFFER_SIZE 10
462
463 /*******************************************************************************
464  * USER_EVENT_CHANNELS
465  *
466  * Macro which should be defined as an integer value.
467  *
468  * This defines the number of allowed user event channels.
469  *
470  * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
471  ******************************************************************************/
472 #define CHANNEL_FORMAT_PAIRS 32
473
474 #endif
475