/*******************************************************************************\r
- * FreeRTOS+Trace v2.2.2 Recorder Library\r
- * Percepio AB, www.percepio.se\r
+ * Tracealyzer v2.6.0 Recorder Library\r
+ * Percepio AB, www.percepio.com\r
*\r
* trcConfig.h\r
*\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
- * overapproximated, although larger values values implies more RAM usage.\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 trcPort.c and trcPort.h\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
* 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
- * FreeRTOS+Trace is available as Free Edition and in two premium editions.\r
- * You may use the premium features during 30 days for evaluation.\r
- * Download FreeRTOS+Trace at http://www.percepio.se/index.php?page=downloads\r
- *\r
- * Copyright Percepio AB, 2012.\r
- * www.percepio.se\r
+ * Copyright Percepio AB, 2013.\r
+ * www.percepio.com\r
******************************************************************************/\r
\r
#ifndef TRCCONFIG_H\r
* vTracePrintF may use multiple records depending on the number of data args.\r
******************************************************************************/\r
\r
-#if WIN32\r
- #define EVENT_BUFFER_SIZE 3000\r
-#else\r
- #define EVENT_BUFFER_SIZE 1000 /* Adjust wrt. to available RAM */\r
-#endif\r
+#define EVENT_BUFFER_SIZE 10000 /* 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
* 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
+ * objects you set this to a very low value, e.g. 4, but not zero (0) since \r
+ * this causes a declaration of a zero-sized array, for which the C compiler\r
+ * behavior is not standardized and may cause misaligned data.\r
******************************************************************************/\r
-#define SYMBOL_TABLE_SIZE 1000\r
+#define SYMBOL_TABLE_SIZE 5000\r
+\r
+#if (SYMBOL_TABLE_SIZE == 0)\r
+#error "SYMBOL_TABLE_SIZE may not be zero!"\r
+#endif\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
* 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 FreeRTOS+Trace. If you are using the recorder status monitor task,\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
+ * 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: If you include the monitor task (USE_TRACE_PROGRESS_MONITOR_TASK)\r
- * make sure to dimension NTask with this task accounted for.\r
- *\r
- * Also remember to account for all tasks created by FreeRTOS, such as the \r
- * IDLE task, the FreeRTOS timer task, and any tasks created by other 3rd party \r
- * software components, such as communication stacks.\r
- * Moreover, one task slot is used to indicate "(startup)", i.e., a "task" that \r
- * represent the time before the first task starts. NTask should thus be at \r
- * least 2-3 slots larger than your application task count.\r
- *\r
- * NOTE 3: The FreeRTOS timer task creates a Queue, that should be accounted \r
- * for in NQueue.\r
+ * NOTE 2: Remember to account for all tasks and other objects created by \r
+ * the kernel, such as the IDLE task, any timer tasks, and any tasks created \r
+ * by other 3rd party software components, such as communication stacks.\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 ( 200 )\r
-#define NISR ( 200 )\r
-#define NQueue ( 200 )\r
-#define NSemaphore ( 200 )\r
-#define NMutex ( 200 )\r
+#define NTask 100\r
+#define NISR 20\r
+#define NQueue 60\r
+#define NSemaphore 60\r
+#define NMutex 60\r
+#define NTimer 200\r
+#define NEventGroup 60\r
\r
/* Maximum object name length for each class (includes zero termination) */\r
-#define NameLenTask configMAX_TASK_NAME_LEN\r
-#define NameLenISR 10\r
+#define NameLenTask 15\r
+#define NameLenISR 15\r
#define NameLenQueue 15\r
#define NameLenSemaphore 15\r
#define NameLenMutex 15\r
+#define NameLenTimer 15\r
+#define NameLenEventGroup 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 FreeRTOS+Trace. Can be\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 "FreeRTOS+Trace Demo"\r
+#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"\r
\r
/******************************************************************************\r
* TRACE_DESCRIPTION_MAX_LENGTH\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 1\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 0\r
+\r
/******************************************************************************\r
* INCLUDE_USER_EVENTS\r
*\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 FreeRTOS+Trace Standard Edition or Professional Edition is required\r
- * for User Events, they are not displayed in FreeRTOS+Trace Free Edition.\r
+ * Note that User Events are not displayed in FreeRTOS+Trace 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
* Default is 1.\r
*\r
* If this is zero (0), the code for recording Interrupt Service Routines is \r
- * excluded to reduce code size. Note, recording ISRs require that you insert\r
- * calls to vTraceStoreISRBegin and vTraceStoreISREnd in your interrupt handlers.\r
- * There is no automatic recording of ISRs like for task scheduling, since \r
- * FreeRTOS does not have a central interrupt dispatcher.\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
* Default is 1.\r
*\r
* This must be enabled (1) if tasks, queues or other \r
- * traced kernel objects are deleted at runtime, e.g., using vTaskDelete or \r
- * vQueueDelete. If no deletes are made, this can be set to 0 in order to\r
- * exclude the delete-handling code. \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
\r
/******************************************************************************\r
- * RECORDER_STORE_MODE\r
+ * TRACE_RECORDER_STORE_MODE\r
*\r
* Macro which should be defined as one of:\r
- * - STORE_MODE_RING_BUFFER\r
- * - STORE_MODE_STOP_WHEN_FULL\r
- * Default is STORE_MODE_RING_BUFFER.\r
- *\r
- * With RECORDER_STORE_MODE set to STORE_MODE_RING_BUFFER, the events are stored\r
- * in a ring buffer, i.e., where the oldest events are overwritten when the\r
- * buffer becomes full. This allows you to get the last events leading up to an\r
- * interesting state, e.g., an error, without having a large trace buffer for\r
- * string the whole run since startup. In this mode, the recorder can run\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 STORE_MODE_RING_BUFFER, you need to first halt the\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
- * FreeRTOS task that you need to provide yourself. The trace data is found in\r
- * the struct RecorderData, initialized in trcBase.c.\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 RECORDER_STORE_MODE is STORE_MODE_STOP_WHEN_FULL, the recording is\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
* 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
-#define RECORDER_STORE_MODE STORE_MODE_RING_BUFFER\r
-/*#define RECORDER_STORE_MODE STORE_MODE_STOP_WHEN_FULL*/\r
+\r
+#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
\r
/******************************************************************************\r
* STOP_AFTER_N_EVENTS\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. FreeRTOS+Trace allows you to define Instance Finish Events (IFEs),\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 following FreeRTOS kernel calls\r
- * are considered by default to be IFEs (Implicit IFEs):\r
- * - vTaskDelay\r
- * - vTaskDelayUntil\r
- * - vTaskSuspend\r
- * - xQueueReceive (blocking cases only)\r
- * - xSemaphoreTake (blocking cases only)\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 an\r
- * xQueueReceive reads a message without blocking, it does not create a new\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 such as\r
- * xQueueSend or xSemaphoreGive. We therefore allow for user-defined\r
- * Explicit IFEs by calling\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
* 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 like\r
- * vTaskDelay, this may result in additional incorrect task instances.\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
* \r
* See vTraceMonitorTask in trcUser.c\r
*****************************************************************************/\r
-#define TRACE_PROGRESS_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 3)\r
+#define TRACE_PROGRESS_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)\r
\r
/******************************************************************************\r
* TRACE_PROGRESS_MONITOR_TASK_STACKSIZE\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 FreeRTOS ticks (typically 1 second). On the Windows port, a \r
- * lower value is suggested since the Windows port runs very slowly, often 20-40\r
- * times slower than the simulated FreeRTOS time.\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
-#if WIN32\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
/******************************************************************************\r
- * TEAM_LICENSE_CODE\r
+ * USE_16BIT_OBJECT_HANDLES\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ * Default is 0.\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
+ * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel \r
+ * objects such as tasks and queues. This limits the supported number of\r
+ * concurrently active objects to 255 of each type (object class).\r
+ *\r
+ * If set to 1 (one), the recorder uses 16-bit handles to identify kernel \r
+ * objects such as tasks and queues. This limits the supported number of\r
+ * concurrent objects to 65535 of each type (object class). However, since the\r
+ * object property table is limited to 64 KB, the practical limit is about\r
+ * 3000 objects in total. \r
+ * \r
+ * NOTE: An object with a high ID (> 255) will generate an extra event \r
+ * (= 4 byte) in the event buffer. \r
+ * \r
+ * NOTE: Some internal tables in the recorder gets larger when using 16-bit \r
+ * handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object\r
+ *, i.e., task, queue, semaphore, mutex, etc.\r
*****************************************************************************/\r
-#define TEAM_LICENSE_CODE ""\r
+#define USE_16BIT_OBJECT_HANDLES 0\r
+\r
+/****** Port Name ******************** Code ** Official ** OS Platform ******\r
+* PORT_APPLICATION_DEFINED -2 - - \r
+* PORT_NOT_SET -1 - - \r
+* PORT_HWIndependent 0 Yes Any \r
+* PORT_Win32 1 Yes FreeRTOS Win32\r
+* PORT_Atmel_AT91SAM7 2 No Any \r
+* PORT_Atmel_UC3A0 3 No Any \r
+* PORT_ARM_CortexM 4 Yes Any \r
+* PORT_Renesas_RX600 5 Yes Any \r
+* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any \r
+* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any \r
+* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any \r
+* PORT_MICROCHIP_PIC32 9 No Any \r
+* PORT_XILINX_PPC405 10 No FreeRTOS \r
+* PORT_XILINX_PPC440 11 No FreeRTOS \r
+* PORT_XILINX_MICROBLAZE 12 No Any \r
+* PORT_NXP_LPC210X 13 No Any \r
+*****************************************************************************/\r
+#define SELECTED_PORT PORT_Win32\r
+\r
+#if (SELECTED_PORT == PORT_NOT_SET)\r
+#error "You need to define SELECTED_PORT here!"\r
+#endif\r
+\r
+/******************************************************************************\r
+* USE_PRIMASK_CS (for Cortex M devices only)\r
+*\r
+* An integer constant that selects between two options for the critical\r
+* sections of the recorder library.\r
+ *\r
+* 0: The default FreeRTOS critical section (BASEPRI) - default setting\r
+* 1: Always disable ALL interrupts (using PRIMASK)\r
+ *\r
+* Option 0 uses the standard FreeRTOS macros for critical sections.\r
+* However, on Cortex-M devices they only disable interrupts with priorities \r
+* below a certain configurable level, while higher priority ISRs remain active.\r
+* Such high-priority ISRs may not use the recorder functions in this mode.\r
+*\r
+* Option 1 allows you to safely call the recorder from any ISR, independent of \r
+* the interrupt priority. This mode may however cause higher IRQ latencies\r
+* (some microseconds) since ALL configurable interrupts are disabled during \r
+* the recorder's critical sections in this mode, using the PRIMASK register.\r
+ ******************************************************************************/\r
+#define USE_PRIMASK_CS 0\r
+\r
\r
#endif\r
\r