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