]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h
Update to latest FreeRTOS+Trace recorder code.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-Trace / ConfigurationTemplate / trcConfig.h
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/ConfigurationTemplate/trcConfig.h
new file mode 100644 (file)
index 0000000..f016dbc
--- /dev/null
@@ -0,0 +1,508 @@
+/*******************************************************************************\r
+ * Tracealyzer v2.4.1 Recorder Library\r
+ * Percepio AB, www.percepio.com\r
+ *\r
+ * trcConfig.h\r
+ *\r
+ * Configuration parameters for the trace recorder library. Before using the \r
+ * trace recorder library, please check that the default settings are \r
+ * appropriate for your system, and if necessary adjust these. Most likely, you \r
+ * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to \r
+ * reflect the number of such objects in your system. These may be \r
+ * over-approximated, although larger values values implies more RAM usage.\r
+ *\r
+ * Terms of Use\r
+ * This software is copyright Percepio AB. The recorder library is free for\r
+ * use together with Percepio products. You may distribute the recorder library\r
+ * in its original form, including modifications in trcHardwarePort.c/.h\r
+ * given that these modification are clearly marked as your own modifications\r
+ * and documented in the initial comment section of these source files. \r
+ * This software is the intellectual property of Percepio AB and may not be \r
+ * sold or in other ways commercially redistributed without explicit written \r
+ * permission by Percepio AB.\r
+ *\r
+ * Disclaimer \r
+ * The trace tool and recorder library is being delivered to you AS IS and \r
+ * Percepio AB makes no warranty as to its use or performance. Percepio AB does \r
+ * not and cannot warrant the performance or results you may obtain by using the \r
+ * software or documentation. Percepio AB make no warranties, express or \r
+ * implied, as to noninfringement of third party rights, merchantability, or \r
+ * fitness for any particular purpose. In no event will Percepio AB, its \r
+ * technology partners, or distributors be liable to you for any consequential, \r
+ * incidental or special damages, including any lost profits or lost savings, \r
+ * even if a representative of Percepio AB has been advised of the possibility \r
+ * of such damages, or for any claim by any third party. Some jurisdictions do \r
+ * not allow the exclusion or limitation of incidental, consequential or special \r
+ * damages, or the exclusion of implied warranties or limitations on how long an \r
+ * implied warranty may last, so the above limitations may not apply to you.\r
+ *\r
+ * Copyright Percepio AB, 2013.\r
+ * www.percepio.com\r
+ ******************************************************************************/\r
+\r
+#ifndef TRCCONFIG_H\r
+#define TRCCONFIG_H\r
+\r
+/*******************************************************************************\r
+ * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION \r
+ ******************************************************************************/\r
+\r
+/*******************************************************************************\r
+ * EVENT_BUFFER_SIZE\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the event buffer, i.e., the number of records\r
+ * it may store. Each registered event typically use one record (4 byte), but\r
+ * vTracePrintF may use multiple records depending on the number of data args.\r
+ ******************************************************************************/\r
+\r
+#define EVENT_BUFFER_SIZE 4000 /* Adjust wrt. to available RAM */\r
+\r
+\r
+/*******************************************************************************\r
+ * USE_LINKER_PRAGMA\r
+ *\r
+ * Macro which should be defined as an integer value, default is 0.\r
+ *\r
+ * If this is 1, the header file "recorderdata_linker_pragma.h" is included just\r
+ * before the declaration of RecorderData (in trcBase.c), i.e., the trace data \r
+ * structure. This allows the user to specify a pragma with linker options. \r
+ *\r
+ * Example (for IAR Embedded Workbench and NXP LPC17xx):\r
+ * #pragma location="AHB_RAM_MEMORY"\r
+ * \r
+ * This example instructs the IAR linker to place RecorderData in another RAM \r
+ * bank, the AHB RAM. This can also be used for other compilers with a similar\r
+ * pragmas for linker options.\r
+ * \r
+ * Note that this only applies if using static allocation, see below.\r
+ ******************************************************************************/\r
+\r
+#define USE_LINKER_PRAGMA 0\r
+\r
+\r
+/*******************************************************************************\r
+ * SYMBOL_TABLE_SIZE\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the symbol table, in bytes. This symbol table \r
+ * stores User Events labels and names of deleted tasks, queues, or other kernel\r
+ * objects. Note that the names of active objects not stored here but in the \r
+ * Object Table. Thus, if you don't use User Events or delete any kernel \r
+ * objects you set this to zero (0) to minimize RAM usage.\r
+ ******************************************************************************/\r
+#define SYMBOL_TABLE_SIZE 1000\r
+\r
+/*******************************************************************************\r
+ * USE_SEPARATE_USER_EVENT_BUFFER\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ * Default is zero (0).\r
+ *\r
+ * This enables and disables the use of the separate user event buffer.\r
+ *\r
+ * Note: When using the separate user event buffer, you may get an artificial\r
+ * task instance named "Unknown actor". This is added as a placeholder when the \r
+ * user event history is longer than the task scheduling history.\r
+ ******************************************************************************/\r
+#define USE_SEPARATE_USER_EVENT_BUFFER 0\r
+\r
+/*******************************************************************************\r
+ * USER_EVENT_BUFFER_SIZE\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the capacity of the user event buffer, in number of slots.\r
+ * A single user event can use between 1 and X slots, depending on the data.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define USER_EVENT_BUFFER_SIZE 500\r
+\r
+/*******************************************************************************\r
+ * USER_EVENT_CHANNELS\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the number of allowed user event channels.\r
+ *\r
+ * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.\r
+ ******************************************************************************/\r
+#define CHANNEL_FORMAT_PAIRS 32\r
+\r
+/*******************************************************************************\r
+ * NTask, NISR, NQueue, NSemaphore, NMutex\r
+ *\r
+ * A group of Macros which should be defined as an integer value of zero (0) \r
+ * or larger.\r
+ *\r
+ * This defines the capacity of the Object Property Table - the maximum number\r
+ * of objects active at any given point within each object class.\r
+ * \r
+ * NOTE: In case objects are deleted and created during runtime, this setting\r
+ * does not limit the total amount of objects, only the number of concurrently\r
+ * active objects. \r
+ *\r
+ * Using too small values will give an error message through the vTraceError\r
+ * routine, which makes the error message appear when opening the trace data\r
+ * in Tracealyzer. If you are using the recorder status monitor task,\r
+ * any error messages are displayed in console prints, assuming that the\r
+ * print macro has been defined properly (vConsolePrintMessage). \r
+ *\r
+ * It can be wise to start with very large values for these constants, \r
+ * unless you are very confident on these numbers. Then do a recording and\r
+ * check the actual usage in Tracealyzer. This is shown by selecting\r
+ * View -> Trace Details -> Resource Usage -> Object Table\r
+ * \r
+ * NOTE 2: Remember to account for all tasks created by the kernel, such as the \r
+ * IDLE task, timer task, and any tasks created by other 3rd party \r
+ * software components, such as communication stacks. The recorder also has an \r
+ * optional monitor task to account for, if this is used.\r
+ * Moreover, one task slot is used to indicate "(startup)", i.e., a fictive \r
+ * task that represent the time before the scheduler starts. \r
+ * NTask should thus be at least 2-3 slots larger than your application task count.\r
+ *\r
+ ******************************************************************************/\r
+#define NTask             15\r
+#define NISR              5\r
+#define NQueue            5\r
+#define NSemaphore        5\r
+#define NMutex            5\r
+\r
+/* Maximum object name length for each class (includes zero termination) */\r
+#define NameLenTask       15\r
+#define NameLenISR        15\r
+#define NameLenQueue      15\r
+#define NameLenSemaphore  15\r
+#define NameLenMutex      15\r
+\r
+/******************************************************************************\r
+ * TRACE_DESCRIPTION\r
+ *\r
+ * Macro which should be defined as a string.\r
+ *\r
+ * This string is stored in the trace and displayed in Tracealyzer. Can be\r
+ * used to store, e.g., system version or build date. This is also used to store\r
+ * internal error messages from the recorder, which if occurs overwrites the\r
+ * value defined here. This may be maximum 256 chars.\r
+ *****************************************************************************/\r
+#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"\r
+\r
+/******************************************************************************\r
+ * TRACE_DESCRIPTION_MAX_LENGTH\r
+ *\r
+ * The maximum length (including zero termination) for the TRACE_DESCRIPTION\r
+ * string. Since this string also is used for internal error messages from the \r
+ * recorder do not make it too short, as this may truncate the error messages.\r
+ * Default is 80. \r
+ * Maximum allowed length is 256 - the trace will fail to load if longer.\r
+ *****************************************************************************/\r
+#define TRACE_DESCRIPTION_MAX_LENGTH 80\r
+\r
+\r
+/******************************************************************************\r
+ * TRACE_DATA_ALLOCATION\r
+ *\r
+ * This defines how to allocate the recorder data structure, i.e., using a \r
+ * static declaration or using a dynamic allocation in runtime (malloc).\r
+ *\r
+ * Should be one of these two options:\r
+ * - TRACE_DATA_ALLOCATION_STATIC (default)\r
+ * - TRACE_DATA_ALLOCATION_DYNAMIC\r
+ *\r
+ * Using static allocation has the benefits of compile-time errors if the buffer \r
+ * is too large (too large constants in trcConfig.h) and no need to call the \r
+ * initialization routine (xTraceInitTraceData).\r
+ *\r
+ * Using dynamic allocation may give more flexibility in some cases.\r
+ *****************************************************************************/\r
+\r
+#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
+\r
+\r
+/******************************************************************************\r
+ * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE\r
+ *****************************************************************************/\r
+\r
+/******************************************************************************\r
+ * USE_TRACE_ASSERT\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 0.\r
+ *\r
+ * If this is one (1), the TRACE_ASSERT macro will verify that a condition is \r
+ * true. If the condition is false, vTraceError() will be called.\r
+ *****************************************************************************/\r
+#define USE_TRACE_ASSERT 0\r
+\r
+/******************************************************************************\r
+ * INCLUDE_FLOAT_SUPPORT\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
+ *\r
+ * If this is zero (0), all references to floating point values are removed,\r
+ * in case floating point values are not supported by the platform used.\r
+ * Floating point values are only used in vTracePrintF and its subroutines, to \r
+ * store float (%f) or double (%lf) argments. \r
+ *\r
+ * Note: vTracePrintF can still be used with integer and string arguments in\r
+ * either case.\r
+ *****************************************************************************/\r
+#define INCLUDE_FLOAT_SUPPORT 1\r
+\r
+/******************************************************************************\r
+ * INCLUDE_USER_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
+ *\r
+ * If this is zero (0) the code for creating User Events is excluded to\r
+ * reduce code size. User Events are application-generated events, like \r
+ * "printf" but for the trace log instead of console output. User Events are \r
+ * much faster than a printf and can therefore be used in timing critical code.\r
+ * See vTraceUserEvent() and vTracePrintF() in trcUser.h\r
+ * \r
+ * Note that Tracealyzer Standard Edition or Professional Edition is required\r
+ * for User Events, they are not displayed in Tracealyzer Free Edition.\r
+ *****************************************************************************/\r
+#define INCLUDE_USER_EVENTS 1\r
+\r
+/*****************************************************************************\r
+ * INCLUDE_READY_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
+ *\r
+ * If this is zero (0), the code for recording Ready events is \r
+ * excluded. Note, this will make it impossible to calculate the correct\r
+ * response times.\r
+ *****************************************************************************/\r
+#define INCLUDE_READY_EVENTS 1\r
+\r
+/*****************************************************************************\r
+ * INCLUDE_NEW_TIME_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 0.\r
+ *\r
+ * If this is zero (1), events will be generated whenever the os clock is\r
+ * increased.\r
+ *****************************************************************************/\r
+#define INCLUDE_NEW_TIME_EVENTS 0\r
+\r
+/*****************************************************************************\r
+ * INCLUDE_ISR_TRACING\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
+ *\r
+ * If this is zero (0), the code for recording Interrupt Service Routines is \r
+ * excluded to reduce code size.\r
+ * \r
+ * Note, if the kernel has no central interrupt dispatcher, recording ISRs \r
+ * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd \r
+ * in your interrupt handlers.\r
+ *****************************************************************************/\r
+#define INCLUDE_ISR_TRACING 1\r
+\r
+/******************************************************************************\r
+ * INCLUDE_OBJECT_DELETE\r
+ * \r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
+ *\r
+ * This must be enabled (1) if tasks, queues or other \r
+ * traced kernel objects are deleted at runtime. If no deletes are made, this \r
+ * can be set to 0 in order to exclude the delete-handling code.\r
+ *****************************************************************************/\r
+#define INCLUDE_OBJECT_DELETE 1\r
+\r
+/******************************************************************************\r
+ * CONFIGURATION RELATED TO BEHAVIOR\r
+ *****************************************************************************/\r
+\r
+/******************************************************************************\r
+ * TRACE_RECORDER_STORE_MODE\r
+ *\r
+ * Macro which should be defined as one of:\r
+ * - TRACE_STORE_MODE_RING_BUFFER\r
+ * - TRACE_STORE_MODE_STOP_WHEN_FULL\r
+ * Default is TRACE_STORE_MODE_RING_BUFFER.\r
+ *\r
+ * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are \r
+ * stored in a ring buffer, i.e., where the oldest events are overwritten when \r
+ * the buffer becomes full. This allows you to get the last events leading up \r
+ * to an interesting state, e.g., an error, without having a large trace buffer\r
+ * for string the whole run since startup. In this mode, the recorder can run\r
+ * "forever" as the buffer never gets full, i.e., in the sense that it always\r
+ * has room for more events.\r
+ *\r
+ * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the\r
+ * system using your debugger and then do a RAM dump, or to explicitly stop the\r
+ * recorder using vTraceStop() and then store/upload the trace data using a\r
+ * task that you need to provide yourself. The trace data is found in the struct\r
+ * RecorderData, initialized in trcBase.c.\r
+ *\r
+ * Note that, if you upload the trace using a RAM dump, i.e., when the system is \r
+ * halted on a breakpoint or by a debugger command, there is no need to stop the \r
+ * recorder first.\r
+ *\r
+ * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is\r
+ * stopped when the buffer becomes full. When the recorder stops itself this way\r
+ * vTracePortEnd() is called which allows for custom actions, such as triggering\r
+ * a task that stores the trace buffer, i.e., in case taking a RAM dump\r
+ * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd\r
+ * saves the trace to file directly, but this is not recommended in a real-time\r
+ * system since the scheduler is blocked during the processing of vTracePortEnd.\r
+ *****************************************************************************/\r
+\r
+#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
+\r
+/******************************************************************************\r
+ * STOP_AFTER_N_EVENTS\r
+ *\r
+ * Macro which should be defined as an integer value, or not defined.\r
+ * Default is -1\r
+ *\r
+ * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when\r
+ * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when\r
+ * the specified number of events has been observed. This value can be larger\r
+ * than the buffer size, to allow for test of the "wrapping around" that occurs\r
+ * in ring buffer mode . A negative value (or no definition of this macro)\r
+ * disables this feature.\r
+ *****************************************************************************/\r
+#define STOP_AFTER_N_EVENTS -1\r
+\r
+/******************************************************************************\r
+ * USE_IMPLICIT_IFE_RULES\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1). \r
+ * Default is 1.\r
+ *\r
+ * ### Instance Finish Events (IFE) ###\r
+ *\r
+ * For tasks with "infinite" main loops (non-terminating tasks), the concept\r
+ * of a task instance has no clear definition, it is an application-specific\r
+ * thing. Tracealyzer allows you to define Instance Finish Events (IFEs),\r
+ * which marks the point in a cyclic task when the "task instance" ends.\r
+ * The IFE is a blocking kernel call, typically in the main loop of a task\r
+ * which typically reads a message queue, waits for a semaphore or performs\r
+ * an explicit delay.\r
+ *\r
+ * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)\r
+ * will define what kernel calls are considered by default to be IFEs.\r
+ *\r
+ * However, Implicit IFEs only applies to blocking kernel calls. If a\r
+ * service reads a message without blocking, it does not create a new\r
+ * instance since no blocking occurred.\r
+ *\r
+ * Moreover, the actual IFE might sometimes be another blocking call. We \r
+ * therefore allow for user-defined Explicit IFEs by calling\r
+ *\r
+ *     vTraceTaskInstanceIsFinished()\r
+ *\r
+ * right before the kernel call considered as IFE. This does not create an\r
+ * additional event but instead stores the service code and object handle\r
+ * of the IFE call as properties of the task.\r
+ *\r
+ * If using Explicit IFEs and the task also calls an Implicit IFE, this may \r
+ * result in additional incorrect task instances.\r
+ * This is solved by disabling the Implicit IFEs for the task, by adding\r
+ * a call to\r
+ * \r
+ *     vTraceTaskSkipDefaultInstanceFinishedEvents()\r
+ * \r
+ * in the very beginning of that task. This allows you to combine Explicit IFEs\r
+ * for some tasks with Implicit IFEs for the rest of the tasks, if\r
+ * USE_IMPLICIT_IFE_RULES is 1.\r
+ *\r
+ * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled\r
+ * for all tasks. Tasks will then be considered to have a single instance only, \r
+ * covering all execution fragments, unless you define an explicit IFE in each\r
+ * task by calling vTraceTaskInstanceIsFinished before the blocking call.\r
+ *****************************************************************************/\r
+#define USE_IMPLICIT_IFE_RULES 1\r
+\r
+/******************************************************************************\r
+ * INCLUDE_SAVE_TO_FILE\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ * Default is 0.\r
+ *\r
+ * If enabled (1), the recorder will include code for saving the trace\r
+ * to a local file system.\r
+ ******************************************************************************/\r
+#ifdef WIN32\r
+    #define INCLUDE_SAVE_TO_FILE 1\r
+#else\r
+    #define INCLUDE_SAVE_TO_FILE 0\r
+#endif\r
+\r
+/******************************************************************************\r
+ * TRACE_PROGRESS_MONITOR_TASK_PRIORITY\r
+ *\r
+ * Macro which sets the priority of the "recorder status monitor" task.\r
+ *\r
+ * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
+ * the recorder status using the vTraceConsoleMessage macro, which is to\r
+ * be mapped to your console "printf" routine. The task is named TraceMon but \r
+ * is intentionally excluded from the demo trace.\r
+ *\r
+ * Default is tskIDLE_PRIORITY + 1\r
+ * Note that if your system constantly has a high CPU load from high-priority \r
+ * tasks, this might not be get a chance to execute.\r
+ * \r
+ * See vTraceMonitorTask in trcUser.c\r
+ *****************************************************************************/\r
+#define TRACE_PROGRESS_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)\r
+\r
+/******************************************************************************\r
+ * TRACE_PROGRESS_MONITOR_TASK_STACKSIZE\r
+ *\r
+ * Macro which sets the stack size of the "recorder status monitor" task.\r
+ *\r
+ * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
+ * the recorder status using the vTraceConsoleMessage macro, which is to\r
+ * be mapped to your console "printf" routine. The task is intentionally \r
+ * excluded from the demo trace.\r
+ *\r
+ * See vTraceMonitorTask in trcUser.c\r
+ *****************************************************************************/\r
+#define TRACE_PROGRESS_MONITOR_TASK_STACKSIZE 500\r
+\r
+/******************************************************************************\r
+ * TRACE_PROGRESS_MONITOR_TASK_PERIOD\r
+ *\r
+ * Macro which sets the period of the "recorder status monitor" task.\r
+ *\r
+ * This task, vTraceMonitorTask in trcUser.c, periodically writes\r
+ * the recorder status using the vTraceConsoleMessage macro, which is to\r
+ * be mapped to your console "printf" routine. The task is named TraceMon but \r
+ * is intentionally excluded from the demo trace.\r
+ *\r
+ * Default is 1000 ticks (typically 1 second). On the Windows port, a lower \r
+ * value is suggested since the Windows port runs very slowly, often 20-40\r
+ * times slower than the simulated time.\r
+ *\r
+ * See vTraceMonitorTask in trcUser.c\r
+ *****************************************************************************/\r
+#ifdef WIN32\r
+    #define TRACE_PROGRESS_MONITOR_TASK_PERIOD 100\r
+#else\r
+    #define TRACE_PROGRESS_MONITOR_TASK_PERIOD 1000\r
+#endif\r
+\r
+/******************************************************************************\r
+ * TEAM_LICENSE_CODE\r
+ *\r
+ * Macro which defines a string - the team license code.\r
+ * If no team license is available, this should be an empty string "".\r
+ * This should be maximum 32 chars, including zero-termination.\r
+ *****************************************************************************/\r
+#define TEAM_LICENSE_CODE ""\r
+\r
+#endif\r
+\r