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