1 /*******************************************************************************
\r
2 * Tracealyzer v2.6.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 * Copyright Percepio AB, 2013.
\r
41 ******************************************************************************/
\r
46 /*******************************************************************************
\r
47 * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION
\r
48 ******************************************************************************/
\r
50 /*******************************************************************************
\r
53 * Macro which should be defined as an integer value.
\r
55 * This defines the capacity of the event buffer, i.e., the number of records
\r
56 * it may store. Each registered event typically use one record (4 byte), but
\r
57 * vTracePrintF may use multiple records depending on the number of data args.
\r
58 ******************************************************************************/
\r
60 #define EVENT_BUFFER_SIZE 4000 /* Adjust wrt. to available RAM */
\r
63 /*******************************************************************************
\r
66 * Macro which should be defined as an integer value, default is 0.
\r
68 * If this is 1, the header file "recorderdata_linker_pragma.h" is included just
\r
69 * before the declaration of RecorderData (in trcBase.c), i.e., the trace data
\r
70 * structure. This allows the user to specify a pragma with linker options.
\r
72 * Example (for IAR Embedded Workbench and NXP LPC17xx):
\r
73 * #pragma location="AHB_RAM_MEMORY"
\r
75 * This example instructs the IAR linker to place RecorderData in another RAM
\r
76 * bank, the AHB RAM. This can also be used for other compilers with a similar
\r
77 * pragmas for linker options.
\r
79 * Note that this only applies if using static allocation, see below.
\r
80 ******************************************************************************/
\r
82 #define USE_LINKER_PRAGMA 0
\r
85 /*******************************************************************************
\r
88 * Macro which should be defined as an integer value.
\r
90 * This defines the capacity of the symbol table, in bytes. This symbol table
\r
91 * stores User Events labels and names of deleted tasks, queues, or other kernel
\r
92 * objects. Note that the names of active objects not stored here but in the
\r
93 * Object Table. Thus, if you don't use User Events or delete any kernel
\r
94 * objects you set this to a very low value, e.g. 4, but not zero (0) since
\r
95 * this causes a declaration of a zero-sized array, for which the C compiler
\r
96 * behavior is not standardized and may cause misaligned data.
\r
97 ******************************************************************************/
\r
98 #define SYMBOL_TABLE_SIZE 1000
\r
100 #if (SYMBOL_TABLE_SIZE == 0)
\r
101 #error "SYMBOL_TABLE_SIZE may not be zero!"
\r
104 /*******************************************************************************
\r
105 * USE_SEPARATE_USER_EVENT_BUFFER
\r
107 * Macro which should be defined as an integer value.
\r
108 * Default is zero (0).
\r
110 * This enables and disables the use of the separate user event buffer.
\r
112 * Note: When using the separate user event buffer, you may get an artificial
\r
113 * task instance named "Unknown actor". This is added as a placeholder when the
\r
114 * user event history is longer than the task scheduling history.
\r
115 ******************************************************************************/
\r
116 #define USE_SEPARATE_USER_EVENT_BUFFER 0
\r
118 /*******************************************************************************
\r
119 * USER_EVENT_BUFFER_SIZE
\r
121 * Macro which should be defined as an integer value.
\r
123 * This defines the capacity of the user event buffer, in number of slots.
\r
124 * A single user event can use between 1 and X slots, depending on the data.
\r
126 * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
\r
127 ******************************************************************************/
\r
128 #define USER_EVENT_BUFFER_SIZE 500
\r
130 /*******************************************************************************
\r
131 * USER_EVENT_CHANNELS
\r
133 * Macro which should be defined as an integer value.
\r
135 * This defines the number of allowed user event channels.
\r
137 * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
\r
138 ******************************************************************************/
\r
139 #define CHANNEL_FORMAT_PAIRS 32
\r
141 /*******************************************************************************
\r
142 * NTask, NISR, NQueue, NSemaphore, NMutex
\r
144 * A group of Macros which should be defined as an integer value of zero (0)
\r
147 * This defines the capacity of the Object Property Table - the maximum number
\r
148 * of objects active at any given point within each object class.
\r
150 * NOTE: In case objects are deleted and created during runtime, this setting
\r
151 * does not limit the total amount of objects, only the number of concurrently
\r
154 * Using too small values will give an error message through the vTraceError
\r
155 * routine, which makes the error message appear when opening the trace data
\r
156 * in Tracealyzer. If you are using the recorder status monitor task,
\r
157 * any error messages are displayed in console prints, assuming that the
\r
158 * print macro has been defined properly (vConsolePrintMessage).
\r
160 * It can be wise to start with very large values for these constants,
\r
161 * unless you are very confident on these numbers. Then do a recording and
\r
162 * check the actual usage in Tracealyzer. This is shown by selecting
\r
163 * View -> Trace Details -> Resource Usage -> Object Table
\r
165 * NOTE 2: Remember to account for all tasks and other objects created by
\r
166 * the kernel, such as the IDLE task, any timer tasks, and any tasks created
\r
167 * by other 3rd party software components, such as communication stacks.
\r
168 * Moreover, one task slot is used to indicate "(startup)", i.e., a fictive
\r
169 * task that represent the time before the scheduler starts.
\r
170 * NTask should thus be at least 2-3 slots larger than your application task count.
\r
172 ******************************************************************************/
\r
176 #define NSemaphore 15
\r
179 #define NEventGroup 15
\r
181 /* Maximum object name length for each class (includes zero termination) */
\r
182 #define NameLenTask 15
\r
183 #define NameLenISR 15
\r
184 #define NameLenQueue 15
\r
185 #define NameLenSemaphore 15
\r
186 #define NameLenMutex 15
\r
187 #define NameLenTimer 15
\r
188 #define NameLenEventGroup 15
\r
190 /******************************************************************************
\r
191 * TRACE_DESCRIPTION
\r
193 * Macro which should be defined as a string.
\r
195 * This string is stored in the trace and displayed in Tracealyzer. Can be
\r
196 * used to store, e.g., system version or build date. This is also used to store
\r
197 * internal error messages from the recorder, which if occurs overwrites the
\r
198 * value defined here. This may be maximum 256 chars.
\r
199 *****************************************************************************/
\r
200 #define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"
\r
202 /******************************************************************************
\r
203 * TRACE_DESCRIPTION_MAX_LENGTH
\r
205 * The maximum length (including zero termination) for the TRACE_DESCRIPTION
\r
206 * string. Since this string also is used for internal error messages from the
\r
207 * recorder do not make it too short, as this may truncate the error messages.
\r
209 * Maximum allowed length is 256 - the trace will fail to load if longer.
\r
210 *****************************************************************************/
\r
211 #define TRACE_DESCRIPTION_MAX_LENGTH 80
\r
214 /******************************************************************************
\r
215 * TRACE_DATA_ALLOCATION
\r
217 * This defines how to allocate the recorder data structure, i.e., using a
\r
218 * static declaration or using a dynamic allocation in runtime (malloc).
\r
220 * Should be one of these two options:
\r
221 * - TRACE_DATA_ALLOCATION_STATIC (default)
\r
222 * - TRACE_DATA_ALLOCATION_DYNAMIC
\r
224 * Using static allocation has the benefits of compile-time errors if the buffer
\r
225 * is too large (too large constants in trcConfig.h) and no need to call the
\r
226 * initialization routine (xTraceInitTraceData).
\r
228 * Using dynamic allocation may give more flexibility in some cases.
\r
229 *****************************************************************************/
\r
231 #define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
\r
234 /******************************************************************************
\r
235 * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE
\r
236 *****************************************************************************/
\r
238 /******************************************************************************
\r
241 * Macro which should be defined as either zero (0) or one (1).
\r
244 * If this is one (1), the TRACE_ASSERT macro will verify that a condition is
\r
245 * true. If the condition is false, vTraceError() will be called.
\r
246 *****************************************************************************/
\r
247 #define USE_TRACE_ASSERT 1
\r
249 /******************************************************************************
\r
250 * INCLUDE_FLOAT_SUPPORT
\r
252 * Macro which should be defined as either zero (0) or one (1).
\r
255 * If this is zero (0), all references to floating point values are removed,
\r
256 * in case floating point values are not supported by the platform used.
\r
257 * Floating point values are only used in vTracePrintF and its subroutines, to
\r
258 * store float (%f) or double (%lf) argments.
\r
260 * Note: vTracePrintF can still be used with integer and string arguments in
\r
262 *****************************************************************************/
\r
263 #define INCLUDE_FLOAT_SUPPORT 0
\r
265 /******************************************************************************
\r
266 * INCLUDE_USER_EVENTS
\r
268 * Macro which should be defined as either zero (0) or one (1).
\r
271 * If this is zero (0) the code for creating User Events is excluded to
\r
272 * reduce code size. User Events are application-generated events, like
\r
273 * "printf" but for the trace log instead of console output. User Events are
\r
274 * much faster than a printf and can therefore be used in timing critical code.
\r
275 * See vTraceUserEvent() and vTracePrintF() in trcUser.h
\r
277 * Note that User Events are not displayed in FreeRTOS+Trace Free Edition.
\r
278 *****************************************************************************/
\r
279 #define INCLUDE_USER_EVENTS 1
\r
281 /*****************************************************************************
\r
282 * INCLUDE_READY_EVENTS
\r
284 * Macro which should be defined as either zero (0) or one (1).
\r
287 * If this is zero (0), the code for recording Ready events is
\r
288 * excluded. Note, this will make it impossible to calculate the correct
\r
290 *****************************************************************************/
\r
291 #define INCLUDE_READY_EVENTS 1
\r
293 /*****************************************************************************
\r
294 * INCLUDE_NEW_TIME_EVENTS
\r
296 * Macro which should be defined as either zero (0) or one (1).
\r
299 * If this is zero (1), events will be generated whenever the os clock is
\r
301 *****************************************************************************/
\r
302 #define INCLUDE_NEW_TIME_EVENTS 0
\r
304 /*****************************************************************************
\r
305 * INCLUDE_ISR_TRACING
\r
307 * Macro which should be defined as either zero (0) or one (1).
\r
310 * If this is zero (0), the code for recording Interrupt Service Routines is
\r
311 * excluded to reduce code size.
\r
313 * Note, if the kernel has no central interrupt dispatcher, recording ISRs
\r
314 * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
\r
315 * in your interrupt handlers.
\r
316 *****************************************************************************/
\r
317 #define INCLUDE_ISR_TRACING 1
\r
319 /******************************************************************************
\r
320 * INCLUDE_OBJECT_DELETE
\r
322 * Macro which should be defined as either zero (0) or one (1).
\r
325 * This must be enabled (1) if tasks, queues or other
\r
326 * traced kernel objects are deleted at runtime. If no deletes are made, this
\r
327 * can be set to 0 in order to exclude the delete-handling code.
\r
328 *****************************************************************************/
\r
329 #define INCLUDE_OBJECT_DELETE 1
\r
331 /******************************************************************************
\r
332 * INCLUDE_MEMMANG_EVENTS
\r
334 * Macro which should be defined as either zero (0) or one (1).
\r
337 * This controls if malloc and free calls should be traced. Set this to zero to
\r
338 * exclude malloc/free calls from the tracing.
\r
339 *****************************************************************************/
\r
340 #define INCLUDE_MEMMANG_EVENTS 1
\r
342 /******************************************************************************
\r
343 * CONFIGURATION RELATED TO BEHAVIOR
\r
344 *****************************************************************************/
\r
346 /******************************************************************************
\r
347 * TRACE_RECORDER_STORE_MODE
\r
349 * Macro which should be defined as one of:
\r
350 * - TRACE_STORE_MODE_RING_BUFFER
\r
351 * - TRACE_STORE_MODE_STOP_WHEN_FULL
\r
352 * Default is TRACE_STORE_MODE_RING_BUFFER.
\r
354 * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are
\r
355 * stored in a ring buffer, i.e., where the oldest events are overwritten when
\r
356 * the buffer becomes full. This allows you to get the last events leading up
\r
357 * to an interesting state, e.g., an error, without having a large trace buffer
\r
358 * for string the whole run since startup. In this mode, the recorder can run
\r
359 * "forever" as the buffer never gets full, i.e., in the sense that it always
\r
360 * has room for more events.
\r
362 * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the
\r
363 * system using your debugger and then do a RAM dump, or to explicitly stop the
\r
364 * recorder using vTraceStop() and then store/upload the trace data using a
\r
365 * task that you need to provide yourself. The trace data is found in the struct
\r
366 * RecorderData, initialized in trcBase.c.
\r
368 * Note that, if you upload the trace using a RAM dump, i.e., when the system is
\r
369 * halted on a breakpoint or by a debugger command, there is no need to stop the
\r
372 * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is
\r
373 * stopped when the buffer becomes full. When the recorder stops itself this way
\r
374 * vTracePortEnd() is called which allows for custom actions, such as triggering
\r
375 * a task that stores the trace buffer, i.e., in case taking a RAM dump
\r
376 * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd
\r
377 * saves the trace to file directly, but this is not recommended in a real-time
\r
378 * system since the scheduler is blocked during the processing of vTracePortEnd.
\r
379 *****************************************************************************/
\r
381 #define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
\r
383 /******************************************************************************
\r
384 * STOP_AFTER_N_EVENTS
\r
386 * Macro which should be defined as an integer value, or not defined.
\r
389 * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when
\r
390 * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when
\r
391 * the specified number of events has been observed. This value can be larger
\r
392 * than the buffer size, to allow for test of the "wrapping around" that occurs
\r
393 * in ring buffer mode . A negative value (or no definition of this macro)
\r
394 * disables this feature.
\r
395 *****************************************************************************/
\r
396 #define STOP_AFTER_N_EVENTS -1
\r
398 /******************************************************************************
\r
399 * USE_IMPLICIT_IFE_RULES
\r
401 * Macro which should be defined as either zero (0) or one (1).
\r
404 * ### Instance Finish Events (IFE) ###
\r
406 * For tasks with "infinite" main loops (non-terminating tasks), the concept
\r
407 * of a task instance has no clear definition, it is an application-specific
\r
408 * thing. Tracealyzer allows you to define Instance Finish Events (IFEs),
\r
409 * which marks the point in a cyclic task when the "task instance" ends.
\r
410 * The IFE is a blocking kernel call, typically in the main loop of a task
\r
411 * which typically reads a message queue, waits for a semaphore or performs
\r
412 * an explicit delay.
\r
414 * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)
\r
415 * will define what kernel calls are considered by default to be IFEs.
\r
417 * However, Implicit IFEs only applies to blocking kernel calls. If a
\r
418 * service reads a message without blocking, it does not create a new
\r
419 * instance since no blocking occurred.
\r
421 * Moreover, the actual IFE might sometimes be another blocking call. We
\r
422 * therefore allow for user-defined Explicit IFEs by calling
\r
424 * vTraceTaskInstanceIsFinished()
\r
426 * right before the kernel call considered as IFE. This does not create an
\r
427 * additional event but instead stores the service code and object handle
\r
428 * of the IFE call as properties of the task.
\r
430 * If using Explicit IFEs and the task also calls an Implicit IFE, this may
\r
431 * result in additional incorrect task instances.
\r
432 * This is solved by disabling the Implicit IFEs for the task, by adding
\r
435 * vTraceTaskSkipDefaultInstanceFinishedEvents()
\r
437 * in the very beginning of that task. This allows you to combine Explicit IFEs
\r
438 * for some tasks with Implicit IFEs for the rest of the tasks, if
\r
439 * USE_IMPLICIT_IFE_RULES is 1.
\r
441 * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled
\r
442 * for all tasks. Tasks will then be considered to have a single instance only,
\r
443 * covering all execution fragments, unless you define an explicit IFE in each
\r
444 * task by calling vTraceTaskInstanceIsFinished before the blocking call.
\r
445 *****************************************************************************/
\r
446 #define USE_IMPLICIT_IFE_RULES 1
\r
449 /******************************************************************************
\r
450 * USE_16BIT_OBJECT_HANDLES
\r
452 * Macro which should be defined as either zero (0) or one (1).
\r
455 * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
\r
456 * objects such as tasks and queues. This limits the supported number of
\r
457 * concurrently active objects to 255 of each type (object class).
\r
459 * If set to 1 (one), the recorder uses 16-bit handles to identify kernel
\r
460 * objects such as tasks and queues. This limits the supported number of
\r
461 * concurrent objects to 65535 of each type (object class). However, since the
\r
462 * object property table is limited to 64 KB, the practical limit is about
\r
463 * 3000 objects in total.
\r
465 * NOTE: An object with a high ID (> 255) will generate an extra event
\r
466 * (= 4 byte) in the event buffer.
\r
468 * NOTE: Some internal tables in the recorder gets larger when using 16-bit
\r
469 * handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object
\r
470 *, i.e., task, queue, semaphore, mutex, etc.
\r
471 *****************************************************************************/
\r
472 #define USE_16BIT_OBJECT_HANDLES 0
\r
474 /****** Port Name ******************** Code ** Official ** OS Platform ******
\r
475 * PORT_APPLICATION_DEFINED -2 - -
\r
476 * PORT_NOT_SET -1 - -
\r
477 * PORT_HWIndependent 0 Yes Any
\r
478 * PORT_Win32 1 Yes FreeRTOS Win32
\r
479 * PORT_Atmel_AT91SAM7 2 No Any
\r
480 * PORT_Atmel_UC3A0 3 No Any
\r
481 * PORT_ARM_CortexM 4 Yes Any
\r
482 * PORT_Renesas_RX600 5 Yes Any
\r
483 * PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any
\r
484 * PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any
\r
485 * PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any
\r
486 * PORT_MICROCHIP_PIC32 9 No Any
\r
487 * PORT_XILINX_PPC405 10 No FreeRTOS
\r
488 * PORT_XILINX_PPC440 11 No FreeRTOS
\r
489 * PORT_XILINX_MICROBLAZE 12 No Any
\r
490 * PORT_NXP_LPC210X 13 No Any
\r
491 *****************************************************************************/
\r
492 #define SELECTED_PORT PORT_Win32
\r
494 #if (SELECTED_PORT == PORT_NOT_SET)
\r
495 #error "You need to define SELECTED_PORT here!"
\r
498 /******************************************************************************
\r
499 * USE_PRIMASK_CS (for Cortex M devices only)
\r
501 * An integer constant that selects between two options for the critical
\r
502 * sections of the recorder library.
\r
504 * 0: The default FreeRTOS critical section (BASEPRI) - default setting
\r
505 * 1: Always disable ALL interrupts (using PRIMASK)
\r
507 * Option 0 uses the standard FreeRTOS macros for critical sections.
\r
508 * However, on Cortex-M devices they only disable interrupts with priorities
\r
509 * below a certain configurable level, while higher priority ISRs remain active.
\r
510 * Such high-priority ISRs may not use the recorder functions in this mode.
\r
512 * Option 1 allows you to safely call the recorder from any ISR, independent of
\r
513 * the interrupt priority. This mode may however cause higher IRQ latencies
\r
514 * (some microseconds) since ALL configurable interrupts are disabled during
\r
515 * the recorder's critical sections in this mode, using the PRIMASK register.
\r
516 ******************************************************************************/
\r
517 #define USE_PRIMASK_CS 0
\r
519 /******************************************************************************
\r
520 * HEAP_SIZE_BELOW_16M
\r
522 * An integer constant that can be used to reduce the buffer usage of memory
\r
523 * allocation events (malloc/free). This value should be 1 if the heap size is
\r
524 * below 16 MB (2^24 byte), and you can live with addresses truncated to the
\r
525 * lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses.
\r
526 ******************************************************************************/
\r
527 #define HEAP_SIZE_BELOW_16M 0
\r