From: rtel Date: Thu, 18 Dec 2014 11:02:15 +0000 (+0000) Subject: + Update demos that use FreeRTOS+Trace to work with the latest trace recorder library. X-Git-Tag: V8.2.0rc1~5 X-Git-Url: https://git.sur5r.net/?p=freertos;a=commitdiff_plain;h=cb8206e1664b7430f25c392d2e2ee52236e10e75 + Update demos that use FreeRTOS+Trace to work with the latest trace recorder library. + Fix a few compiler warnings. + Add TickType_t specific critical sections so critical sections are not used when accessing the tick count in cases where the access is atomic (32-bit tick count, 32-bit architecture). git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2315 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/FreeRTOSConfig.h index c36538505..ab4866317 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/FreeRTOSConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/FreeRTOSConfig.h @@ -105,7 +105,7 @@ #define configTIMER_QUEUE_LENGTH 20 #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) -#define configMAX_PRIORITIES ( ( UBaseType_t ) 7 ) +#define configMAX_PRIORITIES ( 7 ) #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) @@ -157,6 +157,8 @@ take up unnecessary RAM. */ /* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */ +#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL() +#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL() #include "trcKernelPort.h" #endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/trcConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/trcConfig.h index a81aeb8e0..7039112bf 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/trcConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/trcConfig.h @@ -1,14 +1,14 @@ /******************************************************************************* - * Tracealyzer v2.6.0 Recorder Library + * Tracealyzer v2.7.0 Recorder Library * Percepio AB, www.percepio.com * * trcConfig.h * - * Configuration parameters for the trace recorder library. Before using the - * trace recorder library, please check that the default settings are - * appropriate for your system, and if necessary adjust these. Most likely, you - * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to - * reflect the number of such objects in your system. These may be + * Configuration parameters for the trace recorder library. Before using the + * trace recorder library, please check that the default settings are + * appropriate for your system, and if necessary adjust these. Most likely, you + * will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to + * reflect the number of such objects in your system. These may be * over-approximated, although larger values values implies more RAM usage. * * Terms of Use @@ -16,515 +16,460 @@ * use together with Percepio products. You may distribute the recorder library * in its original form, including modifications in trcHardwarePort.c/.h * given that these modification are clearly marked as your own modifications - * and documented in the initial comment section of these source files. - * This software is the intellectual property of Percepio AB and may not be - * sold or in other ways commercially redistributed without explicit written + * and documented in the initial comment section of these source files. + * This software is the intellectual property of Percepio AB and may not be + * sold or in other ways commercially redistributed without explicit written * permission by Percepio AB. * - * Disclaimer - * The trace tool and recorder library is being delivered to you AS IS and - * Percepio AB makes no warranty as to its use or performance. Percepio AB does - * not and cannot warrant the performance or results you may obtain by using the - * software or documentation. Percepio AB make no warranties, express or - * implied, as to noninfringement of third party rights, merchantability, or - * fitness for any particular purpose. In no event will Percepio AB, its - * technology partners, or distributors be liable to you for any consequential, - * incidental or special damages, including any lost profits or lost savings, - * even if a representative of Percepio AB has been advised of the possibility - * of such damages, or for any claim by any third party. Some jurisdictions do - * not allow the exclusion or limitation of incidental, consequential or special - * damages, or the exclusion of implied warranties or limitations on how long an + * Disclaimer + * The trace tool and recorder library is being delivered to you AS IS and + * Percepio AB makes no warranty as to its use or performance. Percepio AB does + * not and cannot warrant the performance or results you may obtain by using the + * software or documentation. Percepio AB make no warranties, express or + * implied, as to noninfringement of third party rights, merchantability, or + * fitness for any particular purpose. In no event will Percepio AB, its + * technology partners, or distributors be liable to you for any consequential, + * incidental or special damages, including any lost profits or lost savings, + * even if a representative of Percepio AB has been advised of the possibility + * of such damages, or for any claim by any third party. Some jurisdictions do + * not allow the exclusion or limitation of incidental, consequential or special + * damages, or the exclusion of implied warranties or limitations on how long an * implied warranty may last, so the above limitations may not apply to you. * - * Copyright Percepio AB, 2013. + * Tabs are used for indent in this file (1 tab = 4 spaces) + * + * Copyright Percepio AB, 2014. * www.percepio.com ******************************************************************************/ #ifndef TRCCONFIG_H #define TRCCONFIG_H -/******************************************************************************* - * CONFIGURATION RELATED TO CAPACITY AND ALLOCATION - ******************************************************************************/ - -/******************************************************************************* - * EVENT_BUFFER_SIZE - * - * Macro which should be defined as an integer value. - * - * This defines the capacity of the event buffer, i.e., the number of records - * it may store. Each registered event typically use one record (4 byte), but - * vTracePrintF may use multiple records depending on the number of data args. - ******************************************************************************/ +/****************************************************************************** + * SELECTED_PORT + * + * Macro that specifies what hardware port that should be used. + * Available ports are: + * + * Port Name Code Official OS supported + * PORT_APPLICATION_DEFINED -2 - - + * PORT_NOT_SET -1 - - + * PORT_HWIndependent 0 Yes Any + * PORT_Win32 1 Yes FreeRTOS on Win32 + * PORT_Atmel_AT91SAM7 2 No Any + * PORT_Atmel_UC3A0 3 No Any + * PORT_ARM_CortexM 4 Yes Any + * PORT_Renesas_RX600 5 Yes Any + * PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any + * PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any + * PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any + * PORT_MICROCHIP_PIC32MX 9 Yes Any + * PORT_XILINX_PPC405 10 No FreeRTOS + * PORT_XILINX_PPC440 11 No FreeRTOS + * PORT_XILINX_MICROBLAZE 12 No Any + * PORT_NXP_LPC210X 13 No Any + * PORT_MICROCHIP_PIC32MZ 14 Yes Any + * PORT_ARM_CORTEX_A9 15 No Any + *****************************************************************************/ -#define EVENT_BUFFER_SIZE 4000 /* Adjust wrt. to available RAM */ +#ifndef WIN32 + // Set the port setting here! + #define SELECTED_PORT PORT_NOT_SET + #if (SELECTED_PORT == PORT_NOT_SET) + #error "You need to define SELECTED_PORT here!" + #endif +#else + // For Win32 demo projects this is set automatically + #define SELECTED_PORT PORT_Win32 +#endif -/******************************************************************************* - * USE_LINKER_PRAGMA - * - * Macro which should be defined as an integer value, default is 0. +/****************************************************************************** + * FREERTOS_VERSION * - * If this is 1, the header file "recorderdata_linker_pragma.h" is included just - * before the declaration of RecorderData (in trcBase.c), i.e., the trace data - * structure. This allows the user to specify a pragma with linker options. + * Specify what version of FreeRTOS that is used. This is necessary compensate + * for renamed symbols in the FreeRTOS kernel (does not build if incorrect). * - * Example (for IAR Embedded Workbench and NXP LPC17xx): - * #pragma location="AHB_RAM_MEMORY" - * - * This example instructs the IAR linker to place RecorderData in another RAM - * bank, the AHB RAM. This can also be used for other compilers with a similar - * pragmas for linker options. - * - * Note that this only applies if using static allocation, see below. - ******************************************************************************/ - -#define USE_LINKER_PRAGMA 0 - + * FREERTOS_VERSION_7_3_OR_7_4 (= 1) If using FreeRTOS v7.3.0 - v7.4.2 + * FREERTOS_VERSION_7_5_OR_7_6 (= 2) If using FreeRTOS v7.5.0 - v7.6.0 + * FREERTOS_VERSION_8_0_OR_LATER (= 3) If using FreeRTOS v8.0.0 or later + *****************************************************************************/ +#define FREERTOS_VERSION FREERTOS_VERSION_8_0_OR_LATER -/******************************************************************************* - * SYMBOL_TABLE_SIZE +/****************************************************************************** + * TRACE_RECORDER_STORE_MODE * - * Macro which should be defined as an integer value. + * Macro which should be defined as one of: + * - TRACE_STORE_MODE_RING_BUFFER + * - TRACE_STORE_MODE_STOP_WHEN_FULL + * Default is TRACE_STORE_MODE_RING_BUFFER. * - * This defines the capacity of the symbol table, in bytes. This symbol table - * stores User Events labels and names of deleted tasks, queues, or other kernel - * objects. Note that the names of active objects not stored here but in the - * Object Table. Thus, if you don't use User Events or delete any kernel - * objects you set this to a very low value, e.g. 4, but not zero (0) since - * this causes a declaration of a zero-sized array, for which the C compiler - * behavior is not standardized and may cause misaligned data. - ******************************************************************************/ -#define SYMBOL_TABLE_SIZE 1000 - -#if (SYMBOL_TABLE_SIZE == 0) -#error "SYMBOL_TABLE_SIZE may not be zero!" -#endif + * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the + * events are stored in a ring buffer, i.e., where the oldest events are + * overwritten when the buffer becomes full. This allows you to get the last + * events leading up to an interesting state, e.g., an error, without having + * to store the whole run since startup. + * + * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the + * recording is stopped when the buffer becomes full. This is useful for + * recording events following a specific state, e.g., the startup sequence. + *****************************************************************************/ +#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER /******************************************************************************* - * USE_SEPARATE_USER_EVENT_BUFFER + * TRACE_SCHEDULING_ONLY * * Macro which should be defined as an integer value. - * Default is zero (0). * - * This enables and disables the use of the separate user event buffer. + * If this setting is enabled (= 1), only scheduling events are recorded. + * If disabled (= 0), all events are recorded. * - * Note: When using the separate user event buffer, you may get an artificial - * task instance named "Unknown actor". This is added as a placeholder when the - * user event history is longer than the task scheduling history. - ******************************************************************************/ -#define USE_SEPARATE_USER_EVENT_BUFFER 0 - -/******************************************************************************* - * USER_EVENT_BUFFER_SIZE - * - * Macro which should be defined as an integer value. + * Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this + * option can be used to avoid storing unsupported events. * - * This defines the capacity of the user event buffer, in number of slots. - * A single user event can use between 1 and X slots, depending on the data. + * Default value is 0 (store all enabled events). * - * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1. ******************************************************************************/ -#define USER_EVENT_BUFFER_SIZE 500 +#define TRACE_SCHEDULING_ONLY 0 /******************************************************************************* - * USER_EVENT_CHANNELS + * EVENT_BUFFER_SIZE * * Macro which should be defined as an integer value. * - * This defines the number of allowed user event channels. + * This defines the capacity of the event buffer, i.e., the number of records + * it may store. Most events use one record (4 byte), although some events + * require multiple 4-byte records. You should adjust this to the amount of RAM + * available in the target system. * - * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1. + * Default value is 1000, which means that 4000 bytes is allocated for the + * event buffer. ******************************************************************************/ -#define CHANNEL_FORMAT_PAIRS 32 +#define EVENT_BUFFER_SIZE 15000 /******************************************************************************* * NTask, NISR, NQueue, NSemaphore, NMutex * - * A group of Macros which should be defined as an integer value of zero (0) - * or larger. + * A group of macros which should be defined as integer values, zero or larger. * - * This defines the capacity of the Object Property Table - the maximum number - * of objects active at any given point within each object class. - * - * NOTE: In case objects are deleted and created during runtime, this setting - * does not limit the total amount of objects, only the number of concurrently - * active objects. + * These define the capacity of the Object Property Table, i.e., the maximum + * number of objects active at any given point, within each object class (e.g., + * task, queue, semaphore, ...). * - * Using too small values will give an error message through the vTraceError - * routine, which makes the error message appear when opening the trace data - * in Tracealyzer. If you are using the recorder status monitor task, - * any error messages are displayed in console prints, assuming that the - * print macro has been defined properly (vConsolePrintMessage). + * If tasks or other other objects are deleted in your system, this + * setting does not limit the total amount of objects created, only the number + * of objects that have been successfully created but not yet deleted. * - * It can be wise to start with very large values for these constants, - * unless you are very confident on these numbers. Then do a recording and - * check the actual usage in Tracealyzer. This is shown by selecting - * View -> Trace Details -> Resource Usage -> Object Table - * - * NOTE 2: Remember to account for all tasks and other objects created by - * the kernel, such as the IDLE task, any timer tasks, and any tasks created - * by other 3rd party software components, such as communication stacks. - * Moreover, one task slot is used to indicate "(startup)", i.e., a fictive - * task that represent the time before the scheduler starts. - * NTask should thus be at least 2-3 slots larger than your application task count. + * Using too small values will cause vTraceError to be called, which stores an + * error message in the trace that is shown when opening the trace file. * + * It can be wise to start with large values for these constants, + * unless you are very confident on these numbers. Then do a recording and + * check the actual usage by selecting View menu -> Trace Details -> + * Resource Usage -> Object Table. ******************************************************************************/ -#define NTask 15 -#define NISR 15 -#define NQueue 15 -#define NSemaphore 15 -#define NMutex 15 -#define NTimer 15 -#define NEventGroup 15 - -/* Maximum object name length for each class (includes zero termination) */ -#define NameLenTask 15 -#define NameLenISR 15 -#define NameLenQueue 15 -#define NameLenSemaphore 15 -#define NameLenMutex 15 -#define NameLenTimer 15 -#define NameLenEventGroup 15 +#define NTask 100 +#define NISR 60 +#define NQueue 60 +#define NSemaphore 60 +#define NMutex 60 +#define NTimer 200 +#define NEventGroup 60 /****************************************************************************** - * TRACE_DESCRIPTION + * INCLUDE_MEMMANG_EVENTS * - * Macro which should be defined as a string. + * Macro which should be defined as either zero (0) or one (1). * - * This string is stored in the trace and displayed in Tracealyzer. Can be - * used to store, e.g., system version or build date. This is also used to store - * internal error messages from the recorder, which if occurs overwrites the - * value defined here. This may be maximum 256 chars. - *****************************************************************************/ -#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program" - -/****************************************************************************** - * TRACE_DESCRIPTION_MAX_LENGTH + * This controls if malloc and free calls should be traced. Set this to zero to + * exclude malloc/free calls, or one (1) to include such events in the trace. * - * The maximum length (including zero termination) for the TRACE_DESCRIPTION - * string. Since this string also is used for internal error messages from the - * recorder do not make it too short, as this may truncate the error messages. - * Default is 80. - * Maximum allowed length is 256 - the trace will fail to load if longer. + * Default value is 1. *****************************************************************************/ -#define TRACE_DESCRIPTION_MAX_LENGTH 80 - +#define INCLUDE_MEMMANG_EVENTS 1 /****************************************************************************** - * TRACE_DATA_ALLOCATION - * - * This defines how to allocate the recorder data structure, i.e., using a - * static declaration or using a dynamic allocation in runtime (malloc). - * - * Should be one of these two options: - * - TRACE_DATA_ALLOCATION_STATIC (default) - * - TRACE_DATA_ALLOCATION_DYNAMIC + * INCLUDE_USER_EVENTS * - * Using static allocation has the benefits of compile-time errors if the buffer - * is too large (too large constants in trcConfig.h) and no need to call the - * initialization routine (xTraceInitTraceData). + * Macro which should be defined as either zero (0) or one (1). * - * Using dynamic allocation may give more flexibility in some cases. - *****************************************************************************/ - -#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC - - -/****************************************************************************** - * CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE - *****************************************************************************/ - -/****************************************************************************** - * USE_TRACE_ASSERT + * If this is zero (0) the code for creating User Events is excluded to + * reduce code size. User Events are application-generated events, like + * "printf" but for the trace log instead of console output. User Events are + * much faster than a printf and can therefore be used in timing critical code. + * See vTraceUserEvent() and vTracePrintF() in trcUser.h * - * Macro which should be defined as either zero (0) or one (1). - * Default is 0. + * Default value is 1. * - * If this is one (1), the TRACE_ASSERT macro will verify that a condition is - * true. If the condition is false, vTraceError() will be called. + * Note that User Events are only displayed in Professional Edition. *****************************************************************************/ -#define USE_TRACE_ASSERT 1 +#define INCLUDE_USER_EVENTS 1 -/****************************************************************************** - * INCLUDE_FLOAT_SUPPORT - * - * Macro which should be defined as either zero (0) or one (1). - * Default is 1. +/***************************************************************************** + * INCLUDE_ISR_TRACING * - * If this is zero (0), all references to floating point values are removed, - * in case floating point values are not supported by the platform used. - * Floating point values are only used in vTracePrintF and its subroutines, to - * store float (%f) or double (%lf) argments. + * Macro which should be defined as either zero (0) or one (1). * - * Note: vTracePrintF can still be used with integer and string arguments in - * either case. - *****************************************************************************/ -#define INCLUDE_FLOAT_SUPPORT 0 - -/****************************************************************************** - * INCLUDE_USER_EVENTS + * If this is zero (0), the code for recording Interrupt Service Routines is + * excluded to reduce code size. * - * Macro which should be defined as either zero (0) or one (1). - * Default is 1. + * Default value is 1. * - * If this is zero (0) the code for creating User Events is excluded to - * reduce code size. User Events are application-generated events, like - * "printf" but for the trace log instead of console output. User Events are - * much faster than a printf and can therefore be used in timing critical code. - * See vTraceUserEvent() and vTracePrintF() in trcUser.h - * - * Note that User Events are not displayed in FreeRTOS+Trace Free Edition. + * Note, if the kernel has no central interrupt dispatcher, recording ISRs + * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd + * in your interrupt handlers. *****************************************************************************/ -#define INCLUDE_USER_EVENTS 1 +#define INCLUDE_ISR_TRACING 1 /***************************************************************************** * INCLUDE_READY_EVENTS * - * Macro which should be defined as either zero (0) or one (1). - * Default is 1. + * Macro which should be defined as either zero (0) or one (1). * - * If this is zero (0), the code for recording Ready events is - * excluded. Note, this will make it impossible to calculate the correct - * response times. + * If one (1), events are recorded when tasks enter scheduling state "ready". + * This uses a lot of space in the event buffer, so excluding "ready events" + * will allow for longer traces. Including ready events however allows for + * showing the initial pending time before tasks enter the execution state, and + * for presenting accurate response times. + * + * Default value is 1. *****************************************************************************/ #define INCLUDE_READY_EVENTS 1 /***************************************************************************** * INCLUDE_NEW_TIME_EVENTS * - * Macro which should be defined as either zero (0) or one (1). - * Default is 0. + * Macro which should be defined as either zero (0) or one (1). * - * If this is zero (1), events will be generated whenever the os clock is + * If this is zero (1), events will be generated whenever the OS clock is * increased. + * + * Default value is 0. *****************************************************************************/ -#define INCLUDE_NEW_TIME_EVENTS 0 +#define INCLUDE_NEW_TIME_EVENTS 1 -/***************************************************************************** - * INCLUDE_ISR_TRACING +/****************************************************************************** + * INCLUDE_FLOAT_SUPPORT * - * Macro which should be defined as either zero (0) or one (1). - * Default is 1. + * Macro which should be defined as either zero (0) or one (1). * - * If this is zero (0), the code for recording Interrupt Service Routines is - * excluded to reduce code size. - * - * Note, if the kernel has no central interrupt dispatcher, recording ISRs - * require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd - * in your interrupt handlers. + * If this is zero (0), all references to floating point values are removed, + * in case floating point values are not supported by the platform used. + * Floating point values are only used in vTracePrintF and its subroutines, to + * store float (%f) or double (%lf) arguments. + * + * vTracePrintF can be used with integer and string arguments in either case. + * + * Default value is 1. *****************************************************************************/ -#define INCLUDE_ISR_TRACING 1 +#define INCLUDE_FLOAT_SUPPORT 0 /****************************************************************************** * INCLUDE_OBJECT_DELETE - * - * Macro which should be defined as either zero (0) or one (1). - * Default is 1. * - * This must be enabled (1) if tasks, queues or other - * traced kernel objects are deleted at runtime. If no deletes are made, this + * Macro which should be defined as either zero (0) or one (1). + * + * This must be enabled (1) if tasks, queues or other + * traced kernel objects are deleted at runtime. If no deletes are made, this * can be set to 0 in order to exclude the delete-handling code. + * + * Default value is 1. *****************************************************************************/ #define INCLUDE_OBJECT_DELETE 1 -/****************************************************************************** - * INCLUDE_MEMMANG_EVENTS - * - * Macro which should be defined as either zero (0) or one (1). - * Default is 1. +/******************************************************************************* + * SYMBOL_TABLE_SIZE * - * This controls if malloc and free calls should be traced. Set this to zero to - * exclude malloc/free calls from the tracing. - *****************************************************************************/ -#define INCLUDE_MEMMANG_EVENTS 1 + * Macro which should be defined as an integer value. + * + * This defines the capacity of the symbol table, in bytes. This symbol table + * stores User Events labels and names of deleted tasks, queues, or other kernel + * objects. If you don't use User Events or delete any kernel + * objects you set this to a very low value. The minimum recommended value is 4. + * A size of zero (0) is not allowed since a zero-sized array may result in a + * 32-bit pointer, i.e., using 4 bytes rather than 0. + * + * Default value is 800. + ******************************************************************************/ +#define SYMBOL_TABLE_SIZE 5000 + +#if (SYMBOL_TABLE_SIZE == 0) +#error "SYMBOL_TABLE_SIZE may not be zero!" +#endif /****************************************************************************** - * CONFIGURATION RELATED TO BEHAVIOR + * NameLenTask, NameLenQueue, ... + * + * Macros that specify the maximum lengths (number of characters) for names of + * kernel objects, such as tasks and queues. If longer names are used, they will + * be truncated when stored in the recorder. *****************************************************************************/ +#define NameLenTask 15 +#define NameLenISR 15 +#define NameLenQueue 15 +#define NameLenSemaphore 15 +#define NameLenMutex 15 +#define NameLenTimer 15 +#define NameLenEventGroup 15 /****************************************************************************** - * TRACE_RECORDER_STORE_MODE + * TRACE_DATA_ALLOCATION * - * Macro which should be defined as one of: - * - TRACE_STORE_MODE_RING_BUFFER - * - TRACE_STORE_MODE_STOP_WHEN_FULL - * Default is TRACE_STORE_MODE_RING_BUFFER. + * This defines how to allocate the recorder data structure, i.e., using a + * static declaration or using a dynamic allocation in runtime (malloc). * - * With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are - * stored in a ring buffer, i.e., where the oldest events are overwritten when - * the buffer becomes full. This allows you to get the last events leading up - * to an interesting state, e.g., an error, without having a large trace buffer - * for string the whole run since startup. In this mode, the recorder can run - * "forever" as the buffer never gets full, i.e., in the sense that it always - * has room for more events. - * - * To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the - * system using your debugger and then do a RAM dump, or to explicitly stop the - * recorder using vTraceStop() and then store/upload the trace data using a - * task that you need to provide yourself. The trace data is found in the struct - * RecorderData, initialized in trcBase.c. - * - * Note that, if you upload the trace using a RAM dump, i.e., when the system is - * halted on a breakpoint or by a debugger command, there is no need to stop the - * recorder first. - * - * When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is - * stopped when the buffer becomes full. When the recorder stops itself this way - * vTracePortEnd() is called which allows for custom actions, such as triggering - * a task that stores the trace buffer, i.e., in case taking a RAM dump - * using an on-chip debugger is not possible. In the Windows port, vTracePortEnd - * saves the trace to file directly, but this is not recommended in a real-time - * system since the scheduler is blocked during the processing of vTracePortEnd. + * Should be one of these two options: + * - TRACE_DATA_ALLOCATION_STATIC (default) + * - TRACE_DATA_ALLOCATION_DYNAMIC + * + * Using static allocation has the benefits of compile-time errors if the buffer + * is too large (too large constants in trcConfig.h) and no need to call the + * initialization routine (xTraceInitTraceData). + * + * Using dynamic allocation may give more flexibility in some cases. *****************************************************************************/ +#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC -#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER + + +/****************************************************************************** + *** ADVANCED SETTINGS ******************************************************** + ****************************************************************************** + * The remaining settings are not necessary to modify but allows for optimizing + * the recorder setup for your specific needs, e.g., to exclude events that you + * are not interested in, in order to get longer traces. + *****************************************************************************/ + +/****************************************************************************** +* HEAP_SIZE_BELOW_16M +* +* An integer constant that can be used to reduce the buffer usage of memory +* allocation events (malloc/free). This value should be 1 if the heap size is +* below 16 MB (2^24 byte), and you can live with reported addresses showing the +* lower 24 bits only. If 0, you get the full 32-bit addresses. +* +* Default value is 0. +******************************************************************************/ +#define HEAP_SIZE_BELOW_16M 0 /****************************************************************************** - * STOP_AFTER_N_EVENTS + * USE_LINKER_PRAGMA * - * Macro which should be defined as an integer value, or not defined. - * Default is -1 + * Macro which should be defined as an integer value, default is 0. * - * STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when - * RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when - * the specified number of events has been observed. This value can be larger - * than the buffer size, to allow for test of the "wrapping around" that occurs - * in ring buffer mode . A negative value (or no definition of this macro) - * disables this feature. - *****************************************************************************/ -#define STOP_AFTER_N_EVENTS -1 + * If this is 1, the header file "recorderdata_linker_pragma.h" is included just + * before the declaration of RecorderData (in trcBase.c), i.e., the trace data + * structure. This allows the user to specify a pragma with linker options. + * + * Example (for IAR Embedded Workbench and NXP LPC17xx): + * #pragma location="AHB_RAM_MEMORY" + * + * This example instructs the IAR linker to place RecorderData in another RAM + * bank, the AHB RAM. This can also be used for other compilers with a similar + * pragmas for linker options. + * + * Note that this only applies if using static allocation, see below. + ******************************************************************************/ +#define USE_LINKER_PRAGMA 0 /****************************************************************************** * USE_IMPLICIT_IFE_RULES * - * Macro which should be defined as either zero (0) or one (1). + * Macro which should be defined as either zero (0) or one (1). * Default is 1. * - * ### Instance Finish Events (IFE) ### - * - * For tasks with "infinite" main loops (non-terminating tasks), the concept - * of a task instance has no clear definition, it is an application-specific - * thing. Tracealyzer allows you to define Instance Finish Events (IFEs), - * which marks the point in a cyclic task when the "task instance" ends. - * The IFE is a blocking kernel call, typically in the main loop of a task - * which typically reads a message queue, waits for a semaphore or performs - * an explicit delay. - * - * If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h) - * will define what kernel calls are considered by default to be IFEs. - * - * However, Implicit IFEs only applies to blocking kernel calls. If a - * service reads a message without blocking, it does not create a new - * instance since no blocking occurred. - * - * Moreover, the actual IFE might sometimes be another blocking call. We - * therefore allow for user-defined Explicit IFEs by calling - * - * vTraceTaskInstanceIsFinished() - * - * right before the kernel call considered as IFE. This does not create an - * additional event but instead stores the service code and object handle - * of the IFE call as properties of the task. - * - * If using Explicit IFEs and the task also calls an Implicit IFE, this may - * result in additional incorrect task instances. - * This is solved by disabling the Implicit IFEs for the task, by adding - * a call to - * - * vTraceTaskSkipDefaultInstanceFinishedEvents() - * - * in the very beginning of that task. This allows you to combine Explicit IFEs - * for some tasks with Implicit IFEs for the rest of the tasks, if - * USE_IMPLICIT_IFE_RULES is 1. - * - * By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled - * for all tasks. Tasks will then be considered to have a single instance only, - * covering all execution fragments, unless you define an explicit IFE in each - * task by calling vTraceTaskInstanceIsFinished before the blocking call. + * Tracealyzer groups the events into actor instances, based on context-switches + * and a definition of "Instance Finish Events", or IFEs. These are kernel calls + * considered to be the last event in a task instance. Some kernel calls are + * considered IFEs by default (e.g., delay functions), but it is also possible + * to specify this individually for each task (see vTraceTaskInstanceFinish). + * + * If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which + * gives a "typical" grouping of events into instances. You can combine this + * with calls to vTraceTaskInstanceFinish for specific tasks. + * + * If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all + * events withing each task is then shown as a single instance, unless you call + * vTraceTaskInstanceFinish() at suitable locations to mark the IFEs. *****************************************************************************/ #define USE_IMPLICIT_IFE_RULES 1 - /****************************************************************************** * USE_16BIT_OBJECT_HANDLES * * Macro which should be defined as either zero (0) or one (1). - * Default is 0. * - * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel + * If set to 0 (zero), the recorder uses 8-bit handles to identify kernel * objects such as tasks and queues. This limits the supported number of * concurrently active objects to 255 of each type (object class). * - * If set to 1 (one), the recorder uses 16-bit handles to identify kernel + * If set to 1 (one), the recorder uses 16-bit handles to identify kernel * objects such as tasks and queues. This limits the supported number of * concurrent objects to 65535 of each type (object class). However, since the * object property table is limited to 64 KB, the practical limit is about - * 3000 objects in total. - * - * NOTE: An object with a high ID (> 255) will generate an extra event - * (= 4 byte) in the event buffer. - * - * NOTE: Some internal tables in the recorder gets larger when using 16-bit - * handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object - *, i.e., task, queue, semaphore, mutex, etc. + * 3000 objects in total. + * + * Default is 0. + * + * NOTE: An object with handle above 255 will use an extra 4-byte record in + * the event buffer whenever referenced. Moreover, some internal tables in the + * recorder gets larger when using 16-bit handles. The additional RAM usage is + * 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc. *****************************************************************************/ #define USE_16BIT_OBJECT_HANDLES 0 -/****** Port Name ******************** Code ** Official ** OS Platform ****** -* PORT_APPLICATION_DEFINED -2 - - -* PORT_NOT_SET -1 - - -* PORT_HWIndependent 0 Yes Any -* PORT_Win32 1 Yes FreeRTOS Win32 -* PORT_Atmel_AT91SAM7 2 No Any -* PORT_Atmel_UC3A0 3 No Any -* PORT_ARM_CortexM 4 Yes Any -* PORT_Renesas_RX600 5 Yes Any -* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any -* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any -* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any -* PORT_MICROCHIP_PIC32 9 No Any -* PORT_XILINX_PPC405 10 No FreeRTOS -* PORT_XILINX_PPC440 11 No FreeRTOS -* PORT_XILINX_MICROBLAZE 12 No Any -* PORT_NXP_LPC210X 13 No Any -*****************************************************************************/ -#define SELECTED_PORT PORT_Win32 - -#if (SELECTED_PORT == PORT_NOT_SET) -#error "You need to define SELECTED_PORT here!" -#endif - /****************************************************************************** -* USE_PRIMASK_CS (for Cortex M devices only) -* -* An integer constant that selects between two options for the critical -* sections of the recorder library. + * USE_TRACE_ASSERT * -* 0: The default FreeRTOS critical section (BASEPRI) - default setting -* 1: Always disable ALL interrupts (using PRIMASK) + * Macro which should be defined as either zero (0) or one (1). + * Default is 1. * -* Option 0 uses the standard FreeRTOS macros for critical sections. -* However, on Cortex-M devices they only disable interrupts with priorities -* below a certain configurable level, while higher priority ISRs remain active. -* Such high-priority ISRs may not use the recorder functions in this mode. -* -* Option 1 allows you to safely call the recorder from any ISR, independent of -* the interrupt priority. This mode may however cause higher IRQ latencies -* (some microseconds) since ALL configurable interrupts are disabled during -* the recorder's critical sections in this mode, using the PRIMASK register. + * If this is one (1), the TRACE_ASSERT macro will verify that a condition is + * true. If the condition is false, vTraceError() will be called. + * This is used on several places in the recorder code for sanity checks on + * parameters. Can be switched off to reduce CPU usage of the tracing. + *****************************************************************************/ +#define USE_TRACE_ASSERT 1 + +/******************************************************************************* + * USE_SEPARATE_USER_EVENT_BUFFER + * + * Macro which should be defined as an integer value. + * Default is zero (0). + * + * This enables and disables the use of the separate user event buffer. Using + * this separate buffer has the benefit of not overwriting the user events with + * kernel events (usually generated at a much higher rate), i.e., when using + * ring-buffer mode. + * + * Note: When using the separate user event buffer, you may get an artificial + * task instance named "Unknown actor". This is added as a placeholder when the + * user event history is longer than the task scheduling history. ******************************************************************************/ -#define USE_PRIMASK_CS 0 +#define USE_SEPARATE_USER_EVENT_BUFFER 0 -/****************************************************************************** -* HEAP_SIZE_BELOW_16M -* -* An integer constant that can be used to reduce the buffer usage of memory -* allocation events (malloc/free). This value should be 1 if the heap size is -* below 16 MB (2^24 byte), and you can live with addresses truncated to the -* lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses. -******************************************************************************/ -#define HEAP_SIZE_BELOW_16M 0 +/******************************************************************************* + * USER_EVENT_BUFFER_SIZE + * + * Macro which should be defined as an integer value. + * + * This defines the capacity of the user event buffer, in number of slots. + * A single user event can use between 1 and X slots, depending on the data. + * + * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1. + ******************************************************************************/ +#define USER_EVENT_BUFFER_SIZE 10 + +/******************************************************************************* + * USER_EVENT_CHANNELS + * + * Macro which should be defined as an integer value. + * + * This defines the number of allowed user event channels. + * + * Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1. + ******************************************************************************/ +#define CHANNEL_FORMAT_PAIRS 32 #endif diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj index e36a30f88..89d40da0a 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj @@ -151,14 +151,12 @@ - - diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj.filters index 42ab9730b..cb0cf648d 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj.filters @@ -103,9 +103,6 @@ FreeRTOS+\FreeRTOS+Trace\Include - - FreeRTOS+\FreeRTOS+Trace\Include - FreeRTOS+\FreeRTOS+Trace\Include @@ -115,8 +112,5 @@ FreeRTOS+\FreeRTOS+Trace\Include - - Demo App Source\Trace Recorder Configuration - \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/.cproject b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/.cproject index 8107b25bf..ed0774e30 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/.cproject +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/.cproject @@ -5,14 +5,14 @@ - - + + @@ -78,6 +78,7 @@