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