/* FreeRTOS+CLI includes. */\r
#include "FreeRTOS_CLI.h"\r
\r
-/* FreeRTOS+Trace includes. */\r
-#include "trcUser.h"\r
-\r
/*\r
* Writes trace data to a disk file when the trace recording is stopped.\r
* This function will simply overwrite any trace files that already exist.\r
\r
#define configUSE_PREEMPTION 1\r
#define configUSE_IDLE_HOOK 1\r
-#define configUSE_TICK_HOOK 1\r
+#define configUSE_TICK_HOOK 0\r
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */\r
#define configTOTAL_HEAP_SIZE ( ( size_t ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */\r
\r
/* This demo makes use of one or more example stats formatting functions. These\r
format the raw data provided by the uxTaskGetSystemState() function in to human\r
-readable ASCII form. See the notes in the implementation of vTaskList() within \r
+readable ASCII form. See the notes in the implementation of vTaskList() within\r
FreeRTOS/Source/tasks.c for limitations. */\r
#define configUSE_STATS_FORMATTING_FUNCTIONS 1\r
\r
\r
\r
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */\r
-#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()\r
-#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()\r
-#include "trcKernelPort.h"\r
+#include "trcRecorder.h"\r
\r
#endif /* FREERTOS_CONFIG_H */\r
\r
-Microsoft Visual Studio Solution File, Format Version 11.00\r
-# Visual C++ Express 2010\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WIN32", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 14\r
+VisualStudioVersion = 14.0.25420.1\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"\r
EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
/* FreeRTOS includes. */\r
#include <FreeRTOS.h>\r
\r
-/* FreeRTOS+Trace includes. */\r
-#include "trcUser.h"\r
-\r
/* Variables used in the creation of the run time stats time base. Run time\r
stats record how much time each task spends in the Running state. */\r
static long long llInitialRunTimeCounterValue = 0LL, llTicksPerHundedthMillisecond = 0LL;\r
-/*******************************************************************************\r
- * Tracealyzer v2.7.0 Recorder Library\r
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v3.1.2\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
+ * Main configuration parameters for the trace recorder library.\r
+ * More settings can be found in trcStreamingConfig.h and trcSnapshotConfig.h.\r
+ *\r
+ * Read more at http://percepio.com/2016/10/05/rtos-tracing/\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
+ * This file is part of the trace recorder library (RECORDER), which is the\r
+ * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
+ * license as follows.\r
+ * The RECORDER may be used free of charge for the purpose of recording data\r
+ * intended for analysis in PERCEPIO products. It may not be used or modified\r
+ * for other purposes without explicit permission from PERCEPIO.\r
+ * You may distribute the RECORDER in its original source code form, assuming\r
+ * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
+ * allowed to distribute the RECORDER with minor modifications intended for\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a\r
+ * specific processor, processor family or with a specific communication\r
+ * interface. Any such modifications should be documented directly below\r
+ * this comment block.\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
+ * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the\r
+ * performance or results you may obtain by using the RECORDER or documentation.\r
+ * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
+ * third party rights, merchantability, or fitness for any particular purpose.\r
+ * In no event will PERCEPIO, its technology partners, or distributors be liable\r
+ * to you for any consequential, incidental or special damages, including any\r
+ * lost profits or lost savings, even if a representative of PERCEPIO has been\r
+ * advised of the possibility of such damages, or for any claim by any third\r
+ * party. Some jurisdictions do not allow the exclusion or limitation of\r
+ * incidental, consequential or special damages, or the exclusion of implied\r
+ * warranties or limitations on how long an implied warranty may last, so the\r
+ * above limitations may not apply to you.\r
*\r
* Tabs are used for indent in this file (1 tab = 4 spaces)\r
*\r
- * Copyright Percepio AB, 2014.\r
+ * Copyright Percepio AB, 2016.\r
* www.percepio.com\r
******************************************************************************/\r
\r
-#ifndef TRCCONFIG_H\r
-#define TRCCONFIG_H\r
-\r
-/******************************************************************************\r
- * SELECTED_PORT\r
- *\r
- * Macro that specifies what hardware port that should be used.\r
- * Available ports are:\r
- *\r
- * Port Name Code Official OS supported\r
- * PORT_APPLICATION_DEFINED -2 - -\r
- * PORT_NOT_SET -1 - -\r
- * PORT_HWIndependent 0 Yes Any\r
- * PORT_Win32 1 Yes FreeRTOS on 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_PIC32MX 9 Yes 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
- * PORT_MICROCHIP_PIC32MZ 14 Yes Any\r
- * PORT_ARM_CORTEX_A9 15 No Any\r
- *****************************************************************************/\r
-\r
-#ifndef WIN32\r
- // Set the port setting here!\r
- #define SELECTED_PORT PORT_NOT_SET\r
+#ifndef TRC_CONFIG_H\r
+#define TRC_CONFIG_H\r
\r
- #if (SELECTED_PORT == PORT_NOT_SET)\r
- #error "You need to define SELECTED_PORT here!"\r
- #endif\r
-#else\r
- // For Win32 demo projects this is set automatically\r
- #define SELECTED_PORT PORT_Win32\r
+#ifdef __cplusplus\r
+extern "C" {\r
#endif\r
\r
-/******************************************************************************\r
- * FREERTOS_VERSION\r
- *\r
- * Specify what version of FreeRTOS that is used. This is necessary compensate\r
- * for renamed symbols in the FreeRTOS kernel (does not build if incorrect).\r
- *\r
- * FREERTOS_VERSION_7_3_OR_7_4 (= 1) If using FreeRTOS v7.3.0 - v7.4.2\r
- * FREERTOS_VERSION_7_5_OR_7_6 (= 2) If using FreeRTOS v7.5.0 - v7.6.0\r
- * FREERTOS_VERSION_8_0_OR_LATER (= 3) If using FreeRTOS v8.0.0 or later\r
- *****************************************************************************/\r
-#define FREERTOS_VERSION FREERTOS_VERSION_8_0_OR_LATER\r
+#include "trcPortDefines.h"\r
\r
/******************************************************************************\r
- * TRACE_RECORDER_STORE_MODE\r
+ * Include of processor header file\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\r
- * events are stored in a ring buffer, i.e., where the oldest events are\r
- * overwritten when the buffer becomes full. This allows you to get the last\r
- * events leading up to an interesting state, e.g., an error, without having\r
- * to store the whole run since startup.\r
- *\r
- * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the\r
- * recording is stopped when the buffer becomes full. This is useful for\r
- * recording events following a specific state, e.g., the startup sequence.\r
+ * Here you may need to include the header file for your processor. This is\r
+ * required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.\r
+ * Try that in case of build problems. Otherwise, remove the #error line below.\r
*****************************************************************************/\r
-#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER\r
+//#error "Trace Recorder: Please include your processor's header file here and remove this line."\r
\r
/*******************************************************************************\r
- * TRACE_SCHEDULING_ONLY\r
+ * Configuration Macro: TRC_CFG_HARDWARE_PORT\r
*\r
- * Macro which should be defined as an integer value.\r
+ * Specify what hardware port to use (i.e., the "timestamping driver").\r
*\r
- * If this setting is enabled (= 1), only scheduling events are recorded.\r
- * If disabled (= 0), all events are recorded.\r
+ * All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".\r
+ * This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is\r
+ * available on most such devices. In case your device don't have DWT support,\r
+ * you will get an error message opening the trace. In that case, you may\r
+ * force the recorder to use SysTick timestamping instead, using this define:\r
*\r
- * Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this\r
- * option can be used to avoid storing unsupported events.\r
+ * #define TRC_CFG_ARM_CM_USE_SYSTICK\r
*\r
- * Default value is 0 (store all enabled events).\r
+ * For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.\r
*\r
+ * See trcHardwarePort.h for available ports and information on how to\r
+ * define your own port, if not already present.\r
******************************************************************************/\r
-#define TRACE_SCHEDULING_ONLY 0\r
+#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_Win32\r
\r
/*******************************************************************************\r
- * EVENT_BUFFER_SIZE\r
+ * Configuration Macro: TRC_CFG_RECORDER_MODE\r
*\r
- * Macro which should be defined as an integer value.\r
+ * Specify what recording mode to use. Snapshot means that the data is saved in\r
+ * an internal RAM buffer, for later upload. Streaming means that the data is\r
+ * transferred continuously to the host PC.\r
*\r
- * This defines the capacity of the event buffer, i.e., the number of records\r
- * it may store. Most events use one record (4 byte), although some events\r
- * require multiple 4-byte records. You should adjust this to the amount of RAM\r
- * available in the target system.\r
+ * For more information, see http://percepio.com/2016/10/05/rtos-tracing/\r
+ * and the Tracealyzer User Manual.\r
*\r
- * Default value is 1000, which means that 4000 bytes is allocated for the\r
- * event buffer.\r
+ * Values:\r
+ * TRC_RECORDER_MODE_SNAPSHOT\r
+ * TRC_RECORDER_MODE_STREAMING\r
******************************************************************************/\r
-#define EVENT_BUFFER_SIZE 15000\r
+#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT\r
\r
/*******************************************************************************\r
- * NTask, NISR, NQueue, NSemaphore, NMutex\r
- *\r
- * A group of macros which should be defined as integer values, zero or larger.\r
+ * Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION\r
*\r
- * These define the capacity of the Object Property Table, i.e., the maximum\r
- * number of objects active at any given point, within each object class (e.g.,\r
- * task, queue, semaphore, ...).\r
+ * Specifies how the recorder buffer is allocated (also in case of streaming, in\r
+ * port using the recorder's internal temporary buffer)\r
*\r
- * If tasks or other other objects are deleted in your system, this\r
- * setting does not limit the total amount of objects created, only the number\r
- * of objects that have been successfully created but not yet deleted.\r
+ * Values:\r
+ * TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation (internal)\r
+ * TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable\r
+ * TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer\r
*\r
- * Using too small values will cause vTraceError to be called, which stores an\r
- * error message in the trace that is shown when opening the trace file.\r
- *\r
- * It can be wise to start with large values for these constants,\r
- * unless you are very confident on these numbers. Then do a recording and\r
- * check the actual usage by selecting View menu -> Trace Details ->\r
- * Resource Usage -> Object Table.\r
+ * Static and dynamic mode does the allocation for you, either in compile time\r
+ * (static) or in runtime (malloc).\r
+ * The custom mode allows you to control how and where the allocation is made,\r
+ * for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().\r
******************************************************************************/\r
-#define NTask 100\r
-#define NISR 60\r
-#define NQueue 60\r
-#define NSemaphore 60\r
-#define NMutex 60\r
-#define NTimer 200\r
-#define NEventGroup 60\r
+#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC\r
\r
/******************************************************************************\r
- * INCLUDE_MEMMANG_EVENTS\r
- *\r
- * Macro which should be defined as either zero (0) or one (1).\r
+ * TRC_CFG_FREERTOS_VERSION\r
*\r
- * This controls if malloc and free calls should be traced. Set this to zero to\r
- * exclude malloc/free calls, or one (1) to include such events in the trace.\r
+ * Specify what version of FreeRTOS that is used (don't change unless using the\r
+ * trace recorder library with an older version of FreeRTOS).\r
*\r
- * Default value is 1.\r
+ * TRC_FREERTOS_VERSION_7_3_OR_7_4 If using FreeRTOS v7.3.0 - v7.4.2\r
+ * TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0\r
+ * TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X\r
+ * TRC_FREERTOS_VERSION_9_X If using FreeRTOS v9.X.X\r
*****************************************************************************/\r
-#define INCLUDE_MEMMANG_EVENTS 1\r
+#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_9_X\r
\r
/******************************************************************************\r
- * INCLUDE_USER_EVENTS\r
+ * TRC_CFG_MAX_ISR_NESTING\r
*\r
- * Macro which should be defined as either zero (0) or one (1).\r
+ * Defines how many levels of interrupt nesting the recorder can handle, in\r
+ * case multiple ISRs are traced and ISR nesting is possible. If this\r
+ * is exceeded, the particular ISR will not be traced and the recorder then\r
+ * logs an error message. This setting is used to allocate an internal stack\r
+ * for keeping track of the previous execution context (4 byte per entry).\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
+ * This value must be a non-zero positive constant, at least 1.\r
*\r
- * Default value is 1.\r
- *\r
- * Note that User Events are only displayed in Professional Edition.\r
+ * Default value: 8\r
*****************************************************************************/\r
-#define INCLUDE_USER_EVENTS 1\r
+#define TRC_CFG_MAX_ISR_NESTING 8\r
\r
-/*****************************************************************************\r
- * INCLUDE_ISR_TRACING\r
- *\r
- * Macro which should be defined as either zero (0) or one (1).\r
- *\r
- * If this is zero (0), the code for recording Interrupt Service Routines is\r
- * excluded to reduce code size.\r
- *\r
- * Default value is 1.\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_READY_EVENTS\r
- *\r
- * Macro which should be defined as either zero (0) or one (1).\r
- *\r
- * If one (1), events are recorded when tasks enter scheduling state "ready".\r
- * This uses a lot of space in the event buffer, so excluding "ready events"\r
- * will allow for longer traces. Including ready events however allows for\r
- * showing the initial pending time before tasks enter the execution state, and\r
- * for presenting accurate response times.\r
- *\r
- * Default value is 1.\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
- *\r
- * If this is zero (1), events will be generated whenever the OS clock is\r
- * increased.\r
- *\r
- * Default value is 0.\r
- *****************************************************************************/\r
-#define INCLUDE_NEW_TIME_EVENTS 1\r
-\r
-/******************************************************************************\r
- * INCLUDE_FLOAT_SUPPORT\r
- *\r
- * Macro which should be defined as either zero (0) or one (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) arguments.\r
- *\r
- * vTracePrintF can be used with integer and string arguments in either case.\r
- *\r
- * Default value is 1.\r
- *****************************************************************************/\r
-#define INCLUDE_FLOAT_SUPPORT 0\r
-\r
-/******************************************************************************\r
- * INCLUDE_OBJECT_DELETE\r
- *\r
- * Macro which should be defined as either zero (0) or one (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
- * Default value is 1.\r
- *****************************************************************************/\r
-#define INCLUDE_OBJECT_DELETE 1\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. If you don't use User Events or delete any kernel\r
- * objects you set this to a very low value. The minimum recommended value is 4.\r
- * A size of zero (0) is not allowed since a zero-sized array may result in a\r
- * 32-bit pointer, i.e., using 4 bytes rather than 0.\r
- *\r
- * Default value is 800.\r
- ******************************************************************************/\r
-#define SYMBOL_TABLE_SIZE 5000\r
-\r
-#if (SYMBOL_TABLE_SIZE == 0)\r
-#error "SYMBOL_TABLE_SIZE may not be zero!"\r
+/* Specific configuration, depending on Streaming/Snapshot mode */\r
+#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)\r
+#include "trcSnapshotConfig.h"\r
+#elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)\r
+#include "trcStreamingConfig.h"\r
#endif\r
\r
-/******************************************************************************\r
- * NameLenTask, NameLenQueue, ...\r
- *\r
- * Macros that specify the maximum lengths (number of characters) for names of\r
- * kernel objects, such as tasks and queues. If longer names are used, they will\r
- * be truncated when stored in the recorder.\r
- *****************************************************************************/\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_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
-#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC\r
-\r
-\r
-\r
-/******************************************************************************\r
- *** ADVANCED SETTINGS ********************************************************\r
- ******************************************************************************\r
- * The remaining settings are not necessary to modify but allows for optimizing\r
- * the recorder setup for your specific needs, e.g., to exclude events that you\r
- * are not interested in, in order to get longer traces.\r
- *****************************************************************************/\r
-\r
-/******************************************************************************\r
-* HEAP_SIZE_BELOW_16M\r
-*\r
-* An integer constant that can be used to reduce the buffer usage of memory\r
-* allocation events (malloc/free). This value should be 1 if the heap size is\r
-* below 16 MB (2^24 byte), and you can live with reported addresses showing the\r
-* lower 24 bits only. If 0, you get the full 32-bit addresses.\r
-*\r
-* Default value is 0.\r
-******************************************************************************/\r
-#define HEAP_SIZE_BELOW_16M 0\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
-#define USE_LINKER_PRAGMA 0\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
- * Tracealyzer groups the events into actor instances, based on context-switches\r
- * and a definition of "Instance Finish Events", or IFEs. These are kernel calls\r
- * considered to be the last event in a task instance. Some kernel calls are\r
- * considered IFEs by default (e.g., delay functions), but it is also possible\r
- * to specify this individually for each task (see vTraceTaskInstanceFinish).\r
- *\r
- * If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which\r
- * gives a "typical" grouping of events into instances. You can combine this\r
- * with calls to vTraceTaskInstanceFinish for specific tasks.\r
- *\r
- * If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all\r
- * events withing each task is then shown as a single instance, unless you call\r
- * vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.\r
- *****************************************************************************/\r
-#define USE_IMPLICIT_IFE_RULES 1\r
-\r
-/******************************************************************************\r
- * USE_16BIT_OBJECT_HANDLES\r
- *\r
- * Macro which should be defined as either zero (0) or one (1).\r
- *\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
- * Default is 0.\r
- *\r
- * NOTE: An object with handle above 255 will use an extra 4-byte record in\r
- * the event buffer whenever referenced. Moreover, some internal tables in the\r
- * recorder gets larger when using 16-bit handles. The additional RAM usage is\r
- * 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.\r
- *****************************************************************************/\r
-#define USE_16BIT_OBJECT_HANDLES 0\r
-\r
-/******************************************************************************\r
- * USE_TRACE_ASSERT\r
- *\r
- * Macro which should be defined as either zero (0) or one (1).\r
- * Default is 1.\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
- * This is used on several places in the recorder code for sanity checks on\r
- * parameters. Can be switched off to reduce CPU usage of the tracing.\r
- *****************************************************************************/\r
-#define USE_TRACE_ASSERT 1\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. Using\r
- * this separate buffer has the benefit of not overwriting the user events with\r
- * kernel events (usually generated at a much higher rate), i.e., when using\r
- * ring-buffer mode.\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 10\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
+#ifdef __cplusplus\r
+}\r
#endif\r
\r
+#endif /* _TRC_CONFIG_H */\r
--- /dev/null
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v3.1.2\r
+ * Percepio AB, www.percepio.com\r
+ *\r
+ * trcSnapshotConfig.h\r
+ *\r
+ * Configuration parameters for trace recorder library in snapshot mode.\r
+ * Read more at http://percepio.com/2016/10/05/rtos-tracing/\r
+ *\r
+ * Terms of Use\r
+ * This file is part of the trace recorder library (RECORDER), which is the\r
+ * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
+ * license as follows.\r
+ * The RECORDER may be used free of charge for the purpose of recording data\r
+ * intended for analysis in PERCEPIO products. It may not be used or modified\r
+ * for other purposes without explicit permission from PERCEPIO.\r
+ * You may distribute the RECORDER in its original source code form, assuming\r
+ * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
+ * allowed to distribute the RECORDER with minor modifications intended for\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a\r
+ * specific processor, processor family or with a specific communication\r
+ * interface. Any such modifications should be documented directly below\r
+ * this comment block.\r
+ *\r
+ * Disclaimer\r
+ * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the\r
+ * performance or results you may obtain by using the RECORDER or documentation.\r
+ * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
+ * third party rights, merchantability, or fitness for any particular purpose.\r
+ * In no event will PERCEPIO, its technology partners, or distributors be liable\r
+ * to you for any consequential, incidental or special damages, including any\r
+ * lost profits or lost savings, even if a representative of PERCEPIO has been\r
+ * advised of the possibility of such damages, or for any claim by any third\r
+ * party. Some jurisdictions do not allow the exclusion or limitation of\r
+ * incidental, consequential or special damages, or the exclusion of implied\r
+ * warranties or limitations on how long an implied warranty may last, so the\r
+ * above limitations may not apply to you.\r
+ *\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2017.\r
+ * www.percepio.com\r
+ ******************************************************************************/\r
+\r
+#ifndef TRC_SNAPSHOT_CONFIG_H\r
+#define TRC_SNAPSHOT_CONFIG_H\r
+\r
+#define TRC_SNAPSHOT_MODE_RING_BUFFER (0x01)\r
+#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL (0x02)\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_SNAPSHOT_MODE\r
+ *\r
+ * Macro which should be defined as one of:\r
+ * - TRC_SNAPSHOT_MODE_RING_BUFFER\r
+ * - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL\r
+ * Default is TRC_SNAPSHOT_MODE_RING_BUFFER.\r
+ *\r
+ * With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the\r
+ * events are stored in a ring buffer, i.e., where the oldest events are\r
+ * overwritten when the buffer becomes full. This allows you to get the last\r
+ * events leading up to an interesting state, e.g., an error, without having\r
+ * to store the whole run since startup.\r
+ *\r
+ * When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the\r
+ * recording is stopped when the buffer becomes full. This is useful for\r
+ * recording events following a specific state, e.g., the startup sequence.\r
+ *****************************************************************************/\r
+#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_SCHEDULING_ONLY\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * If this setting is enabled (= 1), only scheduling events are recorded.\r
+ * If disabled (= 0), all events are recorded.\r
+ *\r
+ * For users of Tracealyzer Free Edition, that only displays scheduling events, this\r
+ * option can be used to avoid storing other events.\r
+ *\r
+ * Default value is 0 (store all enabled events).\r
+ *\r
+ ******************************************************************************/\r
+#define TRC_CFG_SCHEDULING_ONLY 0\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_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. Most events use one record (4 byte), although some events\r
+ * require multiple 4-byte records. You should adjust this to the amount of RAM\r
+ * available in the target system.\r
+ *\r
+ * Default value is 1000, which means that 4000 bytes is allocated for the\r
+ * event buffer.\r
+ ******************************************************************************/\r
+#define TRC_CFG_EVENT_BUFFER_SIZE 15000\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...\r
+ *\r
+ * A group of macros which should be defined as integer values, zero or larger.\r
+ *\r
+ * These define the capacity of the Object Property Table, i.e., the maximum\r
+ * number of objects active at any given point, within each object class (e.g.,\r
+ * task, queue, semaphore, ...).\r
+ *\r
+ * If tasks or other objects are deleted in your system, this\r
+ * setting does not limit the total amount of objects created, only the number\r
+ * of objects that have been successfully created but not yet deleted.\r
+ *\r
+ * Using too small values will cause vTraceError to be called, which stores an\r
+ * error message in the trace that is shown when opening the trace file. The\r
+ * error message can also be retrieved using xTraceGetLastError.\r
+ *\r
+ * It can be wise to start with large values for these constants,\r
+ * unless you are very confident on these numbers. Then do a recording and\r
+ * check the actual usage by selecting View menu -> Trace Details ->\r
+ * Resource Usage -> Object Table.\r
+ ******************************************************************************/\r
+#define TRC_CFG_NTASK 150\r
+#define TRC_CFG_NISR 90\r
+#define TRC_CFG_NQUEUE 90\r
+#define TRC_CFG_NSEMAPHORE 90\r
+#define TRC_CFG_NMUTEX 90\r
+#define TRC_CFG_NTIMER 250\r
+#define TRC_CFG_NEVENTGROUP 90\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_INCLUDE_MEMMANG_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * This controls if malloc and free calls should be traced. Set this to zero (0)\r
+ * to exclude malloc/free calls, or one (1) to include such events in the trace.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_INCLUDE_USER_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (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 and the formatting is done offline, by the\r
+ * Tracealyzer visualization tool. User Events are much faster than a printf\r
+ * and can therefore be used in timing critical code.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_USER_EVENTS 1\r
+\r
+/*****************************************************************************\r
+ * TRC_CFG_INCLUDE_ISR_TRACING\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the code for recording Interrupt Service Routines is\r
+ * excluded, in order to reduce code size.\r
+ *\r
+ * Default value is 1.\r
+ *\r
+ * Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin\r
+ * and vTraceStoreISREnd in your interrupt handlers.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_ISR_TRACING 1\r
+\r
+/*****************************************************************************\r
+ * TRC_CFG_INCLUDE_READY_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If one (1), events are recorded when tasks enter scheduling state "ready".\r
+ * This allows Tracealyzer to show the initial pending time before tasks enter\r
+ * the execution state, and present accurate response times.\r
+ * If zero (0), "ready events" are not created, which allows for recording\r
+ * longer traces in the same amount of RAM.\r
+ *\r
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_READY_EVENTS 1\r
+\r
+/*****************************************************************************\r
+ * TRC_CFG_INCLUDE_OSTICK_EVENTS\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is one (1), events will be generated whenever the OS clock is\r
+ * increased. If zero (0), OS tick events are not generated, which allows for\r
+ * recording longer traces in the same amount of RAM.\r
+ *\r
+ * Default value is 0.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_INCLUDE_FLOAT_SUPPORT\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\r
+ * If this is zero (0), the support for logging floating point values in\r
+ * vTracePrintF is stripped out, in case floating point values are not used or\r
+ * supported by the platform used.\r
+ *\r
+ * Floating point values are only used in vTracePrintF and its subroutines, to\r
+ * allow for storing float (%f) or double (%lf) arguments.\r
+ *\r
+ * vTracePrintF can be used with integer and string arguments in either case.\r
+ *\r
+ * Default value is 0.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_INCLUDE_OBJECT_DELETE\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (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
+ * Default value is 1.\r
+ *****************************************************************************/\r
+#define TRC_CFG_INCLUDE_OBJECT_DELETE 1\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_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. If you don't use User Events or delete any kernel\r
+ * objects you set this to a very low value. The minimum recommended value is 4.\r
+ * A size of zero (0) is not allowed since a zero-sized array may result in a\r
+ * 32-bit pointer, i.e., using 4 bytes rather than 0.\r
+ *\r
+ * Default value is 800.\r
+ ******************************************************************************/\r
+#define TRC_CFG_SYMBOL_TABLE_SIZE 5000\r
+\r
+#if (TRC_CFG_SYMBOL_TABLE_SIZE == 0)\r
+#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"\r
+#endif\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...\r
+ *\r
+ * Macros that specify the maximum lengths (number of characters) for names of\r
+ * kernel objects, such as tasks and queues. If longer names are used, they will\r
+ * be truncated when stored in the recorder.\r
+ *****************************************************************************/\r
+#define TRC_CFG_NAME_LEN_TASK 15\r
+#define TRC_CFG_NAME_LEN_ISR 15\r
+#define TRC_CFG_NAME_LEN_QUEUE 15\r
+#define TRC_CFG_NAME_LEN_SEMAPHORE 15\r
+#define TRC_CFG_NAME_LEN_MUTEX 15\r
+#define TRC_CFG_NAME_LEN_TIMER 15\r
+#define TRC_CFG_NAME_LEN_EVENTGROUP 15\r
+\r
+/******************************************************************************\r
+ *** ADVANCED SETTINGS ********************************************************\r
+ ******************************************************************************\r
+ * The remaining settings are not necessary to modify but allows for optimizing\r
+ * the recorder setup for your specific needs, e.g., to exclude events that you\r
+ * are not interested in, in order to get longer traces.\r
+ *****************************************************************************/\r
+\r
+/******************************************************************************\r
+* TRC_CFG_HEAP_SIZE_BELOW_16M\r
+*\r
+* An integer constant that can be used to reduce the buffer usage of memory\r
+* allocation events (malloc/free). This value should be 1 if the heap size is\r
+* below 16 MB (2^24 byte), and you can live with reported addresses showing the\r
+* lower 24 bits only. If 0, you get the full 32-bit addresses.\r
+*\r
+* Default value is 0.\r
+******************************************************************************/\r
+#define TRC_CFG_HEAP_SIZE_BELOW_16M 0\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_USE_IMPLICIT_IFE_RULES\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ * Default is 1.\r
+ *\r
+ * Tracealyzer groups the events into "instances" based on Instance Finish\r
+ * Events (IFEs), produced either by default rules or calls to the recorder\r
+ * functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext.\r
+ *\r
+ * If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is\r
+ * used, resulting in a "typical" grouping of events into instances.\r
+ * If these rules don't give appropriate instances in your case, you can\r
+ * override the default rules using vTraceInstanceFinishedNow/Next for one\r
+ * or several tasks. The default IFE rules are then disabled for those tasks.\r
+ *\r
+ * If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are\r
+ * disabled globally. You must then call vTraceInstanceFinishedNow or\r
+ * vTraceInstanceFinishedNext to manually group the events into instances,\r
+ * otherwise the tasks will appear a single long instance.\r
+ *\r
+ * The default IFE rules count the following events as "instance finished":\r
+ * - Task delay, delay until\r
+ * - Task suspend\r
+ * - Blocking on "input" operations, i.e., when the task is waiting for the\r
+ * next a message/signal/event. But only if this event is blocking.\r
+ *\r
+ * For details, see trcSnapshotKernelPort.h and look for references to the\r
+ * macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.\r
+ *****************************************************************************/\r
+#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_USE_16BIT_OBJECT_HANDLES\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ *\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 (tasks, queues, mutexes,\r
+ * etc.) Note: 255, not 256, since handle 0 is reserved.\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
+ * Default is 0 (8-bit handles)\r
+ *\r
+ * NOTE: An object with handle above 255 will use an extra 4-byte record in\r
+ * the event buffer whenever the object is referenced. Moreover, some internal\r
+ * tables in the recorder gets slightly larger when using 16-bit handles.\r
+ *****************************************************************************/\r
+#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0\r
+\r
+/******************************************************************************\r
+ * TRC_CFG_USE_TRACE_ASSERT\r
+ *\r
+ * Macro which should be defined as either zero (0) or one (1).\r
+ * Default is 1.\r
+ *\r
+ * If this is one (1), the TRACE_ASSERT macro (used at various locations in the\r
+ * trace recorder) will verify that a relevant condition is true.\r
+ * If the condition is false, prvTraceError() will be called, which stops the\r
+ * recording and stores an error message that is displayed when opening the\r
+ * trace in Tracealyzer.\r
+ *\r
+ * This is used on several places in the recorder code for sanity checks on\r
+ * parameters. Can be switched off to reduce the footprint of the tracing, but\r
+ * we recommend to have it enabled initially.\r
+ *****************************************************************************/\r
+#define TRC_CFG_USE_TRACE_ASSERT 1\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the\r
+ * separate user event buffer (UB).\r
+ * In this mode, user events are stored separately from other events,\r
+ * e.g., RTOS events. Thereby you can get a much longer history of\r
+ * user events as they don't need to share the buffer space with more\r
+ * frequent events.\r
+ *\r
+ * The UB is typically used with the snapshot ring-buffer mode, so the\r
+ * recording can continue when the main buffer gets full. And since the\r
+ * main buffer then overwrites the earliest events, Tracealyzer displays\r
+ * "Unknown Actor" instead of task scheduling for periods with UB data only.\r
+ *\r
+ * In UB mode, user events are structured as UB channels, which contains\r
+ * a channel name and a default format string. Register a UB channel using\r
+ * xTraceRegisterUBChannel.\r
+ *\r
+ * Events and data arguments are written using vTraceUBEvent and\r
+ * vTraceUBData. They are designed to provide efficient logging of\r
+ * repeating events, using the same format string within each channel.\r
+ *\r
+ * Examples:\r
+ *\r
+ * traceString chn1 = xTraceRegisterString("Channel 1");\r
+ * traceString fmt1 = xTraceRegisterString("Event!");\r
+ * traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);\r
+ *\r
+ * traceString chn2 = xTraceRegisterString("Channel 2");\r
+ * traceString fmt2 = xTraceRegisterString("X: %d, Y: %d");\r
+ * traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);\r
+ *\r
+ * // Result in "[Channel 1] Event!"\r
+ * vTraceUBEvent(UBCh1);\r
+ *\r
+ * // Result in "[Channel 2] X: 23, Y: 19"\r
+ * vTraceUBData(UBCh2, 23, 19);\r
+ *\r
+ * You can also use the other user event functions, like vTracePrintF.\r
+ * as they are then rerouted to the UB instead of the main event buffer.\r
+ * vTracePrintF then looks up the correct UB channel based on the\r
+ * provided channel name and format string, or creates a new UB channel\r
+ * if no match is found. The format string should therefore not contain\r
+ * "random" messages but mainly format specifiers. Random strings should\r
+ * be stored using %s and with the string as an argument.\r
+ *\r
+ * // Creates a new UB channel ("Channel 2", "%Z: %d")\r
+ * vTracePrintF(chn2, "%Z: %d", value1);\r
+ *\r
+ * // Finds the existing UB channel\r
+ * vTracePrintF(chn2, "%Z: %d", value2);\r
+\r
+ ******************************************************************************/\r
+#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_SEPARATE_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 (UB), in number of slots.\r
+ * A single user event can use multiple slots, depending on the arguments.\r
+ *\r
+ * Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.\r
+ ******************************************************************************/\r
+#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_UB_CHANNELS\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * This defines the number of User Event Buffer Channels (UB channels).\r
+ * These are used to structure the events when using the separate user\r
+ * event buffer, and contains both a User Event Channel (the name) and\r
+ * a default format string for the channel.\r
+ *\r
+ * Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.\r
+ ******************************************************************************/\r
+#define TRC_CFG_UB_CHANNELS 32\r
+\r
+/*******************************************************************************\r
+ * TRC_CFG_ISR_TAILCHAINING_THRESHOLD\r
+ *\r
+ * Macro which should be defined as an integer value.\r
+ *\r
+ * If tracing multiple ISRs, this setting allows for accurate display of the\r
+ * context-switching also in cases when the ISRs execute in direct sequence.\r
+ *\r
+ * vTraceStoreISREnd normally assumes that the ISR returns to the previous\r
+ * context, i.e., a task or a preempted ISR. But if another traced ISR\r
+ * executes in direct sequence, Tracealyzer may incorrectly display a minimal\r
+ * fragment of the previous context in between the ISRs.\r
+ *\r
+ * By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is\r
+ * however a threshold value that must be measured for your specific setup.\r
+ * See http://percepio.com/2014/03/21/isr_tailchaining_threshold/\r
+ *\r
+ * The default setting is 0, meaning "disabled" and that you may get an\r
+ * extra fragments of the previous context in between tail-chained ISRs.\r
+ *\r
+ * Note: This setting has separate definitions in trcSnapshotConfig.h and\r
+ * trcStreamingConfig.h, since it is affected by the recorder mode.\r
+ ******************************************************************************/\r
+#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0\r
+\r
+#endif /*TRC_SNAPSHOT_CONFIG_H*/\r
<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup Label="ProjectConfigurations">\r
<ProjectConfiguration Include="Debug|Win32">\r
<Configuration>Debug</Configuration>\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v140</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v140</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c" />\r
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c" />\r
<ClCompile Include="..\..\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c" />\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcBase.c" />\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcHardwarePort.c" />\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcKernel.c" />\r
<ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcKernelPort.c" />\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcUser.c" />\r
+ <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcSnapshotRecorder.c" />\r
+ <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcStreamingRecorder.c" />\r
<ClCompile Include="CLI-commands.c" />\r
<ClCompile Include="main.c">\r
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<ClCompile Include="UDPCommandServer.c" />\r
</ItemGroup>\r
<ItemGroup>\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcBase.h" />\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcKernel.h" />\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcKernelPort.h" />\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcTypes.h" />\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcUser.h" />\r
<ClInclude Include="FreeRTOSConfig.h" />\r
<ClInclude Include="Trace_Recorder_Configuration\trcConfig.h" />\r
+ <ClInclude Include="Trace_Recorder_Configuration\trcSnapshotConfig.h" />\r
</ItemGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
<Filter Include="FreeRTOS+\FreeRTOS+Trace">\r
<UniqueIdentifier>{629e761f-e8a8-430e-b44e-f38d83292b54}</UniqueIdentifier>\r
</Filter>\r
- <Filter Include="FreeRTOS+\FreeRTOS+Trace\Include">\r
- <UniqueIdentifier>{e17028e8-51ed-45af-8aa4-22ade709b3fb}</UniqueIdentifier>\r
- </Filter>\r
<Filter Include="FreeRTOS\Configuration Files">\r
<UniqueIdentifier>{19ff1a34-36de-4c48-9d10-3fb1fa0d1fa4}</UniqueIdentifier>\r
<Extensions>\r
<ClCompile Include="..\..\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c">\r
<Filter>FreeRTOS+\FreeRTOS+CLI</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcUser.c">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcBase.c">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcKernel.c">\r
+ <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcKernelPort.c">\r
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcHardwarePort.c">\r
+ <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcSnapshotRecorder.c">\r
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcKernelPort.c">\r
+ <ClCompile Include="..\..\Source\FreeRTOS-Plus-Trace\trcStreamingRecorder.c">\r
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>\r
</ClCompile>\r
</ItemGroup>\r
<ClInclude Include="Trace_Recorder_Configuration\trcConfig.h">\r
<Filter>Demo App Source\Trace Recorder Configuration</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcUser.h">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcBase.h">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcKernel.h">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcTypes.h">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\Source\FreeRTOS-Plus-Trace\Include\trcKernelPort.h">\r
- <Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>\r
+ <ClInclude Include="Trace_Recorder_Configuration\trcSnapshotConfig.h">\r
+ <Filter>Demo App Source\Trace Recorder Configuration</Filter>\r
</ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
#include "task.h"\r
#include "queue.h"\r
\r
-/* FreeRTOS+Trace includes. */\r
-#include "trcUser.h"\r
-\r
/* Priorities at which the tasks are created. */\r
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
/* The queue used by both tasks. */\r
static xQueueHandle xQueue = NULL;\r
\r
-/* The user trace event posted to the trace recording on each tick interrupt.\r
-Note tick events will not appear in the trace recording with regular period\r
-because this project runs in a Windows simulator, and does not therefore\r
-exhibit deterministic behaviour. */\r
-traceLabel xTickTraceUserEvent;\r
-\r
/*-----------------------------------------------------------*/\r
\r
int main( void )\r
\r
/* Initialise the trace recorder and create the label used to post user\r
events to the trace recording on each tick interrupt. */\r
- vTraceInitTraceData();\r
- xTickTraceUserEvent = xTraceOpenLabel( "tick" );\r
+ vTraceEnable( TRC_START );\r
\r
/* Create the queue used to pass messages from the queue send task to the\r
queue receive task. */\r
line will never be reached. If the following line does execute, then\r
there was insufficient FreeRTOS heap memory available for the idle and/or\r
timer tasks to be created. See the memory management section on the\r
- FreeRTOS web site for more details (this is standard text that is not not\r
+ FreeRTOS web site for more details (this is standard text that is not\r
really applicable to the Win32 simulator port). */\r
for( ;; )\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vApplicationTickHook( void )\r
-{\r
- /* Write a user event to the trace log.\r
- Note tick events will not appear in the trace recording with regular period\r
- because this project runs in a Windows simulator, and does not therefore\r
- exhibit deterministic behaviour. */\r
- vTraceUserEvent( xTickTraceUserEvent );\r
-}\r
\r