Update #169 -- Percepio Tracealyzer Recorder v4.3.11 (#201)

* * Pull Request for Percepio Tracealyzer Recorder v4.3.11

* Update Tracealyzer demo config file.

Co-authored-by: Erik Tamlin <erik.tamlin@percepio.com>
pull/195/head
Ming Yue 5 years ago committed by GitHub
parent 70dcbe4527
commit d248555de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -98,22 +98,32 @@ extern "C" {
* TRC_RECORDER_MODE_STREAMING
******************************************************************************/
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
/******************************************************************************
* TRC_CFG_FREERTOS_VERSION
*
* Specify what version of FreeRTOS that is used (don't change unless using the
* trace recorder library with an older version of FreeRTOS).
*
* TRC_FREERTOS_VERSION_7_3 If using FreeRTOS v7.3.x
* TRC_FREERTOS_VERSION_7_4 If using FreeRTOS v7.4.x
* TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0
* TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X
* TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0
* TRC_FREERTOS_VERSION_9_0_1 If using FreeRTOS v9.0.1
* TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2
* TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0 or later
* TRC_FREERTOS_VERSION_7_3_X If using FreeRTOS v7.3.X
* TRC_FREERTOS_VERSION_7_4_X If using FreeRTOS v7.4.X
* TRC_FREERTOS_VERSION_7_5_X If using FreeRTOS v7.5.X
* TRC_FREERTOS_VERSION_7_6_X If using FreeRTOS v7.6.X
* TRC_FREERTOS_VERSION_8_X_X If using FreeRTOS v8.X.X
* TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0
* TRC_FREERTOS_VERSION_9_0_1 If using FreeRTOS v9.0.1
* TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2
* TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0
* TRC_FREERTOS_VERSION_10_0_1 If using FreeRTOS v10.0.1
* TRC_FREERTOS_VERSION_10_1_0 If using FreeRTOS v10.1.0
* TRC_FREERTOS_VERSION_10_1_1 If using FreeRTOS v10.1.1
* TRC_FREERTOS_VERSION_10_2_0 If using FreeRTOS v10.2.0
* TRC_FREERTOS_VERSION_10_2_1 If using FreeRTOS v10.2.1
* TRC_FREERTOS_VERSION_10_3_0 If using FreeRTOS v10.3.0
* TRC_FREERTOS_VERSION_10_3_1 If using FreeRTOS v10.3.1
* TRC_FREERTOS_VERSION_10_4_0 If using FreeRTOS v10.4.0 or later
*****************************************************************************/
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_0_0
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_3_1
/*******************************************************************************
* TRC_CFG_SCHEDULING_ONLY
@ -144,13 +154,13 @@ extern "C" {
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), all code related to User Events is excluded in order
* If this is zero (0), all code related to User Events is excluded in order
* to reduce code size. Any attempts of storing User Events are then silently
* ignored.
*
* User Events are application-generated events, like "printf" but for the
* trace log, generated using vTracePrint and vTracePrintF.
* The formatting is done on host-side, by Tracealyzer. User Events are
* User Events are application-generated events, like "printf" but for the
* trace log, generated using vTracePrint and vTracePrintF.
* The formatting is done on host-side, by Tracealyzer. User Events are
* therefore much faster than a console printf and can often be used
* in timing critical code without problems.
*
@ -170,7 +180,14 @@ extern "C" {
* 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, in order to reduce code size.
* excluded, in order to reduce code size. This means that any calls to
* vTraceStoreISRBegin/vTraceStoreISREnd will be ignored.
* This does not completely disable ISR tracing, in cases where an ISR is
* calling a traced kernel service. These events will still be recorded and
* show up in anonymous ISR instances in Tracealyzer, with names such as
* "ISR sending to <queue name>".
* To disable such tracing, please refer to vTraceSetFilterGroup and
* vTraceSetFilterMask.
*
* Default value is 1.
*
@ -234,7 +251,7 @@ extern "C" {
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any "pending function call"
* If this is zero (0), the trace will exclude any "pending function call"
* events, such as xTimerPendFunctionCall().
*
* Default value is 0 since dependent on timers.c
@ -253,6 +270,90 @@ extern "C" {
******************************************************************************/
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 0
/******************************************************************************
* TRC_CFG_ENABLE_STACK_MONITOR
*
* If enabled (1), the recorder periodically reports the unused stack space of
* all active tasks.
* The stack monitoring runs in the Tracealyzer Control task, TzCtrl. This task
* is always created by the recorder when in streaming mode.
* In snapshot mode, the TzCtrl task is only used for stack monitoring and is
* not created unless this is enabled.
*****************************************************************************/
#define TRC_CFG_ENABLE_STACK_MONITOR 0
/******************************************************************************
* TRC_CFG_STACK_MONITOR_MAX_TASKS
*
* Macro which should be defined as a non-zero integer value.
*
* This controls how many tasks that can be monitored by the stack monitor.
* If this is too small, some tasks will be excluded and a warning is shown.
*
* Default value is 10.
*****************************************************************************/
#define TRC_CFG_STACK_MONITOR_MAX_TASKS 10
/******************************************************************************
* TRC_CFG_STACK_MONITOR_MAX_REPORTS
*
* Macro which should be defined as a non-zero integer value.
*
* This defines how many tasks that will be subject to stack usage analysis for
* each execution of the Tracealyzer Control task (TzCtrl). Note that the stack
* monitoring cycles between the tasks, so this does not affect WHICH tasks that
* are monitored, but HOW OFTEN each task stack is analyzed.
*
* This setting can be combined with TRC_CFG_CTRL_TASK_DELAY to tune the
* frequency of the stack monitoring. This is motivated since the stack analysis
* can take some time to execute.
* However, note that the stack analysis runs in a separate task (TzCtrl) that
* can be executed on low priority. This way, you can avoid that the stack
* analysis disturbs any time-sensitive tasks.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_STACK_MONITOR_MAX_REPORTS 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_PRIORITY
*
* The scheduling priority of the Tracealyzer Control (TzCtrl) task.
*
* In streaming mode, TzCtrl is used to receive start/stop commands from
* Tracealyzer and in some cases also to transmit the trace data (for stream
* ports that uses the internal buffer, like TCP/IP). For such stream ports,
* make sure the TzCtrl priority is high enough to ensure reliable periodic
* execution and transfer of the data, but low enough to avoid disturbing any
* time-sensitive functions.
*
* In Snapshot mode, TzCtrl is only used for the stack usage monitoring and is
* not created if stack monitoring is disabled. TRC_CFG_CTRL_TASK_PRIORITY should
* be low, to avoid disturbing any time-sensitive tasks.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_PRIORITY 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_DELAY
*
* The delay between loops of the TzCtrl task (see TRC_CFG_CTRL_TASK_PRIORITY),
* which affects the frequency of the stack monitoring.
*
* In streaming mode, this also affects the trace data transfer if you are using
* a stream port leveraging the internal buffer (like TCP/IP). A shorter delay
* increases the CPU load of TzCtrl somewhat, but may improve the performance of
* of the trace streaming, especially if the trace buffer is small.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_DELAY 10
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_STACK_SIZE
*
* The stack size of the Tracealyzer Control (TzCtrl) task.
* See TRC_CFG_CTRL_TASK_PRIORITY for further information about TzCtrl.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE * 2)
/*******************************************************************************
* Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
*
@ -286,6 +387,16 @@ extern "C" {
*****************************************************************************/
#define TRC_CFG_MAX_ISR_NESTING 8
/******************************************************************************
* TRC_CFG_ACKNOWLEDGE_QUEUE_SET_SEND
*
* When using FreeRTOS v10.3.0 or v10.3.1, please make sure that the trace
* point in prvNotifyQueueSetContainer() in queue.c is renamed from
* traceQUEUE_SEND to traceQUEUE_SET_SEND in order to tell them apart from
* other traceQUEUE_SEND trace points. Then set this to TRC_ACKNOWLEDGED.
*****************************************************************************/
#define TRC_CFG_ACKNOWLEDGE_QUEUE_SET_SEND TRC_ACKNOWLEDGED /* 0 or TRC_ACKNOWLEDGED */
/* Specific configuration, depending on Streaming/Snapshot mode */
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
#include "trcSnapshotConfig.h"

@ -0,0 +1,170 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.2.0
* Percepio AB, www.percepio.com
*
* aws_secure_socket.tzext.h
*
* An example of a Tracealyzer extension for tracing API calls, in this case
* for tracing selected functions in Amazon FreeRTOS/aws_secure_sockets.
* See trcExtensions.h for information on how to use this.
*
* To create your own extension, first make sure to read the documentation
* in trcExtensions.h. Then, to create an extension header file like this
* one, you need to provide:
*
* - Extension Definitions - name and event codes of the extensions.
*
* - Trace Wrappers - calls the original function and traces the event.
*
* - Function Redefinitions - changes the function calls to the trace wrappers.
*
* See the below comments for details about these definitions. Note that you
* also need a matching .xml file for Tracealyzer to understand the data.
* See trcExtensions.h for further information.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef _AWS_SECURE_SOCKETS_TZEXT_H
#define _AWS_SECURE_SOCKETS_TZEXT_H
/***** Extension Definitions *****/
/******************************************************************************
* <EXTENSIONPREFIX>_NAME
* The name of the extension as a string constant. This name is used by the
* Tracealyzer host application to find the right XML file for interpreting
* the events. Assuming the extension name is "aws_secure_sockets", Tracealyzer
* will look for an XML file named "aws_secure_sockets-<VERSION>.xml", first in
* the folder of the current trace file, next in the Tracealyzer 4/cfg folder.
* For the VERSION part, see the TRC_EXT_<ExtName>_VERSION macros below.
*
* Note: The extension name displayed in Tracealyzer is defined in the XML file
* in the EventGroup element (e.g. <EventGroup name="SOCKETS">)
*
*****************************************************************************/
#define TRC_EXT_SOCKETS_NAME "aws_secure_sockets"
/******************************************************************************
* <EXTENSIONPREFIX>_VERSION_MAJOR
* <EXTENSIONPREFIX>_VERSION_MINOR
* <EXTENSIONPREFIX>_VERSION_PATCH
*
* The version code of the extension (MAJOR.MINOR.PATCH)
*
* If you increment the version code when modifying an extension, you can still
* show old traces recorded using an earlier version of the extension.
*
* Assuming the extension name is "aws_secure_sockets", and the below version
* codes are 1 (MAJOR), 2 (MINOR), 3 (PATCH), Tracealyzer will assume the
* corresponding XML file is named "aws_secure_sockets-v1.2.3.xml". So if then
* view a trace recorded with extension version 1.2.2, those traces will look
* for "aws_secure_sockets-v1.2.2.xml" instead.
*
* Note that major and minor are stored as 8 bit values, while patch is stored
* using 16 bits. They are treated as unsigned integers, so the maximum values
* are 256, 256 and 65535.
*****************************************************************************/
#define TRC_EXT_SOCKETS_VERSION_MAJOR 1
#define TRC_EXT_SOCKETS_VERSION_MINOR 0
#define TRC_EXT_SOCKETS_VERSION_PATCH 0
/******************************************************************************
* <EXTENSIONPREFIX>_<EVENTCODE>
* The event codes used in the trace wrapper functions. Important that these
* are relative to <PREFIX>_FIRST.
*****************************************************************************/
#define EVENTCODE_SOCKETS_Connect (TRC_EXT_BASECODE + 0)
#define EVENTCODE_SOCKETS_Send (TRC_EXT_BASECODE + 1)
#define EVENTCODE_SOCKETS_Recv (TRC_EXT_BASECODE + 2)
/******************************************************************************
* <EXTENSIONPREFIX>_COUNT
* The number of event codes used by this extension. Should be at least 1.
* Tracealyzer allows for events codes up to 4095.
*****************************************************************************/
#define TRC_EXT_SOCKETS_COUNT 2
/***** Trace Wrappers *****/
#include "aws_secure_sockets.h" /* Including the original header file, so that custom data types are understood. */
static inline int32_t SOCKETS_Connect__trace( Socket_t xSocket, SocketsSockaddr_t * pxAddress, Socklen_t xAddressLength )
{
int32_t ret = SOCKETS_Connect(xSocket, pxAddress, xAddressLength);
// Note: The host-side xml file assumes that ret == 0 means OK, otherwise timeout/error.
prvTraceStoreEvent3(EVENTCODE_SOCKETS_Connect, (uint32_t)xSocket, (uint32_t)pxAddress->ulAddress, (uint32_t)ret);
return ret;
}
static inline int32_t SOCKETS_Send__trace( Socket_t xSocket, const void * pvBuffer, size_t xDataLength, uint32_t ulFlags )
{
int32_t ret = SOCKETS_Send(xSocket, pvBuffer, xDataLength, ulFlags);
// Note: The host-side xml file assumes that ret == 0 means OK, otherwise timeout/error.
prvTraceStoreEvent2(EVENTCODE_SOCKETS_Send, (uint32_t)xSocket, (uint32_t)ret);
return ret;
}
static inline int32_t SOCKETS_Recv__trace( Socket_t xSocket, void * pvBuffer, size_t xBufferLength, uint32_t ulFlags )
{
int32_t ret = SOCKETS_Recv(xSocket, pvBuffer, xBufferLength, ulFlags);
// Note: The host-side xml file assumes that ret == 0 means OK, otherwise timeout/error.
prvTraceStoreEvent2(EVENTCODE_SOCKETS_Recv, (uint32_t)xSocket, (uint32_t)ret);
return ret;
}
/***** Function Redefinitions *****/
#define SOCKETS_Connect SOCKETS_Connect__trace
#define SOCKETS_Send SOCKETS_Send__trace
#define SOCKETS_Recv SOCKETS_Recv__trace
#endif /* _AWS_SECURE_SOCKETS_TZEXT_H */

@ -0,0 +1,169 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.2.0
* Percepio AB, www.percepio.com
*
* aws_secure_socket.tzext.h
*
* An example of a Tracealyzer extension for tracing API calls, in this case
* for tracing selected functions in Amazon FreeRTOS/aws_wifi.
* See trcExtensions.h for information on how to use this.
*
* To create your own extension, first make sure to read the documentation
* in trcExtensions.h. Then, to create an extension header file like this
* one, you need to provide:
*
* - Extension Definitions - name and event codes of the extensions.
*
* - Trace Wrappers - calls the original function and traces the event.
*
* - Function Redefinitions - changes the function calls to the trace wrappers.
*
* See the below comments for details about these definitions. Note that you
* also need a matching .xml file for Tracealyzer to understand the data.
* See trcExtensions.h for further information.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef _AWS_WIFI_TZEXT_H
#define _AWS_WIFI_TZEXT_H
/***** Extension Definitions (must use the same prefix!) *****/
/******************************************************************************
* <EXTENSIONPREFIX>_NAME
* The name of the extension as a string constant. This name is used by the
* Tracealyzer host application to find the right XML file for interpreting
* the events. Assuming the extension name is "aws_secure_sockets", Tracealyzer
* will look for an XML file named "aws_secure_sockets-<VERSION>.xml", first in
* the folder of the current trace file, next in the Tracealyzer 4/cfg folder.
* For the VERSION part, see the TRC_EXT_<ExtName>_VERSION macros below.
*
* Note: The extension name displayed in Tracealyzer is defined in the XML file
* in the EventGroup element (e.g. <EventGroup name="SOCKETS">)
*
*****************************************************************************/
#define TRC_EXT_WIFI_NAME "aws_wifi"
/******************************************************************************
* <EXTENSIONPREFIX>_VERSION_MAJOR
* <EXTENSIONPREFIX>_VERSION_MINOR
* <EXTENSIONPREFIX>_VERSION_PATCH
*
* The version code of the extension (MAJOR.MINOR.PATCH)
*
* If you increment the version code when modifying an extension, you can still
* show old traces recorded using an earlier version of the extension.
*
* Assuming the extension name is "aws_secure_sockets", and the below version
* codes are 1 (MAJOR), 2 (MINOR), 3 (PATCH), Tracealyzer will assume the
* corresponding XML file is named "aws_secure_sockets-v1.2.3.xml". So if then
* view a trace recorded with extension version 1.2.2, those traces will look
* for "aws_secure_sockets-v1.2.2.xml" instead.
*
* Note that major and minor are stored as 8 bit values, while patch is stored
* using 16 bits. They are treated as unsigned integers, so the maximum values
* are 256, 256 and 65535.
*****************************************************************************/
#define TRC_EXT_WIFI_VERSION_MAJOR 1
#define TRC_EXT_WIFI_VERSION_MINOR 0
#define TRC_EXT_WIFI_VERSION_PATCH 0
/******************************************************************************
* <EXTENSIONPREFIX>_<EVENTCODE>
* The event codes used in the trace wrapper functions. Important that these
* are relative to <PREFIX>_FIRST.
*****************************************************************************/
#define EVENTCODE_WIFI_On (TRC_EXT_BASECODE + 0)
#define EVENTCODE_WIFI_Off (TRC_EXT_BASECODE + 1)
#define EVENTCODE_WIFI_ConnectAP (TRC_EXT_BASECODE + 2)
/******************************************************************************
* <EXTENSIONPREFIX>_COUNT
* The number of event codes used by this extension. Should be at least 1.
* Tracealyzer allows for events codes up to 4095.
*****************************************************************************/
#define TRC_EXT_WIFI_COUNT 3
/***** Trace Wrappers *****/
#include "aws_wifi.h" /* Including the original header file, so that custom data types are understood. */
static inline WIFIReturnCode_t WIFI_On__trace( void )
{
WIFIReturnCode_t ret = WIFI_On();
// Note: The host-side xml file assumes that ret == 0 means OK, otherwise timeout/error.
prvTraceStoreEvent1(EVENTCODE_WIFI_On, (uint32_t)ret);
return ret;
}
static inline WIFIReturnCode_t WIFI_Off__trace( void )
{
WIFIReturnCode_t ret = WIFI_Off();
// Note: The host-side xml file assumes that ret == 0 means OK, otherwise timeout/error.
prvTraceStoreEvent1(EVENTCODE_WIFI_Off, (uint32_t)ret);
return ret;
}
static inline WIFIReturnCode_t WIFI_ConnectAP__trace( const WIFINetworkParams_t * const pxNetworkParams )
{
WIFIReturnCode_t ret = WIFI_ConnectAP(pxNetworkParams);
// Note: The host-side xml file assumes that ret == 0 means OK, otherwise timeout/error.
prvTraceStoreStringEvent(2, EVENTCODE_WIFI_ConnectAP, pxNetworkParams->pcSSID, pxNetworkParams->xSecurity, ret);
return ret;
}
/***** Function Redefinitions *****/
#define WIFI_On WIFI_On__trace
#define WIFI_Off WIFI_Off__trace
#define WIFI_ConnectAP WIFI_ConnectAP__trace
#endif /* _AWS_SECURE_SOCKETS2_TZEXT_H */

@ -0,0 +1,422 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcExtensions.h
*
* The extension interface of the recorder library, allowing for tracing
* function calls to any API without modifications. All that is needed is a
* single #include line in the .c files calling the API.
*
* This can be used to provide more detailed traces, including calls to e.g.
* middleware, drivers or important APIs in your application code. This can be
* applied selectively to specified functions and may include selected
* parameters as well as the return value.
*
* Unlike the "User Event" concept, an extension is intended for systematic use
* and can benefit from all powerful features in Tracealyzer via host-side XML
* files that configure how Tracealyzer should interpret each event.
*
* Extensions are self-contained and easy to integrate, which makes them
* convenient for distribution. Software vendors can thus develop such
* extensions and provide trace support for their users.
*
* An extension consists of two files:
*
* - An extension header file (e.g. "api.tzext.h") - this defines how to
* trace the API function calls.
*
* - An XML file for the Tracealyzer application (e.g. "api-v1.0.0.xml").
* This needs to match the tracing setup in your extension header file.
*
*
* USAGE
*
* This description assumes you already have the extension files for the APIs you
* like to trace. To include them, follow these steps:
*
* 1. Update trcExtensions.h with respect to:
*
* 1.1. TRC_CFG_EXTENSION_COUNT: The number of extensions to enable (max 4).
*
* 1.2. The name(s) of the extension header file(s) to include.
*
* 1.3. The Extension Prefix, i.e., the first part of the definition names
* used in each header file.
*
* 2. Add #include "trcExtensions.h" in all .c files calling the API:
*
* #include ...
* #include "api.h" // The API you like to trace
* #include ...
* #include "trcExtensions.h"
*
* We recommend to put this as the LAST #include statement.
*
* HOWEVER, don't include "trcExtensions.h" in the .c files containing the
* functions you intend to trace. The compiler will then complain about
* multiple definitions of the trace wrapper function.
*
* 3. Copy the extension XML file to the "Tracealyzer 4/cfg" folder.
* On Windows this is typically
*
* C:\Program Files\Percepio\Tracealyzer 4\cfg
*
*
* HOW IT WORKS
*
* By including "trcExtensions.h" in your .c files, the preprocessor will
* redefine all calls of the functions specified in the extension header file.
* Calls to those functions will now instead call the "trace wrapper functions"
* defined in the extension header. The trace wrapper functions then call the
* original function as well as the trace recorder library.
*
* call foo(a) ----> foo__trace(a) -----> foo(a)
* -----> trace recorder library
*
* Note that the trace wrapper function should have the same declaration as the
* original function (apart from the name) and also returns any return value
* back to the original caller. So functionally this is completely transparent.
*
* This works also for calls via function pointers, as the assignments of the
* function pointers will be affected, so the function pointers will point to
* the trace wrapper function.
*
* It even works when calling binary libraries, since only the calling code
* is modified, not the API itself.
*
* Extensions include a version code (Major.Minor.Patch), which is registered
* in the trace and also part of the XML file name. This way, Tracealyzer
* automatically finds the matching XML file, even if you open a old trace
* recorded using a earlier version of the extension (e.g. if the API has
* changed).
*
* LIMITATIONS
*
* The main limitation of this automatic approach is that it only allows for
* tracing call between different .c files. Moreover, you can't trace multiple
* APIs with calls between them. This since the calling file must include
* trcExtensions.h, while the called file must NOT include this.
*
* It is however possible to get around this limitation. You need to add
* #undef lines for each affected function to locally disable the redefinition,
* and modify each function call to instead call the trace wrapper function.
*
* #include "trcExtensions.h"
* #undef foo
* ...
* void foo(int a)
* {
* ...
* }
* ...
* foo__trace(a); // in another function - call foo and trace it
*
* These changes can remain in your code if you like, as the trace wrappers
* works even if the recorder is disabled.
*
* MAKING YOUR OWN EXTENSIONS
*
* Examples are found in the extensions directory. We recommend that you start
* by looking at aws_secure_sockets files (.h and .xml) that provides a basic
* example. The aws_wifi files provides a more advanced example.
* The header files include detailed documentation about how to design them,
*
* The XML files should have the same name as specified in the NAME property
* in the header file, followed by the version, i.e.
*
* <NAME>-v<VERSION_MAJOR>.<<VERSION_MINOR>.<VERSION_PATCH>.xml
*
* Documentation for the XML file format is not yet available, but is under
* development.
*
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRCEXTENSIONS_H_
#define TRCEXTENSIONS_H_
#include "trcRecorder.h"
/******************************************************************************
* TRC_CFG_EXTENSION_COUNT
*
* Defines the number of extensions included in the trace. Maximum 4 extensions
* can be included.
*
* Default value is 0 (extension support disabled).
*
*****************************************************************************/
#define TRC_CFG_EXTENSION_COUNT 0
/******************************************************************************
* TRC_CFG_EXT_MAX_NAME_LEN
*
* Defines the maximum length of extension name(s), i.e. the <EXTENSION>_NAME
* macro(s) in trcExtensions.h.
*
* This value should will by rounded up to the nearest multiple of 4, and must
* not be zero. To disable extension support, see TRC_CFG_EXTENSION_COUNT.
*
* It is important that this setting is large enough so extension names are
* not truncated, otherwise the host-side Tracealyzer application won't be able
* to find the corresponding XML file.
*
* You may adjust this to reduce memory usage, or increase it to allow for
* longer extension names.
*
* Default value is 20.
*****************************************************************************/
#define TRC_CFG_EXT_MAX_NAME_LEN 20
/******************************************************************************
* TRC_EXTENSION_EVENTCODE_BASE
*
* The first event code used for the Extension system. This will be the first
* event code of the first extension, and other event codes are relative to
* this. This can be modified but this is normally not required.
*****************************************************************************/
#define TRC_EXTENSION_EVENTCODE_BASE 256
/*** Included Extensions ******************************************************
*
* Below you specify what extensions to include. For each
* extension you must define:
*
* - HEADER: The header file that defines the trace extension.
*
* - EXTENSION_PREFIX: The first part of the HEADER definition names.
*
*****************************************************************************/
#define TRC_EXT1_HEADER "aws_secure_sockets.tzext.h"
#define TRC_EXT1_PREFIX TRC_EXT_SOCKETS
#define TRC_EXT2_HEADER "aws_wifi.tzext.h"
#define TRC_EXT2_PREFIX TRC_EXT_WIFI
#define TRC_EXT3_HEADER "Here you specify the header file for Extensions 3."
#define TRC_EXT3_PREFIX NOT_DEFINED
#define TRC_EXT4_HEADER "Here you specify the header file for Extensions 4."
#define TRC_EXT4_PREFIX NOT_DEFINED
/*** Don't modify below ******************************************************/
#define ROUNDUP4(n) (4*((n+3)/4))
typedef struct{
uint16_t firstEventCode;
uint16_t lastEventCode;
uint16_t patchVersion;
uint8_t minorVersion;
uint8_t majorVersion;
char name[ROUNDUP4(TRC_CFG_EXT_MAX_NAME_LEN)];
} PSFExtensionEntryType;
typedef struct{
uint16_t extensionEntryCount;
uint16_t baseEventCode;
#if (TRC_CFG_EXTENSION_COUNT > 0)
uint8_t extensionEntryNameMaxLength;
uint8_t extensionEntrySize;
PSFExtensionEntryType extension[TRC_CFG_EXTENSION_COUNT];
#endif
} PSFExtensionInfoType;
extern PSFExtensionInfoType PSFExtensionInfo;
#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__)
#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
#define TRC_EXT_BASECODE (PSFExtensionInfo.extension[TRC_EXT_NUMBER-1].firstEventCode)
#if (TRC_CFG_EXTENSION_COUNT >= 1)
#ifdef TRC_EXT1_HEADER
#define TRC_EXT_NUMBER 1
#include TRC_EXT1_HEADER
#undef TRC_EXT_NUMBER
#endif
#endif
#if (TRC_CFG_EXTENSION_COUNT >= 2)
#ifdef TRC_EXT2_HEADER
#define TRC_EXT_NUMBER 2
#include TRC_EXT2_HEADER
#undef TRC_EXT_NUMBER
#endif
#endif
#if (TRC_CFG_EXTENSION_COUNT >= 3)
#ifdef TRC_EXT3_HEADER
#define TRC_EXT_NUMBER 3
#include TRC_EXT3_HEADER
#undef TRC_EXT_NUMBER
#endif
#endif
#if (TRC_CFG_EXTENSION_COUNT == 4)
#ifdef TRC_EXT3_HEADER
#define TRC_EXT_NUMBER 4
#include TRC_EXT4_HEADER
#undef TRC_EXT_NUMBER
#endif
#endif
#define TRC_EXT1_COUNT CAT(TRC_EXT1_PREFIX, _COUNT)
#define TRC_EXT2_COUNT CAT(TRC_EXT2_PREFIX, _COUNT)
#define TRC_EXT3_COUNT CAT(TRC_EXT3_PREFIX, _COUNT)
#define TRC_EXT4_COUNT CAT(TRC_EXT4_PREFIX, _COUNT)
#define TRC_EXT1_NAME CAT(TRC_EXT1_PREFIX, _NAME)
#define TRC_EXT2_NAME CAT(TRC_EXT2_PREFIX, _NAME)
#define TRC_EXT3_NAME CAT(TRC_EXT3_PREFIX, _NAME)
#define TRC_EXT4_NAME CAT(TRC_EXT4_PREFIX, _NAME)
#define TRC_EXT1_VERSION_MAJOR CAT(TRC_EXT1_PREFIX, _VERSION_MAJOR)
#define TRC_EXT2_VERSION_MAJOR CAT(TRC_EXT2_PREFIX, _VERSION_MAJOR)
#define TRC_EXT3_VERSION_MAJOR CAT(TRC_EXT3_PREFIX, _VERSION_MAJOR)
#define TRC_EXT4_VERSION_MAJOR CAT(TRC_EXT4_PREFIX, _VERSION_MAJOR)
#define TRC_EXT1_VERSION_MINOR CAT(TRC_EXT1_PREFIX, _VERSION_MINOR)
#define TRC_EXT2_VERSION_MINOR CAT(TRC_EXT2_PREFIX, _VERSION_MINOR)
#define TRC_EXT3_VERSION_MINOR CAT(TRC_EXT3_PREFIX, _VERSION_MINOR)
#define TRC_EXT4_VERSION_MINOR CAT(TRC_EXT4_PREFIX, _VERSION_MINOR)
#define TRC_EXT1_VERSION_PATCH CAT(TRC_EXT1_PREFIX, _VERSION_PATCH)
#define TRC_EXT2_VERSION_PATCH CAT(TRC_EXT2_PREFIX, _VERSION_PATCH)
#define TRC_EXT3_VERSION_PATCH CAT(TRC_EXT3_PREFIX, _VERSION_PATCH)
#define TRC_EXT4_VERSION_PATCH CAT(TRC_EXT4_PREFIX, _VERSION_PATCH)
#if ((TRC_CFG_EXTENSION_COUNT > 4) || (TRC_CFG_EXTENSION_COUNT < 0))
#error "TRC_CFG_EXTENSION_COUNT must be in range [0..4]"
#endif
#if (TRC_CFG_EXTENSION_COUNT == 0)
#define TRC_EXTENSIONS_DATA
#endif
#if (TRC_CFG_EXTENSION_COUNT == 1)
#define TRC_EXTENSIONS_DATA \
{ \
{ TRC_EXTENSION_EVENTCODE_BASE, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT-1, \
TRC_EXT1_VERSION_PATCH, \
TRC_EXT1_VERSION_MINOR, \
TRC_EXT1_VERSION_MAJOR, \
TRC_EXT1_NAME } \
}
#endif
#if (TRC_CFG_EXTENSION_COUNT == 2)
#define TRC_EXTENSIONS_DATA \
{ \
{ TRC_EXTENSION_EVENTCODE_BASE, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT-1, \
TRC_EXT1_VERSION_PATCH, \
TRC_EXT1_VERSION_MINOR, \
TRC_EXT1_VERSION_MAJOR, \
TRC_EXT1_NAME } \
,{ TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT-1, \
TRC_EXT2_VERSION_PATCH, \
TRC_EXT2_VERSION_MINOR, \
TRC_EXT2_VERSION_MAJOR, \
TRC_EXT2_NAME } \
}
#endif
#if (TRC_CFG_EXTENSION_COUNT == 3)
#define TRC_EXTENSIONS_DATA \
{ \
{ TRC_EXTENSION_EVENTCODE_BASE, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT-1, \
TRC_EXT1_VERSION_PATCH, \
TRC_EXT1_VERSION_MINOR, \
TRC_EXT1_VERSION_MAJOR, \
TRC_EXT1_NAME } \
,{ TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT-1, \
TRC_EXT2_VERSION_PATCH, \
TRC_EXT2_VERSION_MINOR, \
TRC_EXT2_VERSION_MAJOR, \
TRC_EXT2_NAME } \
,{ TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT + TRC_EXT3_COUNT - 1, \
TRC_EXT3_VERSION_PATCH, \
TRC_EXT3_VERSION_MINOR, \
TRC_EXT3_VERSION_MAJOR, \
TRC_EXT3_NAME } \
}
#endif
#if (TRC_CFG_EXTENSION_COUNT == 4)
#define TRC_EXTENSIONS_DATA \
{ \
{ TRC_EXTENSION_EVENTCODE_BASE, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT-1, \
TRC_EXT1_VERSION_PATCH, \
TRC_EXT1_VERSION_MINOR, \
TRC_EXT1_VERSION_MAJOR, \
TRC_EXT1_NAME } \
,{ TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT-1, \
TRC_EXT2_VERSION_PATCH, \
TRC_EXT2_VERSION_MINOR, \
TRC_EXT2_VERSION_MAJOR, \
TRC_EXT2_NAME } \
,{ TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT + TRC_EXT3_COUNT - 1, \
TRC_EXT3_VERSION_PATCH, \
TRC_EXT3_VERSION_MINOR, \
TRC_EXT3_VERSION_MAJOR, \
TRC_EXT3_NAME } \
,{ TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT + TRC_EXT3_COUNT, \
TRC_EXTENSION_EVENTCODE_BASE + TRC_EXT1_COUNT + TRC_EXT2_COUNT + TRC_EXT3_COUNT + TRC_EXT4_COUNT- 1, \
TRC_EXT4_VERSION_PATCH, \
TRC_EXT4_VERSION_MINOR, \
TRC_EXT4_VERSION_MAJOR, \
TRC_EXT4_NAME } \
}
#endif
#if (TRC_CFG_EXTENSION_COUNT > 0)
#define TRC_EXTENSION_INFO {TRC_CFG_EXTENSION_COUNT, TRC_EXTENSION_EVENTCODE_BASE, ROUNDUP4(TRC_CFG_EXT_MAX_NAME_LEN), sizeof(PSFExtensionEntryType), TRC_EXTENSIONS_DATA}
#else
#define TRC_EXTENSION_INFO {TRC_CFG_EXTENSION_COUNT, TRC_EXTENSION_EVENTCODE_BASE}
#endif
#endif /* TRCEXTENSIONS_H_ */

@ -1,137 +1,138 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcPortDefines.h
*
* Some common defines for the trace recorder.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_PORTDEFINES_H
#define TRC_PORTDEFINES_H
#define TRC_FREE_RUNNING_32BIT_INCR 1
#define TRC_FREE_RUNNING_32BIT_DECR 2
#define TRC_OS_TIMER_INCR 3
#define TRC_OS_TIMER_DECR 4
#define TRC_CUSTOM_TIMER_INCR 5
#define TRC_CUSTOM_TIMER_DECR 6
/* Start options for vTraceEnable. */
#define TRC_INIT 0
#define TRC_START 1
#define TRC_START_AWAIT_HOST 2
/* Command codes for TzCtrl task */
#define CMD_SET_ACTIVE 1 /* Start (param1 = 1) or Stop (param1 = 0) */
/* The final command code, used to validate commands. */
#define CMD_LAST_COMMAND 1
#define TRC_RECORDER_MODE_SNAPSHOT 0
#define TRC_RECORDER_MODE_STREAMING 1
#define TRC_RECORDER_BUFFER_ALLOCATION_STATIC (0x00)
#define TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC (0x01)
#define TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM (0x02)
/* Filter Groups */
#define FilterGroup0 (uint16_t)0x0001
#define FilterGroup1 (uint16_t)0x0002
#define FilterGroup2 (uint16_t)0x0004
#define FilterGroup3 (uint16_t)0x0008
#define FilterGroup4 (uint16_t)0x0010
#define FilterGroup5 (uint16_t)0x0020
#define FilterGroup6 (uint16_t)0x0040
#define FilterGroup7 (uint16_t)0x0080
#define FilterGroup8 (uint16_t)0x0100
#define FilterGroup9 (uint16_t)0x0200
#define FilterGroup10 (uint16_t)0x0400
#define FilterGroup11 (uint16_t)0x0800
#define FilterGroup12 (uint16_t)0x1000
#define FilterGroup13 (uint16_t)0x2000
#define FilterGroup14 (uint16_t)0x4000
#define FilterGroup15 (uint16_t)0x8000
/******************************************************************************
* Supported ports
*
* TRC_HARDWARE_PORT_HWIndependent
* A hardware independent fallback option for event timestamping. Provides low
* resolution timestamps based on the OS tick.
* This may be used on the Win32 port, but may also be used on embedded hardware
* platforms. All time durations will be truncated to the OS tick frequency,
* typically 1 KHz. This means that a task or ISR that executes in less than
* 1 ms get an execution time of zero.
*
* TRC_HARDWARE_PORT_APPLICATION_DEFINED
* Allows for defining the port macros in other source code files.
*
* TRC_HARDWARE_PORT_Win32
* "Accurate" timestamping based on the Windows performance counter for Win32
* builds. Note that this gives the host machine time, not the kernel time.
*
* Hardware specific ports
* To get accurate timestamping, a hardware timer is necessary. Below are the
* available ports. Some of these are "unofficial", meaning that
* they have not yet been verified by Percepio but have been contributed by
* external developers. They should work, otherwise let us know by emailing
* support@percepio.com. Some work on any OS platform, while other are specific
* to a certain operating system.
*****************************************************************************/
/****** Port Name ************************************* Code ** Official ** OS Platform *********/
#define TRC_HARDWARE_PORT_APPLICATION_DEFINED 98 /* - - */
#define TRC_HARDWARE_PORT_NOT_SET 99 /* - - */
#define TRC_HARDWARE_PORT_HWIndependent 0 /* Yes Any */
#define TRC_HARDWARE_PORT_Win32 1 /* Yes FreeRTOS on Win32 */
#define TRC_HARDWARE_PORT_Atmel_AT91SAM7 2 /* No Any */
#define TRC_HARDWARE_PORT_Atmel_UC3A0 3 /* No Any */
#define TRC_HARDWARE_PORT_ARM_Cortex_M 4 /* Yes Any */
#define TRC_HARDWARE_PORT_Renesas_RX600 6 /* Yes Any */
#define TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32 7 /* Yes Any */
#define TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48 8 /* Yes Any */
#define TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_MSP430 9 /* No Any */
#define TRC_HARDWARE_PORT_XILINX_PPC405 11 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_XILINX_PPC440 12 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_XILINX_MICROBLAZE 13 /* No Any */
#define TRC_HARDWARE_PORT_NXP_LPC210X 14 /* No Any */
#define TRC_HARDWARE_PORT_ARM_CORTEX_A9 15 /* Yes Any */
#define TRC_HARDWARE_PORT_POWERPC_Z4 16 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_Altera_NiosII 17 /* No Any */
#endif /*TRC_PORTDEFINES_H*/
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcPortDefines.h
*
* Some common defines for the trace recorder.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_PORTDEFINES_H
#define TRC_PORTDEFINES_H
#define TRC_FREE_RUNNING_32BIT_INCR 1
#define TRC_FREE_RUNNING_32BIT_DECR 2
#define TRC_OS_TIMER_INCR 3
#define TRC_OS_TIMER_DECR 4
#define TRC_CUSTOM_TIMER_INCR 5
#define TRC_CUSTOM_TIMER_DECR 6
/* Start options for vTraceEnable. */
#define TRC_INIT 0
#define TRC_START 1
#define TRC_START_AWAIT_HOST 2
/* Command codes for TzCtrl task */
#define CMD_SET_ACTIVE 1 /* Start (param1 = 1) or Stop (param1 = 0) */
/* The final command code, used to validate commands. */
#define CMD_LAST_COMMAND 1
#define TRC_RECORDER_MODE_SNAPSHOT 0
#define TRC_RECORDER_MODE_STREAMING 1
#define TRC_RECORDER_BUFFER_ALLOCATION_STATIC (0x00)
#define TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC (0x01)
#define TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM (0x02)
/* Filter Groups */
#define FilterGroup0 (uint16_t)0x0001
#define FilterGroup1 (uint16_t)0x0002
#define FilterGroup2 (uint16_t)0x0004
#define FilterGroup3 (uint16_t)0x0008
#define FilterGroup4 (uint16_t)0x0010
#define FilterGroup5 (uint16_t)0x0020
#define FilterGroup6 (uint16_t)0x0040
#define FilterGroup7 (uint16_t)0x0080
#define FilterGroup8 (uint16_t)0x0100
#define FilterGroup9 (uint16_t)0x0200
#define FilterGroup10 (uint16_t)0x0400
#define FilterGroup11 (uint16_t)0x0800
#define FilterGroup12 (uint16_t)0x1000
#define FilterGroup13 (uint16_t)0x2000
#define FilterGroup14 (uint16_t)0x4000
#define FilterGroup15 (uint16_t)0x8000
/******************************************************************************
* Supported ports
*
* TRC_HARDWARE_PORT_HWIndependent
* A hardware independent fallback option for event timestamping. Provides low
* resolution timestamps based on the OS tick.
* This may be used on the Win32 port, but may also be used on embedded hardware
* platforms. All time durations will be truncated to the OS tick frequency,
* typically 1 KHz. This means that a task or ISR that executes in less than
* 1 ms get an execution time of zero.
*
* TRC_HARDWARE_PORT_APPLICATION_DEFINED
* Allows for defining the port macros in other source code files.
*
* TRC_HARDWARE_PORT_Win32
* "Accurate" timestamping based on the Windows performance counter for Win32
* builds. Note that this gives the host machine time, not the kernel time.
*
* Hardware specific ports
* To get accurate timestamping, a hardware timer is necessary. Below are the
* available ports. Some of these are "unofficial", meaning that
* they have not yet been verified by Percepio but have been contributed by
* external developers. They should work, otherwise let us know by emailing
* support@percepio.com. Some work on any OS platform, while other are specific
* to a certain operating system.
*****************************************************************************/
/****** Port Name ************************************* Code ** Official ** OS Platform *********/
#define TRC_HARDWARE_PORT_APPLICATION_DEFINED 98 /* - - */
#define TRC_HARDWARE_PORT_NOT_SET 99 /* - - */
#define TRC_HARDWARE_PORT_HWIndependent 0 /* Yes Any */
#define TRC_HARDWARE_PORT_Win32 1 /* Yes FreeRTOS on Win32 */
#define TRC_HARDWARE_PORT_Atmel_AT91SAM7 2 /* No Any */
#define TRC_HARDWARE_PORT_Atmel_UC3A0 3 /* No Any */
#define TRC_HARDWARE_PORT_ARM_Cortex_M 4 /* Yes Any */
#define TRC_HARDWARE_PORT_Renesas_RX600 6 /* Yes Any */
#define TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32 7 /* Yes Any */
#define TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48 8 /* Yes Any */
#define TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_MSP430 9 /* No Any */
#define TRC_HARDWARE_PORT_XILINX_PPC405 11 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_XILINX_PPC440 12 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_XILINX_MICROBLAZE 13 /* No Any */
#define TRC_HARDWARE_PORT_XILINX_ZyncUltraScaleR5 14 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_NXP_LPC210X 15 /* No Any */
#define TRC_HARDWARE_PORT_ARM_CORTEX_A9 16 /* Yes Any */
#define TRC_HARDWARE_PORT_POWERPC_Z4 17 /* No FreeRTOS */
#define TRC_HARDWARE_PORT_Altera_NiosII 18 /* Yes Any (Tested with FreeRTOS) */
#endif /*TRC_PORTDEFINES_H*/

@ -1,301 +1,411 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.4
* Percepio AB, www.percepio.com
*
* trcConfig.h
*
* Main configuration parameters for the trace recorder library.
* More settings can be found in trcStreamingConfig.h and trcSnapshotConfig.h.
*
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_CONFIG_H
#define TRC_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "trcPortDefines.h"
/******************************************************************************
* Include of processor header file
*
* Here you may need to include the header file for your processor. This is
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
* Try that in case of build problems. Otherwise, remove the #error line below.
*****************************************************************************/
#error "Trace Recorder: Please include your processor's header file here and remove this line."
/*******************************************************************************
* Configuration Macro: TRC_CFG_HARDWARE_PORT
*
* Specify what hardware port to use (i.e., the "timestamping driver").
*
* All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
* This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is
* available on most such devices. In case your device don't have DWT support,
* you will get an error message opening the trace. In that case, you may
* force the recorder to use SysTick timestamping instead, using this define:
*
* #define TRC_CFG_ARM_CM_USE_SYSTICK
*
* For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.
*
* See trcHardwarePort.h for available ports and information on how to
* define your own port, if not already present.
******************************************************************************/
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_NOT_SET
/*******************************************************************************
* Configuration Macro: TRC_CFG_RECORDER_MODE
*
* Specify what recording mode to use. Snapshot means that the data is saved in
* an internal RAM buffer, for later upload. Streaming means that the data is
* transferred continuously to the host PC.
*
* For more information, see http://percepio.com/2016/10/05/rtos-tracing/
* and the Tracealyzer User Manual.
*
* Values:
* TRC_RECORDER_MODE_SNAPSHOT
* TRC_RECORDER_MODE_STREAMING
******************************************************************************/
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
/******************************************************************************
* TRC_CFG_FREERTOS_VERSION
*
* Specify what version of FreeRTOS that is used (don't change unless using the
* trace recorder library with an older version of FreeRTOS).
*
* TRC_FREERTOS_VERSION_7_3 If using FreeRTOS v7.3.x
* TRC_FREERTOS_VERSION_7_4 If using FreeRTOS v7.4.x
* TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0
* TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X
* TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0
* TRC_FREERTOS_VERSION_9_0_1 If using FreeRTOS v9.0.1
* TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2
* TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0 or later
*****************************************************************************/
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_0_0
/*******************************************************************************
* TRC_CFG_SCHEDULING_ONLY
*
* Macro which should be defined as an integer value.
*
* If this setting is enabled (= 1), only scheduling events are recorded.
* If disabled (= 0), all events are recorded (unless filtered in other ways).
*
* Default value is 0 (= include additional events).
******************************************************************************/
#define TRC_CFG_SCHEDULING_ONLY 0
/******************************************************************************
* TRC_CFG_INCLUDE_MEMMANG_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* This controls if malloc and free calls should be traced. Set this to zero (0)
* to exclude malloc/free calls, or one (1) to include such events in the trace.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
/******************************************************************************
* TRC_CFG_INCLUDE_USER_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), all code related to User Events is excluded in order
* to reduce code size. Any attempts of storing User Events are then silently
* ignored.
*
* User Events are application-generated events, like "printf" but for the
* trace log, generated using vTracePrint and vTracePrintF.
* The formatting is done on host-side, by Tracealyzer. User Events are
* therefore much faster than a console printf and can often be used
* in timing critical code without problems.
*
* Note: In streaming mode, User Events are used to provide error messages
* and warnings from the recorder (in case of incorrect configuration) for
* display in Tracealyzer. Disabling user events will also disable these
* warnings. You can however still catch them by calling xTraceGetLastError
* or by putting breakpoints in prvTraceError and prvTraceWarning.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_USER_EVENTS 1
/*****************************************************************************
* TRC_CFG_INCLUDE_ISR_TRACING
*
* 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, in order to reduce code size.
*
* Default value is 1.
*
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
* and vTraceStoreISREnd in your interrupt handlers.
*****************************************************************************/
#define TRC_CFG_INCLUDE_ISR_TRACING 1
/*****************************************************************************
* TRC_CFG_INCLUDE_READY_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If one (1), events are recorded when tasks enter scheduling state "ready".
* This allows Tracealyzer to show the initial pending time before tasks enter
* the execution state, and present accurate response times.
* If zero (0), "ready events" are not created, which allows for recording
* longer traces in the same amount of RAM.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_READY_EVENTS 1
/*****************************************************************************
* TRC_CFG_INCLUDE_OSTICK_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is one (1), events will be generated whenever the OS clock is
* increased. If zero (0), OS tick events are not generated, which allows for
* recording longer traces in the same amount of RAM.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
/*****************************************************************************
* TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any "event group" events.
*
* Default value is 0 (excluded) since dependent on event_groups.c
*****************************************************************************/
#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 0
/*****************************************************************************
* TRC_CFG_INCLUDE_TIMER_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any Timer events.
*
* Default value is 0 since dependent on timers.c
*****************************************************************************/
#define TRC_CFG_INCLUDE_TIMER_EVENTS 0
/*****************************************************************************
* TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any "pending function call"
* events, such as xTimerPendFunctionCall().
*
* Default value is 0 since dependent on timers.c
*****************************************************************************/
#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 0
/*******************************************************************************
* Configuration Macro: TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any stream buffer or message
* buffer events.
*
* Default value is 0 since dependent on stream_buffer.c (new in FreeRTOS v10)
******************************************************************************/
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 0
/*******************************************************************************
* Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
*
* Specifies how the recorder buffer is allocated (also in case of streaming, in
* port using the recorder's internal temporary buffer)
*
* Values:
* TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation (internal)
* TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable
* TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer
*
* Static and dynamic mode does the allocation for you, either in compile time
* (static) or in runtime (malloc).
* The custom mode allows you to control how and where the allocation is made,
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().
******************************************************************************/
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
/******************************************************************************
* TRC_CFG_MAX_ISR_NESTING
*
* Defines how many levels of interrupt nesting the recorder can handle, in
* case multiple ISRs are traced and ISR nesting is possible. If this
* is exceeded, the particular ISR will not be traced and the recorder then
* logs an error message. This setting is used to allocate an internal stack
* for keeping track of the previous execution context (4 byte per entry).
*
* This value must be a non-zero positive constant, at least 1.
*
* Default value: 8
*****************************************************************************/
#define TRC_CFG_MAX_ISR_NESTING 8
/* Specific configuration, depending on Streaming/Snapshot mode */
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
#include "trcSnapshotConfig.h"
#elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#include "trcStreamingConfig.h"
#endif
#ifdef __cplusplus
}
#endif
#endif /* _TRC_CONFIG_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcConfig.h
*
* Main configuration parameters for the trace recorder library.
* More settings can be found in trcStreamingConfig.h and trcSnapshotConfig.h.
*
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_CONFIG_H
#define TRC_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "trcPortDefines.h"
/******************************************************************************
* Include of processor header file
*
* Here you may need to include the header file for your processor. This is
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
* Try that in case of build problems. Otherwise, remove the #error line below.
*****************************************************************************/
#error "Trace Recorder: Please include your processor's header file here and remove this line."
/*******************************************************************************
* Configuration Macro: TRC_CFG_HARDWARE_PORT
*
* Specify what hardware port to use (i.e., the "timestamping driver").
*
* All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
* This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is
* available on most such devices. In case your device don't have DWT support,
* you will get an error message opening the trace. In that case, you may
* force the recorder to use SysTick timestamping instead, using this define:
*
* #define TRC_CFG_ARM_CM_USE_SYSTICK
*
* For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.
*
* See trcHardwarePort.h for available ports and information on how to
* define your own port, if not already present.
******************************************************************************/
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_NOT_SET
/*******************************************************************************
* Configuration Macro: TRC_CFG_RECORDER_MODE
*
* Specify what recording mode to use. Snapshot means that the data is saved in
* an internal RAM buffer, for later upload. Streaming means that the data is
* transferred continuously to the host PC.
*
* For more information, see http://percepio.com/2016/10/05/rtos-tracing/
* and the Tracealyzer User Manual.
*
* Values:
* TRC_RECORDER_MODE_SNAPSHOT
* TRC_RECORDER_MODE_STREAMING
******************************************************************************/
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
/******************************************************************************
* TRC_CFG_FREERTOS_VERSION
*
* Specify what version of FreeRTOS that is used (don't change unless using the
* trace recorder library with an older version of FreeRTOS).
*
* TRC_FREERTOS_VERSION_7_3_X If using FreeRTOS v7.3.X
* TRC_FREERTOS_VERSION_7_4_X If using FreeRTOS v7.4.X
* TRC_FREERTOS_VERSION_7_5_X If using FreeRTOS v7.5.X
* TRC_FREERTOS_VERSION_7_6_X If using FreeRTOS v7.6.X
* TRC_FREERTOS_VERSION_8_X_X If using FreeRTOS v8.X.X
* TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0
* TRC_FREERTOS_VERSION_9_0_1 If using FreeRTOS v9.0.1
* TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2
* TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0
* TRC_FREERTOS_VERSION_10_0_1 If using FreeRTOS v10.0.1
* TRC_FREERTOS_VERSION_10_1_0 If using FreeRTOS v10.1.0
* TRC_FREERTOS_VERSION_10_1_1 If using FreeRTOS v10.1.1
* TRC_FREERTOS_VERSION_10_2_0 If using FreeRTOS v10.2.0
* TRC_FREERTOS_VERSION_10_2_1 If using FreeRTOS v10.2.1
* TRC_FREERTOS_VERSION_10_3_0 If using FreeRTOS v10.3.0
* TRC_FREERTOS_VERSION_10_3_1 If using FreeRTOS v10.3.1
* TRC_FREERTOS_VERSION_10_4_0 If using FreeRTOS v10.4.0 or later
*****************************************************************************/
#define TRC_CFG_FREERTOS_VERSION FREERTOS_VERSION_NOT_SET
/*******************************************************************************
* TRC_CFG_SCHEDULING_ONLY
*
* Macro which should be defined as an integer value.
*
* If this setting is enabled (= 1), only scheduling events are recorded.
* If disabled (= 0), all events are recorded (unless filtered in other ways).
*
* Default value is 0 (= include additional events).
******************************************************************************/
#define TRC_CFG_SCHEDULING_ONLY 0
/******************************************************************************
* TRC_CFG_INCLUDE_MEMMANG_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* This controls if malloc and free calls should be traced. Set this to zero (0)
* to exclude malloc/free calls, or one (1) to include such events in the trace.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
/******************************************************************************
* TRC_CFG_INCLUDE_USER_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), all code related to User Events is excluded in order
* to reduce code size. Any attempts of storing User Events are then silently
* ignored.
*
* User Events are application-generated events, like "printf" but for the
* trace log, generated using vTracePrint and vTracePrintF.
* The formatting is done on host-side, by Tracealyzer. User Events are
* therefore much faster than a console printf and can often be used
* in timing critical code without problems.
*
* Note: In streaming mode, User Events are used to provide error messages
* and warnings from the recorder (in case of incorrect configuration) for
* display in Tracealyzer. Disabling user events will also disable these
* warnings. You can however still catch them by calling xTraceGetLastError
* or by putting breakpoints in prvTraceError and prvTraceWarning.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_USER_EVENTS 1
/*****************************************************************************
* TRC_CFG_INCLUDE_ISR_TRACING
*
* 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, in order to reduce code size. This means that any calls to
* vTraceStoreISRBegin/vTraceStoreISREnd will be ignored.
* This does not completely disable ISR tracing, in cases where an ISR is
* calling a traced kernel service. These events will still be recorded and
* show up in anonymous ISR instances in Tracealyzer, with names such as
* "ISR sending to <queue name>".
* To disable such tracing, please refer to vTraceSetFilterGroup and
* vTraceSetFilterMask.
*
* Default value is 1.
*
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
* and vTraceStoreISREnd in your interrupt handlers.
*****************************************************************************/
#define TRC_CFG_INCLUDE_ISR_TRACING 1
/*****************************************************************************
* TRC_CFG_INCLUDE_READY_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If one (1), events are recorded when tasks enter scheduling state "ready".
* This allows Tracealyzer to show the initial pending time before tasks enter
* the execution state, and present accurate response times.
* If zero (0), "ready events" are not created, which allows for recording
* longer traces in the same amount of RAM.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_READY_EVENTS 1
/*****************************************************************************
* TRC_CFG_INCLUDE_OSTICK_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is one (1), events will be generated whenever the OS clock is
* increased. If zero (0), OS tick events are not generated, which allows for
* recording longer traces in the same amount of RAM.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
/*****************************************************************************
* TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any "event group" events.
*
* Default value is 0 (excluded) since dependent on event_groups.c
*****************************************************************************/
#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 0
/*****************************************************************************
* TRC_CFG_INCLUDE_TIMER_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any Timer events.
*
* Default value is 0 since dependent on timers.c
*****************************************************************************/
#define TRC_CFG_INCLUDE_TIMER_EVENTS 0
/*****************************************************************************
* TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any "pending function call"
* events, such as xTimerPendFunctionCall().
*
* Default value is 0 since dependent on timers.c
*****************************************************************************/
#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 0
/*******************************************************************************
* Configuration Macro: TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the trace will exclude any stream buffer or message
* buffer events.
*
* Default value is 0 since dependent on stream_buffer.c (new in FreeRTOS v10)
******************************************************************************/
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 0
/******************************************************************************
* TRC_CFG_ENABLE_STACK_MONITOR
*
* If enabled (1), the recorder periodically reports the unused stack space of
* all active tasks.
* The stack monitoring runs in the Tracealyzer Control task, TzCtrl. This task
* is always created by the recorder when in streaming mode.
* In snapshot mode, the TzCtrl task is only used for stack monitoring and is
* not created unless this is enabled.
*****************************************************************************/
#define TRC_CFG_ENABLE_STACK_MONITOR 1
/******************************************************************************
* TRC_CFG_STACK_MONITOR_MAX_TASKS
*
* Macro which should be defined as a non-zero integer value.
*
* This controls how many tasks that can be monitored by the stack monitor.
* If this is too small, some tasks will be excluded and a warning is shown.
*
* Default value is 10.
*****************************************************************************/
#define TRC_CFG_STACK_MONITOR_MAX_TASKS 10
/******************************************************************************
* TRC_CFG_STACK_MONITOR_MAX_REPORTS
*
* Macro which should be defined as a non-zero integer value.
*
* This defines how many tasks that will be subject to stack usage analysis for
* each execution of the Tracealyzer Control task (TzCtrl). Note that the stack
* monitoring cycles between the tasks, so this does not affect WHICH tasks that
* are monitored, but HOW OFTEN each task stack is analyzed.
*
* This setting can be combined with TRC_CFG_CTRL_TASK_DELAY to tune the
* frequency of the stack monitoring. This is motivated since the stack analysis
* can take some time to execute.
* However, note that the stack analysis runs in a separate task (TzCtrl) that
* can be executed on low priority. This way, you can avoid that the stack
* analysis disturbs any time-sensitive tasks.
*
* Default value is 1.
*****************************************************************************/
#define TRC_CFG_STACK_MONITOR_MAX_REPORTS 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_PRIORITY
*
* The scheduling priority of the Tracealyzer Control (TzCtrl) task.
*
* In streaming mode, TzCtrl is used to receive start/stop commands from
* Tracealyzer and in some cases also to transmit the trace data (for stream
* ports that uses the internal buffer, like TCP/IP). For such stream ports,
* make sure the TzCtrl priority is high enough to ensure reliable periodic
* execution and transfer of the data, but low enough to avoid disturbing any
* time-sensitive functions.
*
* In Snapshot mode, TzCtrl is only used for the stack usage monitoring and is
* not created if stack monitoring is disabled. TRC_CFG_CTRL_TASK_PRIORITY should
* be low, to avoid disturbing any time-sensitive tasks.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_PRIORITY 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_DELAY
*
* The delay between loops of the TzCtrl task (see TRC_CFG_CTRL_TASK_PRIORITY),
* which affects the frequency of the stack monitoring.
*
* In streaming mode, this also affects the trace data transfer if you are using
* a stream port leveraging the internal buffer (like TCP/IP). A shorter delay
* increases the CPU load of TzCtrl somewhat, but may improve the performance of
* of the trace streaming, especially if the trace buffer is small.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_DELAY 10
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_STACK_SIZE
*
* The stack size of the Tracealyzer Control (TzCtrl) task.
* See TRC_CFG_CTRL_TASK_PRIORITY for further information about TzCtrl.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE * 2)
/*******************************************************************************
* Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
*
* Specifies how the recorder buffer is allocated (also in case of streaming, in
* port using the recorder's internal temporary buffer)
*
* Values:
* TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation (internal)
* TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable
* TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer
*
* Static and dynamic mode does the allocation for you, either in compile time
* (static) or in runtime (malloc).
* The custom mode allows you to control how and where the allocation is made,
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().
******************************************************************************/
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
/******************************************************************************
* TRC_CFG_MAX_ISR_NESTING
*
* Defines how many levels of interrupt nesting the recorder can handle, in
* case multiple ISRs are traced and ISR nesting is possible. If this
* is exceeded, the particular ISR will not be traced and the recorder then
* logs an error message. This setting is used to allocate an internal stack
* for keeping track of the previous execution context (4 byte per entry).
*
* This value must be a non-zero positive constant, at least 1.
*
* Default value: 8
*****************************************************************************/
#define TRC_CFG_MAX_ISR_NESTING 8
/******************************************************************************
* TRC_CFG_ACKNOWLEDGE_QUEUE_SET_SEND
*
* When using FreeRTOS v10.3.0 or v10.3.1, please make sure that the trace
* point in prvNotifyQueueSetContainer() in queue.c is renamed from
* traceQUEUE_SEND to traceQUEUE_SET_SEND in order to tell them apart from
* other traceQUEUE_SEND trace points. Then set this to TRC_ACKNOWLEDGED.
*****************************************************************************/
#define TRC_CFG_ACKNOWLEDGE_QUEUE_SET_SEND 0 /* TRC_ACKNOWLEDGED */
/* Specific configuration, depending on Streaming/Snapshot mode */
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
#include "trcSnapshotConfig.h"
#elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#include "trcStreamingConfig.h"
#endif
#ifdef __cplusplus
}
#endif
#endif /* _TRC_CONFIG_H */

@ -1,377 +1,377 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.4
* Percepio AB, www.percepio.com
*
* trcSnapshotConfig.h
*
* Configuration parameters for trace recorder library in snapshot mode.
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_SNAPSHOT_CONFIG_H
#define TRC_SNAPSHOT_CONFIG_H
#define TRC_SNAPSHOT_MODE_RING_BUFFER (0x01)
#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL (0x02)
/******************************************************************************
* TRC_CFG_SNAPSHOT_MODE
*
* Macro which should be defined as one of:
* - TRC_SNAPSHOT_MODE_RING_BUFFER
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.
*
* With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_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 TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_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 TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
/*******************************************************************************
* TRC_CFG_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. 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.
*
* Default value is 1000, which means that 4000 bytes is allocated for the
* event buffer.
******************************************************************************/
#define TRC_CFG_EVENT_BUFFER_SIZE 1000
/*******************************************************************************
* TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...
*
* A group of macros which should be defined as integer values, zero or larger.
*
* 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, ...).
*
* If tasks or 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.
*
* 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. The
* error message can also be retrieved using xTraceGetLastError.
*
* 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 TRC_CFG_NTASK 15
#define TRC_CFG_NISR 5
#define TRC_CFG_NQUEUE 10
#define TRC_CFG_NSEMAPHORE 10
#define TRC_CFG_NMUTEX 10
#define TRC_CFG_NTIMER 5
#define TRC_CFG_NEVENTGROUP 5
#define TRC_CFG_NSTREAMBUFFER 5
#define TRC_CFG_NMESSAGEBUFFER 5
/******************************************************************************
* TRC_CFG_INCLUDE_FLOAT_SUPPORT
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the support for logging floating point values in
* vTracePrintF is stripped out, in case floating point values are not used or
* supported by the platform used.
*
* Floating point values are only used in vTracePrintF and its subroutines, to
* allow for storing float (%f) or double (%lf) arguments.
*
* vTracePrintF can be used with integer and string arguments in either case.
*
* Default value is 0.
*****************************************************************************/
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
/*******************************************************************************
* TRC_CFG_SYMBOL_TABLE_SIZE
*
* 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 TRC_CFG_SYMBOL_TABLE_SIZE 800
#if (TRC_CFG_SYMBOL_TABLE_SIZE == 0)
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
#endif
/******************************************************************************
* TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...
*
* 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 TRC_CFG_NAME_LEN_TASK 15
#define TRC_CFG_NAME_LEN_ISR 15
#define TRC_CFG_NAME_LEN_QUEUE 15
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
#define TRC_CFG_NAME_LEN_MUTEX 15
#define TRC_CFG_NAME_LEN_TIMER 15
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
/******************************************************************************
*** 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.
*****************************************************************************/
/******************************************************************************
* TRC_CFG_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 TRC_CFG_HEAP_SIZE_BELOW_16M 0
/******************************************************************************
* TRC_CFG_USE_IMPLICIT_IFE_RULES
*
* Macro which should be defined as either zero (0) or one (1).
* Default is 1.
*
* Tracealyzer groups the events into "instances" based on Instance Finish
* Events (IFEs), produced either by default rules or calls to the recorder
* functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext.
*
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is
* used, resulting in a "typical" grouping of events into instances.
* If these rules don't give appropriate instances in your case, you can
* override the default rules using vTraceInstanceFinishedNow/Next for one
* or several tasks. The default IFE rules are then disabled for those tasks.
*
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are
* disabled globally. You must then call vTraceInstanceFinishedNow or
* vTraceInstanceFinishedNext to manually group the events into instances,
* otherwise the tasks will appear a single long instance.
*
* The default IFE rules count the following events as "instance finished":
* - Task delay, delay until
* - Task suspend
* - Blocking on "input" operations, i.e., when the task is waiting for the
* next a message/signal/event. But only if this event is blocking.
*
* For details, see trcSnapshotKernelPort.h and look for references to the
* macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.
*****************************************************************************/
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
/******************************************************************************
* TRC_CFG_USE_16BIT_OBJECT_HANDLES
*
* Macro which should be defined as either zero (0) or one (1).
*
* 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 (tasks, queues, mutexes,
* etc.) Note: 255, not 256, since handle 0 is reserved.
*
* 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.
*
* Default is 0 (8-bit handles)
*
* NOTE: An object with handle above 255 will use an extra 4-byte record in
* the event buffer whenever the object is referenced. Moreover, some internal
* tables in the recorder gets slightly larger when using 16-bit handles.
*****************************************************************************/
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
/******************************************************************************
* TRC_CFG_USE_TRACE_ASSERT
*
* Macro which should be defined as either zero (0) or one (1).
* Default is 1.
*
* If this is one (1), the TRACE_ASSERT macro (used at various locations in the
* trace recorder) will verify that a relevant condition is true.
* If the condition is false, prvTraceError() will be called, which stops the
* recording and stores an error message that is displayed when opening the
* trace in Tracealyzer.
*
* This is used on several places in the recorder code for sanity checks on
* parameters. Can be switched off to reduce the footprint of the tracing, but
* we recommend to have it enabled initially.
*****************************************************************************/
#define TRC_CFG_USE_TRACE_ASSERT 1
/*******************************************************************************
* TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
*
* Macro which should be defined as an integer value.
*
* Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the
* separate user event buffer (UB).
* In this mode, user events are stored separately from other events,
* e.g., RTOS events. Thereby you can get a much longer history of
* user events as they don't need to share the buffer space with more
* frequent events.
*
* The UB is typically used with the snapshot ring-buffer mode, so the
* recording can continue when the main buffer gets full. And since the
* main buffer then overwrites the earliest events, Tracealyzer displays
* "Unknown Actor" instead of task scheduling for periods with UB data only.
*
* In UB mode, user events are structured as UB channels, which contains
* a channel name and a default format string. Register a UB channel using
* xTraceRegisterUBChannel.
*
* Events and data arguments are written using vTraceUBEvent and
* vTraceUBData. They are designed to provide efficient logging of
* repeating events, using the same format string within each channel.
*
* Examples:
*
* traceString chn1 = xTraceRegisterString("Channel 1");
* traceString fmt1 = xTraceRegisterString("Event!");
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);
*
* traceString chn2 = xTraceRegisterString("Channel 2");
* traceString fmt2 = xTraceRegisterString("X: %d, Y: %d");
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);
*
* // Result in "[Channel 1] Event!"
* vTraceUBEvent(UBCh1);
*
* // Result in "[Channel 2] X: 23, Y: 19"
* vTraceUBData(UBCh2, 23, 19);
*
* You can also use the other user event functions, like vTracePrintF.
* as they are then rerouted to the UB instead of the main event buffer.
* vTracePrintF then looks up the correct UB channel based on the
* provided channel name and format string, or creates a new UB channel
* if no match is found. The format string should therefore not contain
* "random" messages but mainly format specifiers. Random strings should
* be stored using %s and with the string as an argument.
*
* // Creates a new UB channel ("Channel 2", "%Z: %d")
* vTracePrintF(chn2, "%Z: %d", value1);
*
* // Finds the existing UB channel
* vTracePrintF(chn2, "%Z: %d", value2);
******************************************************************************/
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
/*******************************************************************************
* TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
*
* Macro which should be defined as an integer value.
*
* This defines the capacity of the user event buffer (UB), in number of slots.
* A single user event can use multiple slots, depending on the arguments.
*
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
******************************************************************************/
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
/*******************************************************************************
* TRC_CFG_UB_CHANNELS
*
* Macro which should be defined as an integer value.
*
* This defines the number of User Event Buffer Channels (UB channels).
* These are used to structure the events when using the separate user
* event buffer, and contains both a User Event Channel (the name) and
* a default format string for the channel.
*
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
******************************************************************************/
#define TRC_CFG_UB_CHANNELS 32
/*******************************************************************************
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
*
* Macro which should be defined as an integer value.
*
* If tracing multiple ISRs, this setting allows for accurate display of the
* context-switching also in cases when the ISRs execute in direct sequence.
*
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
* context, i.e., a task or a preempted ISR. But if another traced ISR
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
* fragment of the previous context in between the ISRs.
*
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
* however a threshold value that must be measured for your specific setup.
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
*
* The default setting is 0, meaning "disabled" and that you may get an
* extra fragments of the previous context in between tail-chained ISRs.
*
* Note: This setting has separate definitions in trcSnapshotConfig.h and
* trcStreamingConfig.h, since it is affected by the recorder mode.
******************************************************************************/
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
#endif /*TRC_SNAPSHOT_CONFIG_H*/
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcSnapshotConfig.h
*
* Configuration parameters for trace recorder library in snapshot mode.
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_SNAPSHOT_CONFIG_H
#define TRC_SNAPSHOT_CONFIG_H
#define TRC_SNAPSHOT_MODE_RING_BUFFER (0x01)
#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL (0x02)
/******************************************************************************
* TRC_CFG_SNAPSHOT_MODE
*
* Macro which should be defined as one of:
* - TRC_SNAPSHOT_MODE_RING_BUFFER
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.
*
* With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_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 TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_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 TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
/*******************************************************************************
* TRC_CFG_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. 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.
*
* Default value is 1000, which means that 4000 bytes is allocated for the
* event buffer.
******************************************************************************/
#define TRC_CFG_EVENT_BUFFER_SIZE 1000
/*******************************************************************************
* TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...
*
* A group of macros which should be defined as integer values, zero or larger.
*
* 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, ...).
*
* If tasks or 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.
*
* 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. The
* error message can also be retrieved using xTraceGetLastError.
*
* 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 TRC_CFG_NTASK 15
#define TRC_CFG_NISR 5
#define TRC_CFG_NQUEUE 10
#define TRC_CFG_NSEMAPHORE 10
#define TRC_CFG_NMUTEX 10
#define TRC_CFG_NTIMER 5
#define TRC_CFG_NEVENTGROUP 5
#define TRC_CFG_NSTREAMBUFFER 5
#define TRC_CFG_NMESSAGEBUFFER 5
/******************************************************************************
* TRC_CFG_INCLUDE_FLOAT_SUPPORT
*
* Macro which should be defined as either zero (0) or one (1).
*
* If this is zero (0), the support for logging floating point values in
* vTracePrintF is stripped out, in case floating point values are not used or
* supported by the platform used.
*
* Floating point values are only used in vTracePrintF and its subroutines, to
* allow for storing float (%f) or double (%lf) arguments.
*
* vTracePrintF can be used with integer and string arguments in either case.
*
* Default value is 0.
*****************************************************************************/
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
/*******************************************************************************
* TRC_CFG_SYMBOL_TABLE_SIZE
*
* 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 TRC_CFG_SYMBOL_TABLE_SIZE 800
#if (TRC_CFG_SYMBOL_TABLE_SIZE == 0)
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
#endif
/******************************************************************************
* TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...
*
* 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 TRC_CFG_NAME_LEN_TASK 15
#define TRC_CFG_NAME_LEN_ISR 15
#define TRC_CFG_NAME_LEN_QUEUE 15
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
#define TRC_CFG_NAME_LEN_MUTEX 15
#define TRC_CFG_NAME_LEN_TIMER 15
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
/******************************************************************************
*** 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.
*****************************************************************************/
/******************************************************************************
* TRC_CFG_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 TRC_CFG_HEAP_SIZE_BELOW_16M 0
/******************************************************************************
* TRC_CFG_USE_IMPLICIT_IFE_RULES
*
* Macro which should be defined as either zero (0) or one (1).
* Default is 1.
*
* Tracealyzer groups the events into "instances" based on Instance Finish
* Events (IFEs), produced either by default rules or calls to the recorder
* functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext.
*
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is
* used, resulting in a "typical" grouping of events into instances.
* If these rules don't give appropriate instances in your case, you can
* override the default rules using vTraceInstanceFinishedNow/Next for one
* or several tasks. The default IFE rules are then disabled for those tasks.
*
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are
* disabled globally. You must then call vTraceInstanceFinishedNow or
* vTraceInstanceFinishedNext to manually group the events into instances,
* otherwise the tasks will appear a single long instance.
*
* The default IFE rules count the following events as "instance finished":
* - Task delay, delay until
* - Task suspend
* - Blocking on "input" operations, i.e., when the task is waiting for the
* next a message/signal/event. But only if this event is blocking.
*
* For details, see trcSnapshotKernelPort.h and look for references to the
* macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.
*****************************************************************************/
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
/******************************************************************************
* TRC_CFG_USE_16BIT_OBJECT_HANDLES
*
* Macro which should be defined as either zero (0) or one (1).
*
* 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 (tasks, queues, mutexes,
* etc.) Note: 255, not 256, since handle 0 is reserved.
*
* 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.
*
* Default is 0 (8-bit handles)
*
* NOTE: An object with handle above 255 will use an extra 4-byte record in
* the event buffer whenever the object is referenced. Moreover, some internal
* tables in the recorder gets slightly larger when using 16-bit handles.
*****************************************************************************/
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
/******************************************************************************
* TRC_CFG_USE_TRACE_ASSERT
*
* Macro which should be defined as either zero (0) or one (1).
* Default is 1.
*
* If this is one (1), the TRACE_ASSERT macro (used at various locations in the
* trace recorder) will verify that a relevant condition is true.
* If the condition is false, prvTraceError() will be called, which stops the
* recording and stores an error message that is displayed when opening the
* trace in Tracealyzer.
*
* This is used on several places in the recorder code for sanity checks on
* parameters. Can be switched off to reduce the footprint of the tracing, but
* we recommend to have it enabled initially.
*****************************************************************************/
#define TRC_CFG_USE_TRACE_ASSERT 1
/*******************************************************************************
* TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
*
* Macro which should be defined as an integer value.
*
* Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the
* separate user event buffer (UB).
* In this mode, user events are stored separately from other events,
* e.g., RTOS events. Thereby you can get a much longer history of
* user events as they don't need to share the buffer space with more
* frequent events.
*
* The UB is typically used with the snapshot ring-buffer mode, so the
* recording can continue when the main buffer gets full. And since the
* main buffer then overwrites the earliest events, Tracealyzer displays
* "Unknown Actor" instead of task scheduling for periods with UB data only.
*
* In UB mode, user events are structured as UB channels, which contains
* a channel name and a default format string. Register a UB channel using
* xTraceRegisterUBChannel.
*
* Events and data arguments are written using vTraceUBEvent and
* vTraceUBData. They are designed to provide efficient logging of
* repeating events, using the same format string within each channel.
*
* Examples:
*
* traceString chn1 = xTraceRegisterString("Channel 1");
* traceString fmt1 = xTraceRegisterString("Event!");
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);
*
* traceString chn2 = xTraceRegisterString("Channel 2");
* traceString fmt2 = xTraceRegisterString("X: %d, Y: %d");
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);
*
* // Result in "[Channel 1] Event!"
* vTraceUBEvent(UBCh1);
*
* // Result in "[Channel 2] X: 23, Y: 19"
* vTraceUBData(UBCh2, 23, 19);
*
* You can also use the other user event functions, like vTracePrintF.
* as they are then rerouted to the UB instead of the main event buffer.
* vTracePrintF then looks up the correct UB channel based on the
* provided channel name and format string, or creates a new UB channel
* if no match is found. The format string should therefore not contain
* "random" messages but mainly format specifiers. Random strings should
* be stored using %s and with the string as an argument.
*
* // Creates a new UB channel ("Channel 2", "%Z: %d")
* vTracePrintF(chn2, "%Z: %d", value1);
*
* // Finds the existing UB channel
* vTracePrintF(chn2, "%Z: %d", value2);
******************************************************************************/
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
/*******************************************************************************
* TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
*
* Macro which should be defined as an integer value.
*
* This defines the capacity of the user event buffer (UB), in number of slots.
* A single user event can use multiple slots, depending on the arguments.
*
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
******************************************************************************/
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
/*******************************************************************************
* TRC_CFG_UB_CHANNELS
*
* Macro which should be defined as an integer value.
*
* This defines the number of User Event Buffer Channels (UB channels).
* These are used to structure the events when using the separate user
* event buffer, and contains both a User Event Channel (the name) and
* a default format string for the channel.
*
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
******************************************************************************/
#define TRC_CFG_UB_CHANNELS 32
/*******************************************************************************
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
*
* Macro which should be defined as an integer value.
*
* If tracing multiple ISRs, this setting allows for accurate display of the
* context-switching also in cases when the ISRs execute in direct sequence.
*
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
* context, i.e., a task or a preempted ISR. But if another traced ISR
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
* fragment of the previous context in between the ISRs.
*
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
* however a threshold value that must be measured for your specific setup.
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
*
* The default setting is 0, meaning "disabled" and that you may get an
* extra fragments of the previous context in between tail-chained ISRs.
*
* Note: This setting has separate definitions in trcSnapshotConfig.h and
* trcStreamingConfig.h, since it is affected by the recorder mode.
******************************************************************************/
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
#endif /*TRC_SNAPSHOT_CONFIG_H*/

@ -1,170 +1,144 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.4
* Percepio AB, www.percepio.com
*
* trcStreamingConfig.h
*
* Configuration parameters for the trace recorder library in streaming mode.
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_CONFIG_H
#define TRC_STREAMING_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Configuration Macro: TRC_CFG_SYMBOL_TABLE_SLOTS
*
* The maximum number of symbols names that can be stored. This includes:
* - Task names
* - Named ISRs (vTraceSetISRProperties)
* - Named kernel objects (vTraceStoreKernelObjectName)
* - User event channels (xTraceRegisterString)
*
* If this value is too small, not all symbol names will be stored and the
* trace display will be affected. In that case, there will be warnings
* (as User Events) from TzCtrl task, that monitors this.
******************************************************************************/
#define TRC_CFG_SYMBOL_TABLE_SLOTS 40
/*******************************************************************************
* Configuration Macro: TRC_CFG_SYMBOL_MAX_LENGTH
*
* The maximum length of symbol names, including:
* - Task names
* - Named ISRs (vTraceSetISRProperties)
* - Named kernel objects (vTraceStoreKernelObjectName)
* - User event channel names (xTraceRegisterString)
*
* If longer symbol names are used, they will be truncated by the recorder,
* which will affect the trace display. In that case, there will be warnings
* (as User Events) from TzCtrl task, that monitors this.
******************************************************************************/
#define TRC_CFG_SYMBOL_MAX_LENGTH 25
/*******************************************************************************
* Configuration Macro: TRC_CFG_OBJECT_DATA_SLOTS
*
* The maximum number of object data entries (used for task priorities) that can
* be stored at the same time. Must be sufficient for all tasks, otherwise there
* will be warnings (as User Events) from TzCtrl task, that monitors this.
******************************************************************************/
#define TRC_CFG_OBJECT_DATA_SLOTS 40
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_STACK_SIZE
*
* The stack size of the TzCtrl task, that receive commands.
* We are aiming to remove this extra task in future versions.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE * 2)
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_PRIORITY
*
* The priority of the TzCtrl task, that receive commands from Tracealyzer.
* Most stream ports also rely on the TzCtrl task to transmit the data from the
* internal buffer to the stream interface (all except for the J-Link port).
* For such ports, make sure the TzCtrl priority is high enough to ensure
* reliable periodic execution and transfer of the data.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_PRIORITY 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_CTRL_TASK_DELAY
*
* The delay between every loop of the TzCtrl task. A high delay will reduce the
* CPU load, but may cause missed events if the TzCtrl task is performing the
* trace transfer.
******************************************************************************/
#define TRC_CFG_CTRL_TASK_DELAY ((10 * configTICK_RATE_HZ) / 1000)
/*******************************************************************************
* Configuration Macro: TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT
*
* Specifies the number of pages used by the paged event buffer.
* This may need to be increased if there are a lot of missed events.
*
* Note: not used by the J-Link RTT stream port (see trcStreamingPort.h instead)
******************************************************************************/
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT 2
/*******************************************************************************
* Configuration Macro: TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE
*
* Specifies the size of each page in the paged event buffer. This can be tuned
* to match any internal low-level buffers used by the streaming interface, like
* the Ethernet MTU (Maximum Transmission Unit).
*
* Note: not used by the J-Link RTT stream port (see trcStreamingPort.h instead)
******************************************************************************/
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE 2500
/*******************************************************************************
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
*
* Macro which should be defined as an integer value.
*
* If tracing multiple ISRs, this setting allows for accurate display of the
* context-switching also in cases when the ISRs execute in direct sequence.
*
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
* context, i.e., a task or a preempted ISR. But if another traced ISR
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
* fragment of the previous context in between the ISRs.
*
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
* however a threshold value that must be measured for your specific setup.
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
*
* The default setting is 0, meaning "disabled" and that you may get an
* extra fragments of the previous context in between tail-chained ISRs.
*
* Note: This setting has separate definitions in trcSnapshotConfig.h and
* trcStreamingConfig.h, since it is affected by the recorder mode.
******************************************************************************/
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_CONFIG_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingConfig.h
*
* Configuration parameters for the trace recorder library in streaming mode.
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_CONFIG_H
#define TRC_STREAMING_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Configuration Macro: TRC_CFG_SYMBOL_TABLE_SLOTS
*
* The maximum number of symbols names that can be stored. This includes:
* - Task names
* - Named ISRs (vTraceSetISRProperties)
* - Named kernel objects (vTraceStoreKernelObjectName)
* - User event channels (xTraceRegisterString)
*
* If this value is too small, not all symbol names will be stored and the
* trace display will be affected. In that case, there will be warnings
* (as User Events) from TzCtrl task, that monitors this.
******************************************************************************/
#define TRC_CFG_SYMBOL_TABLE_SLOTS 40
/*******************************************************************************
* Configuration Macro: TRC_CFG_SYMBOL_MAX_LENGTH
*
* The maximum length of symbol names, including:
* - Task names
* - Named ISRs (vTraceSetISRProperties)
* - Named kernel objects (vTraceStoreKernelObjectName)
* - User event channel names (xTraceRegisterString)
*
* If longer symbol names are used, they will be truncated by the recorder,
* which will affect the trace display. In that case, there will be warnings
* (as User Events) from TzCtrl task, that monitors this.
******************************************************************************/
#define TRC_CFG_SYMBOL_MAX_LENGTH 25
/*******************************************************************************
* Configuration Macro: TRC_CFG_OBJECT_DATA_SLOTS
*
* The maximum number of object data entries (used for task priorities) that can
* be stored at the same time. Must be sufficient for all tasks, otherwise there
* will be warnings (as User Events) from TzCtrl task, that monitors this.
******************************************************************************/
#define TRC_CFG_OBJECT_DATA_SLOTS 40
/*******************************************************************************
* Configuration Macro: TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT
*
* Specifies the number of pages used by the paged event buffer.
* This may need to be increased if there are a lot of missed events.
*
* Note: not used by the J-Link RTT stream port (see trcStreamingPort.h instead)
******************************************************************************/
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT 10
/*******************************************************************************
* Configuration Macro: TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE
*
* Specifies the size of each page in the paged event buffer. This can be tuned
* to match any internal low-level buffers used by the streaming interface, like
* the Ethernet MTU (Maximum Transmission Unit). However, since the currently
* active page can't be transfered, having more but smaller pages is more
* efficient with respect memory usage, than having a few large pages.
*
* Note: not used by the J-Link RTT stream port (see trcStreamingPort.h instead)
******************************************************************************/
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE 500
/*******************************************************************************
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
*
* Macro which should be defined as an integer value.
*
* If tracing multiple ISRs, this setting allows for accurate display of the
* context-switching also in cases when the ISRs execute in direct sequence.
*
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
* context, i.e., a task or a preempted ISR. But if another traced ISR
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
* fragment of the previous context in between the ISRs.
*
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
* however a threshold value that must be measured for your specific setup.
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
*
* The default setting is 0, meaning "disabled" and that you may get an
* extra fragments of the previous context in between tail-chained ISRs.
*
* Note: This setting has separate definitions in trcSnapshotConfig.h and
* trcStreamingConfig.h, since it is affected by the recorder mode.
******************************************************************************/
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_CONFIG_H */

@ -1,152 +0,0 @@
-------------------------------------------------------------------------------
Tracealyzer for FreeRTOS - Trace Recorder Library v3.1.1
-------------------------------------------------------------------------------
Tracealyzer for FreeRTOS is a sophisticated tool for tracing and visualization
of FreeRTOS-based systems. Tracealyzer gives an unprecedented insight into the
runtime behavior, which speeds up debugging, validation and optimization.
To learn more about this, see
- Getting Started (videos etc): http://percepio.com/gettingstarted/tz-freertos/
- User Manual (incl. Recorder API): http://percepio.com/docs/FreeRTOS/manual
- FAQ: http://percepio.com/category/faq/
In case you have any questions, don't hesitate to contact support@percepio.com
-------------------------------------------------------------------------------
Changes, v3.1.1 -> v3.1.2
- Fixed two bugs related to User Events, one in vTracePrintF and other in vTracePrint.
- Fixed a build problem related to a single reference of the old FreeRTOS type "xTaskHandle", in trcKernelPort.c.
Changed to "TaskHandle_t", unless if using an older FreeRTOS kernel or the "compatibility mode".
- Removed traceCREATE_MUTEX hook for FreeRTOS v9 or later (no longer required)
- Updated the User Manual regarding snapshot trace via IAR Embedded Workbench.
- Renamed vTraceGetTraceBuffer to xTraceGetTraceBuffer, since returning a pointer.
-------------------------------------------------------------------------------
Changes, v3.1.0 -> v3.1.1
After the major changes in the v3.1.0 trace recorder library, this update
corrects a number of minor issues. Only minor functional improvements.
- You can now use TRC_ALLOC_CUSTOM_BUFFER to declare a trace buffer on a custom
location (using linker directives).
The related function vTraceSetRecorderDataBuffer has been promoted to the
Common API (previously only supported in snapshot mode, but custom allocation
is now generally supported also in streaming mode).
- Removed TRC_CFG_USE_LINKER_PRAGMA. No longer necessary thanks to the custom
allocation mode.
- Added support for timestamping from custom periodic timers, required for
accurate timestamping on Cortex-M0/M0+ devices when using tickless idle.
Only for streaming mode so far. See TRC_CUSTOM_TIMER_INCR / DECR.
- ARM Cortex-M port: Made sure the DWT unit is initialized properly, in case
the debugger doesn't handle this.
- ARM Cortex-M port: Added possibility to use Systick timestamping also on
Cortex-M3/M4/M7 devices (that otherwise use DWT timestamping by default).
To use this option, define the macro TRC_CFG_ARM_CM_USE_SYSTICK.
- J-Link streaming: The default RTT buffer has been changed from 0 to 1.
- J-Link streaming: The RTT buffer settings for buffer 1 and higher, are now
found in trcStreamingPort.h. Note: These settings don't apply to buffer 0.
- vTracePrint has been optimized for better performance in string logging.
- Minor performance improvement related to symbol table transfer in streaming mode.
- Timer names now registered also in streaming mode.
- Timer start and stop event are now traced.
- Implemented support for queue registry (traceQUEUE_REGISTRY_ADD) also for streaming.
- Fixed a bug related to repeated calls of vTraceEnable.
- Fixed a bug where task-switches seemed to occur even though the scheduler was disabled.
- Renamed HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48, added prefix TRC.
- Fixed several language issues in the comments and documentation.
- Fixed several minor issues and warnings from different compilers
(including PowerPC/gcc) and configurations.
-------------------------------------------------------------------------------
Changes, v3.0.9 -> v3.1.0
- Merge of previously separated snapshot and streaming recorders into a single
recorder supporting both streaming and snapshot as different modes.
- New common API for supporting both streaming and snapshot modes.
- New integration guide, see the User Manual.
- Major improvement of API documentation in source files and User Manual.
- New concept of "stream ports", giving a better structure defining streaming
interfaces, and restructured the J-Link and TCP/IP streaming as stream ports.
- Added a stream port for USB CDC connections, with STM32 as example.
Since Tracealyzer now can receive serial data on Windows COM ports, this is
really easy to use.
- Added a warning (#error) for cases where FreeRTOS tickless idle mode is used
together with timestamping using SysTick or other periodic interrupt timers,
Tracing with tickless idle requires an independent time source to correctly
capture the length of the idle periods.
- Major changes in the recorder API. Important examples are:
* Some configuration macros have changed names, e.g. for "hardware port".
Make sure to remove any old "trcConfig.h" files if upgrading from an
earlier version!
* Recorder configuration in trcConfig.h has been minimized and now only
includes the important settings that are independent of recorder mode.
Advanced settings for each mode are found in trcSnapshotConfig.h and
trcStreamingConfig.h.
* vTraceEnable replaces Trace_Init and vTraceInitTraceData, as well as
vTraceStart and uiTraceStart.
* vTraceStop now part of the common API and thereby available also in
streaming. And since vTraceEnable can start the streaming directly
you have the option control the tracing from target, e.g., for
streaming to a device file system.
* vTraceStoreKernelObjectName from old streaming recorder has been replaced
by vTraceSetQueueName, vTraceSetSemaphoreName, etc.
* vTraceSetISRProperties now returns a "traceHandle" that should be passed as
parameter to vTraceStoreISRBegin and vTraceStoreISREnd.
* xTraceRegisterString has replaced the old functions xTraceOpenLabel and
vTraceStoreUserEventChannelName. This now returns a "traceString" for use
as "channel" parameter in vTracePrintF, and in other places where strings
are stored.
* Removed vTraceStoreISREndManual and vTraceStoreISREndAuto, use
vTraceStoreISREnd instead.
* Renamed the functions for saving User Events in a separate buffer:
- xTraceRegisterChannelFormat -> xTraceRegisterUBChannel
- vTraceChannelPrintF -> vTraceUBData
- vTraceChannelUserEvent -> vTraceUBEvent
-------------------------------------------------------------------------------
Copyright Percepio AB, 2017.

@ -0,0 +1,22 @@
Tracealyzer Stream Port for Amazon FreeRTOS TCP/WIFI
----------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port is for streaming via a TCP socket in Amazon
FreeRTOS (AFR) directly to a host computer on the local network, typically
using Wifi. Read more in trcStreamingPort.h.
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
See also http://percepio.com/2016/10/05/rtos-tracing
and https://percepio.com/2018/10/11/tuning-your-custom-trace-streaming/
Percepio AB
www.percepio.com

@ -0,0 +1,161 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* This stream port provides trace streaming using the Amazon FreeRTOS sockets
* layer and is intended for streaming over Wifi directly to a computer on the
* local Wifi network.
*
* Note that this does NOT use the TLS encryption available in Amazon
* FreeRTOS, due to performance and memory usage concerns. However, it does not
* use any AWS services either, and is intended for your local network only.
*
* This should be started using vTraceEnable(TRC_START) and this call should be
* made AFTER the kernel has started and the Wifi interface is ready.
*
* In the Tracealyzer setting -> "PSF Streaming Settings" make sure that the
* "Target Connection" setting is "TCP (Target Initiated)".
*
* To use this, make sure to start the trace recording in Tracealyzer before
* you start your target system. This ensures that Tracealyzer is ready when
* the target system connects.
*
* And don't forget to enter the IP address of the Tracealyzer host computer
* in trcStreamingPort.h.
*
* NOTES:
*
* 1: The tracing will increase the stack usage of you application, so you
* may want to increase configMINIMAL_STACK_SIZE in your FreeRTOSConfig.h.
*
* 2: To reduce the amount of trace data, we recommend disabling the tracing
* of OS Ticks and memory allocation events.
* See TRC_CFG_INCLUDE_OSTICK_EVENTS in trcConfig.h.
*
* 3: The transmission of trace data is done in the TzCtrl task. To avoid that
* the trace streaming is blocked during the (long) MQTT connection phase,
* make sure the scheduling priority of TzCtrl is higher than the MQTT task.
* Otherwise, if you prefer to run the TzCtrl task at lower priority to avoid
* interfering with your application, wait with the vTraceEnable call until
* after the MQTT connection is established.
* See TRC_CFG_CTRL_TASK_PRIORITY in trcStreamingConfig.h.
*
* 4: The Wifi transmission of trace data often uses FreeRTOS functions, that
* are traced and thus produce additional trace data. This may cause a fast
* increase in trace data rate, that may saturate the trace buffer and cause
* data loss (i.e. incomplete traces).
* To eliminate this effect and reduce the amount of trace data produced, we
* recommend excluding all FreeRTOS objects that are used by Wifi stack.
* This is done using vTraceSetFilterGroup and vTraceSetFilterMask:
*
* // Just before wifi initialization:
*
* // All objects created after this point are assigned to group 15.
* vTraceSetFilterGroup(FilterGroup15);
*
* // Only trace objects assigned to group 0 (the default group).
* vTraceSetFilterMask(FilterGroup0);
*
* // The wifi stack initialization... (creates semaphores etc.)
* if ( eWifi_Connected == prvWifiConnect() )
* {
* yMainState = eMain_StartApplication;
*
* // When connected, restore the FilterGroup setting to Group 0, so
* // that later created objects are included, like the TzCtrl task
* // created in vTraceEnable. Excluding tasks is not recommended!
* vTraceSetFilterGroup(FilterGroup0);
*
* // Then call vTraceEnable to start the tracing.
* vTraceEnable(TRC_START);
* }
*
* 5: If you still get "red sections" in Tracealyzer (lost data), you need
* to adjust the other settings in trcStreamingConfig.h.
*
* - TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT
* Increase this, as long as you have memory to spare.
*
* - TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE
* Increase this, as long as you have memory to spare.
* But don't exceed the maximum payload size of the Wifi chip, which
* is often limited to 1000-1500 bytes. Some chips crash if you try to
* send to large chunks...
*
* - TRC_CFG_CTRL_TASK_DELAY
* Decrease this to flush the trace buffer more frequently.
*
* See also http://percepio.com/2016/10/05/rtos-tracing
* and https://percepio.com/2018/10/11/tuning-your-custom-trace-streaming/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
#define HOST_IPADDRESS_0 192
#define HOST_IPADDRESS_1 168
#define HOST_IPADDRESS_2 10
#define HOST_IPADDRESS_3 116
#define HOST_PORT 12000
void prvInitSocket(void);
int32_t prvReadFromSocket(void* ptrData, uint32_t size, int32_t* ptrBytesRead);
int32_t prvWriteToSocket(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); \
prvInitSocket();
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) prvWriteToSocket(_ptrData, _size, _ptrBytesWritten)
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) prvReadFromSocket(_ptrData, _size, _ptrBytesRead)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -0,0 +1,191 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* This stream port provides trace streaming using the Amazon FreeRTOS sockets
* layer and is intended for streaming over Wifi directly to a computer on the
* local Wifi network.
*
* Note that this does NOT use the TLS encryption available in Amazon
* FreeRTOS, due to performance and memory usage concerns. However, it does not
* use any AWS services either, and is intended for your local network only.
*
* This should be started using vTraceEnable(TRC_START) and this call should be
* made AFTER the kernel has started and the Wifi interface is ready.
*
* In the Tracealyzer setting -> "PSF Streaming Settings" make sure that the
* "Target Connection" setting is "TCP (Target Initiated)".
*
* To use this, make sure to start the trace recording in Tracealyzer before
* you start your target system. This ensures that Tracealyzer is ready when
* the target system connects.
*
* And don't forget to enter the IP address of the Tracealyzer host computer
* in trcStreamingPort.h.
*
* NOTES:
*
* 1: The tracing will increase the stack usage of you application, so you
* may want to increase configMINIMAL_STACK_SIZE in your FreeRTOSConfig.h.
*
* 2: To reduce the amount of trace data, we recommend disabling the tracing
* of OS Ticks and memory allocation events.
* See TRC_CFG_INCLUDE_OSTICK_EVENTS in trcConfig.h.
*
* 3: The transmission of trace data is done in the TzCtrl task. To avoid that
* the trace streaming is blocked during the (long) MQTT connection phase,
* make sure the scheduling priority of TzCtrl is higher than the MQTT task.
* Otherwise, if you prefer to run the TzCtrl task at lower priority to avoid
* interfering with your application, wait with the vTraceEnable call until
* after the MQTT connection is established.
* See TRC_CFG_CTRL_TASK_PRIORITY in trcStreamingConfig.h.
*
* 4: The Wifi transmission of trace data often uses FreeRTOS functions, that
* are traced and thus produce additional trace data. This may cause a fast
* increase in trace data rate, that may saturate the trace buffer and cause
* data loss (i.e. incomplete traces).
* To eliminate this effect and reduce the amount of trace data produced, we
* recommend excluding all FreeRTOS objects that are used by Wifi stack.
* This is done using vTraceSetFilterGroup and vTraceSetFilterMask:
*
* // Just before wifi initialization:
*
* // All objects created after this point are assigned to group 15.
* vTraceSetFilterGroup(FilterGroup15);
*
* // Only trace objects assigned to group 0 (the default group).
* vTraceSetFilterMask(FilterGroup0);
*
* // The wifi stack initialization... (creates semaphores etc.)
* if ( eWifi_Connected == prvWifiConnect() )
* {
* yMainState = eMain_StartApplication;
*
* // When connected, restore the FilterGroup setting to Group 0, so
* // that later created objects are included, like the TzCtrl task
* // created in vTraceEnable. Excluding tasks is not recommended!
* vTraceSetFilterGroup(FilterGroup0);
*
* // Then call vTraceEnable to start the tracing.
* vTraceEnable(TRC_START);
* }
*
* 5: If you still get "red sections" in Tracealyzer (lost data), you need
* to adjust the other settings in trcStreamingConfig.h.
*
* - TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT
* Increase this, as long as you have memory to spare.
*
* - TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE
* Increase this, as long as you have memory to spare.
* But don't exceed the maximum payload size of the Wifi chip, which
* is often limited to 1000-1500 bytes. Some chips crash if you try to
* send to large chunks...
*
* - TRC_CFG_CTRL_TASK_DELAY
* Decrease this to flush the trace buffer more frequently.
*
* See also http://percepio.com/2016/10/05/rtos-tracing
* and https://percepio.com/2018/10/11/tuning-your-custom-trace-streaming/
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#include "aws_secure_sockets.h"
#include "trcExtensions.h"
SocketsSockaddr_t addr = {sizeof(SocketsSockaddr_t), SOCKETS_AF_INET, 0, 0};
#define IPv4(a,b,c,d) (uint32_t)((d << 24) + (c << 16) + (b << 8) + a)
Socket_t sock = NULL;
void prvInitSocket(void)
{
int32_t status;
SOCKETS_Init();
sock = SOCKETS_Socket(SOCKETS_AF_INET, SOCKETS_SOCK_STREAM, SOCKETS_IPPROTO_TCP);
configPRINTF( ( "Connecting to %d.%d.%d.%d, port %d\r\n", HOST_IPADDRESS_0, HOST_IPADDRESS_1, HOST_IPADDRESS_2, HOST_IPADDRESS_3, HOST_PORT) );
addr.ulAddress = IPv4(HOST_IPADDRESS_0, HOST_IPADDRESS_1, HOST_IPADDRESS_2, HOST_IPADDRESS_3);
addr.usPort = SOCKETS_htons(HOST_PORT);
status = SOCKETS_Connect(sock, &addr, sizeof( SocketsSockaddr_t ) );
if (status != SOCKETS_ERROR_NONE)
{
//prvTraceError(PSF_ERROR_STREAM_PORT_FAIL);
configPRINTF( ( "Failed to connect, status: %d\r\n", status) );
}
else
{
configPRINTF( ( "Connected.\r\n") );
}
}
int32_t prvWriteToSocket(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)
{
uint32_t bytesWritten = SOCKETS_Send(sock, ptrData, size, 0);
if (ptrBytesWritten != NULL)
*ptrBytesWritten = (int32_t)bytesWritten;
if (bytesWritten != size)
{
return -1;
}
return 0;
}
int32_t prvReadFromSocket(void* ptrData, uint32_t size, int32_t* ptrBytesRead)
{
// Not yet implemented, since not necessary.
return 0;
}
#endif
#endif

@ -1,28 +1,32 @@
Tracealyzer Stream Port for ARM Cortex-M ITM
--------------------------------------------
2018-05-04
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets ARM's ITM interface, which together with
a fast debug probe such as a Keil ULINKpro or ULINKplus provides excellent
performance. This stream port does not use any RAM buffer for the trace, but
writes the data directly to the ITM registers. This is very fast.
To setup Keil uVision for ITM tracing with a Keil ULINKpro (or ULINKplus),
see Percepio Application Note PA-021 https://percepio.com/2018/05/04/keil-itm-support/
Learning more:
- Tracealyzer User Manual (Help -> User Manual)
- https://percepio.com/gettingstarted
- Percepio Application Note PA-021 https://percepio.com/2018/05/04/keil-itm-support/
- About ITM trace, https://percepio.com/2016/06/09/arm-itm/
- About the recorder and custom streaming, http://percepio.com/2016/10/05/rtos-tracing
For questions, please contact support@percepio.com
Percepio AB
Tracealyzer Stream Port for ARM Cortex-M ITM
--------------------------------------------
2018-05-04
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets ARM's ITM interface, which together with
a fast debug probe such as a Keil ULINKpro or ULINKplus provides excellent
performance. This stream port does not use any RAM buffer for the trace, but
writes the data directly to the ITM registers. This is very fast.
To setup Keil uVision for ITM tracing with a Keil ULINKpro (or ULINKplus),
see Percepio Application Note PA-021, https://percepio.com/2018/05/04/keil-itm-support/
To setup IAR Embedded Workbench for ITM tracing with an IAR I-Jet,
see Percepio Application Note PA-023, https://percepio.com/iar
Learning more:
- Tracealyzer User Manual (Help -> User Manual)
- https://percepio.com/gettingstarted
- Percepio Application Note PA-021 (Keil), https://percepio.com/2018/05/04/keil-itm-support/
- Percepio Application Note PA-023 (IAR), https://percepio.com/iar
- About ITM trace, https://percepio.com/2016/06/09/arm-itm/
- About the recorder and custom streaming, http://percepio.com/2016/10/05/rtos-tracing
For questions, please contact support@percepio.com
Percepio AB
www.percepio.com

@ -1,91 +1,137 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use ARM ITM as streaming channel.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
int32_t itm_write(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);
int32_t read_from_host(void* ptrData, uint32_t size, int32_t* ptrBytesRead);
/*******************************************************************************
* TRC_CFG_ITM_PORT
*
* Possible values: 0 - 31
*
* What ITM port to use for the ITM software events. Make sure the IDE is
* configured for the same channel.
*
* Default: 1 (0 is typically terminal output and 31 is used by Keil)
*
******************************************************************************/
#define TRC_CFG_ITM_PORT 1
#if (TRC_CFG_ITM_PORT < 0) || (TRC_CFG_ITM_PORT > 31)
#error "Bad ITM port selected."
#endif
// Not used for ITM - no RAM buffer...
#define TRC_STREAM_PORT_ALLOCATE_FIELDS()
// Not used for ITM - assume the IDE configures the ITM setup
#define TRC_STREAM_PORT_INIT()
/* Important for the ITM port - no RAM buffer, direct writes. In most other ports this can be skipped (default is 1) */
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) itm_write(_ptrData, _size, _ptrBytesWritten)
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) read_from_host(_ptrData, _size, _ptrBytesRead)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use ARM ITM as streaming channel.
*
* To setup Keil uVision for ITM tracing with a Keil ULINKpro (or ULINKplus),
* see Percepio Application Note PA-021, available at
* https://percepio.com/2018/05/04/keil-itm-support/
*
* To setup IAR Embedded Workbench for ITM tracing with an IAR I-Jet,
* see Percepio Application Note PA-023, https://percepio.com/iar
*
* NOTE: This stream port may block the application in case the ITM port
* is not ready for more data (the TPIU FIFO has become full). This is
* necessary to avoid data loss, as the TPIU FIFO is often quite small.
*
* --- Direct vs. Indirect ITM streaming ---
* Direct streaming: By default, this stream port writes directly to the ITM
* register mode without any RAM buffer. This assumes you have a fast debug
* probe, like aKeil ULINKpro or IAR I-Jet, to avoid excessive blocking.
* In case the ITM blocking appears to disturb your application, make sure your
* debugger is configured for maximum performance, as described in the above
* Application Nodes.
*
* Indirect streaming: If direct streaming gives too much overhead, you may
* instead try indirect ITM streaming. This is done by enabling the internal
* RAM buffer, like below. This reconfigures the recorder to store the events
* in the internal RAM buffer instead of writing them directly to the ITM port.
*
* Set TRC_STREAM_PORT_USE_INTERNAL_BUFFER to 1 to use the indirect mode.
*
* This increases RAM usage but eliminates peaks in the trace data rate.
* Moreover, the ITM writes are then performed in a separate task (TzCtrl).
* You find relevant settings (buffer size etc.) in trcStreamingConfig.h.
*
* See also https://percepio.com/2018/10/11/tuning-your-custom-trace-streaming
*
* --- One-way vs. Two-way Communication ---
* The ITM port only provides one-way communication, from target to host.
* This is sufficient if you start the tracing from the target application,
* using vTraceEnable(TRC_START). Just make sure to start the Tracealyzer
* recording before you start the target system.
*
* In case you prefer to interactively start and stop the tracing from the host
* computer, you need two-way communication to send commands to the recorder.
* This is possible by writing such "start" and "stop" commands to a special
* buffer, monitored by the recorder library, using the debugger IDE.
* See trcStreamingPort.c and also the example macro for Keil uVision
* (Keil-uVision-Tracealyzer-ITM-Exporter.ini).
*
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
int32_t itm_write(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);
int32_t read_from_host(void* ptrData, uint32_t size, int32_t* ptrBytesRead);
/*******************************************************************************
* TRC_CFG_ITM_PORT
*
* Possible values: 0 - 31
*
* What ITM port to use for the ITM software events. Make sure the IDE is
* configured for the same channel.
*
* Default: 1 (0 is typically terminal output and 31 is used by Keil)
*
******************************************************************************/
#define TRC_CFG_ITM_PORT 1
#if (TRC_CFG_ITM_PORT < 0) || (TRC_CFG_ITM_PORT > 31)
#error "Bad ITM port selected."
#endif
// Not used for ITM - no RAM buffer...
#define TRC_STREAM_PORT_ALLOCATE_FIELDS()
// Not used for ITM - assume the IDE configures the ITM setup
#define TRC_STREAM_PORT_INIT()
/* Important for the ITM port - no RAM buffer, direct writes. In most other ports this can be skipped (default is 1) */
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) itm_write(_ptrData, _size, _ptrBytesWritten)
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) read_from_host(_ptrData, _size, _ptrBytesRead)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -1,71 +1,169 @@
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
static void itm_write_32(uint32_t data);
volatile int32_t tz_host_command_bytes_to_read = 0; // This is set by the Tracealyzer host application (to the number of bytes written), after having written to tz_host_commands. Set to zero by the read function after the message in tz_host_commands has been read.
volatile char tz_host_command_data[32];
/* This reads "command" data from a RAM buffer, written by a host macro in the debugger */
int32_t read_from_host(void* ptrData, uint32_t size, int32_t* ptrBytesRead)
{
if ( tz_host_command_bytes_to_read > 0)
{
int i;
uint8_t * bytesBuffer = (uint8_t*) ptrData;
if (ptrBytesRead != NULL)
*ptrBytesRead = (int32_t)tz_host_command_bytes_to_read;
if (tz_host_command_bytes_to_read != size)
{
return -1;
}
for (i=0; i < tz_host_command_bytes_to_read; i++)
{
bytesBuffer[i] = tz_host_command_data[i];
}
tz_host_command_bytes_to_read = 0;
}
return 0;
}
static void itm_write_32(uint32_t data)
{
if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) && // Trace enabled
(ITM->TCR & ITM_TCR_ITMENA_Msk) && // ITM enabled
(ITM->TER & (1UL << TRC_CFG_ITM_PORT))) // ITM port enabled
{
while (ITM->PORT[TRC_CFG_ITM_PORT].u32 == 0); // Block until room in ITM FIFO - This stream port is always in "blocking mode", since intended for high-speed ITM!
ITM->PORT[TRC_CFG_ITM_PORT].u32 = data; // Write the data
}
}
/* This is assumed to execute from within the recorder, with interrupts disabled */
int32_t itm_write(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)
{
uint32_t bytesWritten = 0;
uint32_t* ptr32 = (uint32_t*)ptrData;
if (size % 4 != 0) return -2;
while(bytesWritten < size)
{
itm_write_32(*ptr32);
ptr32++;
bytesWritten += 4;
}
*ptrBytesWritten = bytesWritten;
return 0;
}
#endif
#endif
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
* Existing ports can easily be modified to fit another setup, e.g., a
* different TCP/IP stack, or to define your own stream port.
*
* This stream port is for ITM streaming on Arm Cortex-M devices.
*
* To setup Keil uVision for ITM tracing with a Keil ULINKpro (or ULINKplus),
* see Percepio Application Note PA-021, available at
* https://percepio.com/2018/05/04/keil-itm-support/
*
* To setup IAR Embedded Workbench for ITM tracing with an IAR I-Jet,
* see Percepio Application Note PA-023, https://percepio.com/iar
*
* NOTE: This stream port may block the application in case the ITM port
* is not ready for more data (the TPIU FIFO has become full). This is
* necessary to avoid data loss, as the TPIU FIFO is often quite small.
*
* --- Direct vs. Indirect ITM streaming ---
* Direct streaming: By default, this stream port writes directly to the ITM
* register mode without any RAM buffer. This assumes you have a fast debug
* probe, like aKeil ULINKpro or IAR I-Jet, to avoid excessive blocking.
* In case the ITM blocking appears to disturb your application, make sure your
* debugger is configured for maximum performance, as described in the above
* Application Nodes.
*
* Indirect streaming: If direct streaming gives too much overhead, you may
* instead try indirect ITM streaming. This is done by enabling the internal
* RAM buffer, like below. This reconfigures the recorder to store the events
* in the internal RAM buffer instead of writing them directly to the ITM port.
*
* Set TRC_STREAM_PORT_USE_INTERNAL_BUFFER to 1 to use the indirect mode.
*
* This increases RAM usage but eliminates peaks in the trace data rate.
* Moreover, the ITM writes are then performed in a separate task (TzCtrl).
* You find relevant settings (buffer size etc.) in trcStreamingConfig.h.
*
* See also https://percepio.com/2018/10/11/tuning-your-custom-trace-streaming
*
* --- One-way vs. Two-way Communication ---
* The ITM port only provides one-way communication, from target to host.
* This is sufficient if you start the tracing from the target application,
* using vTraceEnable(TRC_START). Just make sure to start the Tracealyzer
* recording before you start the target system.
*
* In case you prefer to interactively start and stop the tracing from the host
* computer, you need two-way communication to send commands to the recorder.
* This is possible by writing such "start" and "stop" commands to a special
* buffer, monitored by the recorder library, using the debugger IDE.
* See trcStreamingPort.c and also the example macro for Keil uVision
* (Keil-uVision-Tracealyzer-ITM-Exporter.ini).
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
static void itm_write_32(uint32_t data);
/* These variables are used for reading commands from the host, using read_from_host().
* This is not required if using vTraceEnable(TRC_START).
* A debugger IDE may write to these functions using a macro.
* An example for Keil is included (Keil-uVision-Tracealyzer-ITM-Exporter.ini). */
volatile int32_t tz_host_command_bytes_to_read = 0;
volatile char tz_host_command_data[32];
/* This reads "command" data from a RAM buffer, written by a host macro in the debugger */
int32_t read_from_host(void* ptrData, uint32_t size, int32_t* ptrBytesRead)
{
if ( tz_host_command_bytes_to_read > 0)
{
int i;
uint8_t * bytesBuffer = (uint8_t*) ptrData;
if (ptrBytesRead != NULL)
*ptrBytesRead = (int32_t)tz_host_command_bytes_to_read;
if (tz_host_command_bytes_to_read != size)
{
return -1;
}
for (i=0; i < tz_host_command_bytes_to_read; i++)
{
bytesBuffer[i] = tz_host_command_data[i];
}
tz_host_command_bytes_to_read = 0;
}
return 0;
}
static void itm_write_32(uint32_t data)
{
if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) && // Trace enabled
(ITM->TCR & ITM_TCR_ITMENA_Msk) && // ITM enabled
(ITM->TER & (1UL << TRC_CFG_ITM_PORT))) // ITM port enabled
{
while (ITM->PORT[TRC_CFG_ITM_PORT].u32 == 0); // Block until room in ITM FIFO - This stream port is always in "blocking mode", since intended for high-speed ITM!
ITM->PORT[TRC_CFG_ITM_PORT].u32 = data; // Write the data
}
}
/* This is assumed to execute from within the recorder, with interrupts disabled */
int32_t itm_write(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)
{
uint32_t bytesWritten = 0;
uint32_t* ptr32 = (uint32_t*)ptrData;
if (size % 4 != 0) return -2;
while(bytesWritten < size)
{
itm_write_32(*ptr32);
ptr32++;
bytesWritten += 4;
}
*ptrBytesWritten = bytesWritten;
return 0;
}
#endif
#endif

@ -1,19 +1,19 @@
Tracealyzer Stream Port for Files
-------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port is for streaming to a file via stdio.h (fwrite).
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
Tracealyzer Stream Port for Files
-------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port is for streaming to a file via stdio.h (fwrite).
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
www.percepio.com

@ -1,87 +1,87 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to stream the trace to file.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten);
void closeFile(void);
void openFile(char* fileName);
/* This define will determine whether to use the internal PagedEventBuffer or not.
If file writing creates additional trace events (i.e. it uses semaphores or mutexes),
then the paged event buffer must be enabled to avoid infinite recursion. */
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) 0 /* Does not read commands from Tz (yet) */
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) writeToFile(_ptrData, _size, _ptrBytesSent)
#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)
#define TRC_STREAM_PORT_MALLOC() \
_TzTraceData = TRC_PORT_MALLOC((TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE));
extern char* _TzTraceData;
#else
#define TRC_STREAM_PORT_MALLOC() /* Custom or static allocation. Not used. */
#endif
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); \
openFile("trace.psf")
#define TRC_STREAM_PORT_ON_TRACE_END() closeFile()
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to stream the trace to file.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten);
void closeFile(void);
void openFile(char* fileName);
/* This define will determine whether to use the internal PagedEventBuffer or not.
If file writing creates additional trace events (i.e. it uses semaphores or mutexes),
then the paged event buffer must be enabled to avoid infinite recursion. */
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) 0 /* Does not read commands from Tz (yet) */
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) writeToFile(_ptrData, _size, _ptrBytesSent)
#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)
#define TRC_STREAM_PORT_MALLOC() \
_TzTraceData = TRC_PORT_MALLOC((TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE));
extern char* _TzTraceData;
#else
#define TRC_STREAM_PORT_MALLOC() /* Custom or static allocation. Not used. */
#endif
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); \
openFile("trace.psf")
#define TRC_STREAM_PORT_ON_TRACE_END() closeFile()
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -1,103 +1,103 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
* Existing ports can easily be modified to fit another setup, e.g., a
* different TCP/IP stack, or to define your own stream port.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
FILE* traceFile = NULL;
void openFile(char* fileName)
{
if (traceFile == NULL)
{
errno_t err = fopen_s(&traceFile, fileName, "wb");
if (err != 0)
{
printf("Could not open trace file, error code %d.\n", err);
exit(-1);
}
else {
printf("Trace file created.\n");
}
}
}
int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten)
{
int32_t written = 0;
if (traceFile != NULL)
{
written = fwrite(data, 1, size, traceFile);
}
else
{
written = 0;
}
if (ptrBytesWritten != 0)
*ptrBytesWritten = written;
if ((int32_t)size == written)
return 0;
else
return -1;
}
void closeFile(void)
{
if (traceFile != NULL)
{
fclose(traceFile);
traceFile = NULL;
printf("Trace file closed.\n");
}
}
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
* Existing ports can easily be modified to fit another setup, e.g., a
* different TCP/IP stack, or to define your own stream port.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
FILE* traceFile = NULL;
void openFile(char* fileName)
{
if (traceFile == NULL)
{
errno_t err = fopen_s(&traceFile, fileName, "wb");
if (err != 0)
{
printf("Could not open trace file, error code %d.\n", err);
exit(-1);
}
else {
printf("Trace file created.\n");
}
}
}
int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten)
{
int32_t written = 0;
if (traceFile != NULL)
{
written = fwrite(data, 1, size, traceFile);
}
else
{
written = 0;
}
if (ptrBytesWritten != 0)
*ptrBytesWritten = written;
if ((int32_t)size == written)
return 0;
else
return -1;
}
void closeFile(void)
{
if (traceFile != NULL)
{
fclose(traceFile);
traceFile = NULL;
printf("Trace file closed.\n");
}
}
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/

@ -1,22 +1,22 @@
Tracealyzer Stream Port for SEGGER J-Link
-----------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets SEGGER J-Link debug probes, using the RTT
interface provided by SEGGER.
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
Note that this stream port also contains SEGGER's RTT driver.
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
Tracealyzer Stream Port for SEGGER J-Link
-----------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets SEGGER J-Link debug probes, using the RTT
interface provided by SEGGER.
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
Note that this stream port also contains SEGGER's RTT driver.
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
www.percepio.com

@ -78,6 +78,10 @@ Revision: $Rev: 3892 $
#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
// This can be used to place the RTT control block in the right memory range, if no found automatically.
// This example is for NXP LPC54018, needs to be adapted for each MCU family.
//#define SEGGER_RTT_SECTION ".data.$RAM2"
//
// Target is not allowed to perform other RTT operations while string still has not been stored completely.
// Otherwise we would probably end up with a mixed string in the buffer.

@ -1,196 +1,196 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use SEGGER RTT as streaming channel.
*
* Note that this stream port is more complex than the typical case, since
* the J-Link interface uses a separate RAM buffer in SEGGER_RTT.c, instead
* of the default buffer included in the recorder core. The other stream ports
* offer more typical examples of how to define a custom streaming interface.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_BUFFER_SIZE_UP
*
* Defines the size of the "up" RTT buffer (target -> host) to use for writing
* the trace data, for RTT buffer 1 or higher.
*
* This setting is ignored for RTT buffer 0, which can't be reconfigured
* in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
*
* Default buffer size for Tracealyzer is 5000 bytes.
*
* If you have a stand-alone J-Link probe, the can be decreased to around 1 KB.
* But integrated J-Link OB interfaces are slower and needs about 5-10 KB,
* depending on the amount of data produced.
******************************************************************************/
#define TRC_CFG_RTT_BUFFER_SIZE_UP 5000
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_BUFFER_SIZE_DOWN
*
* Defines the size of the "down" RTT buffer (host -> target) to use for reading
* commands from Tracealyzer, for RTT buffer 1 or higher.
*
* Default buffer size for Tracealyzer is 32 bytes.
*
* This setting is ignored for RTT buffer 0, which can't be reconfigured
* in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
******************************************************************************/
#define TRC_CFG_RTT_BUFFER_SIZE_DOWN 32
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_UP_BUFFER_INDEX
*
* Defines the RTT buffer to use for writing the trace data. Make sure that
* the PC application has the same setting (File->Settings).
*
* Default: 1
*
* We don't recommend using RTT buffer 0, since mainly intended for terminals.
* If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
******************************************************************************/
#define TRC_CFG_RTT_UP_BUFFER_INDEX 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_DOWN_BUFFER_INDEX
*
* Defines the RTT buffer to use for reading the trace data. Make sure that
* the PC application has the same setting (File->Settings).
*
* Default: 1
*
* We don't recommend using RTT buffer 0, since mainly intended for terminals.
* If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
******************************************************************************/
#define TRC_CFG_RTT_DOWN_BUFFER_INDEX 1
/*******************************************************************************
* TRC_CFG_RTT_MODE
* This stream port for J-Link streaming relies on SEGGER RTT, that contains an
* internal RAM buffer read by the J-Link probes during execution.
*
* Possible values:
* - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
* - SEGGER_RTT_MODE_NO_BLOCK_SKIP (default)
*
* Using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL ensure that you get a
* complete and valid trace. This may however cause blocking if your streaming
* interface isn't fast enough, which may disturb the real-time behavior.
*
* We therefore recommend SEGGER_RTT_MODE_NO_BLOCK_SKIP. In this mode,
* Tracealyzer will report lost events if the transfer is not
* fast enough. In that case, try increasing the size of the "up buffer".
******************************************************************************/
#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_NO_BLOCK_SKIP
#include "SEGGER_RTT_Conf.h"
#include "SEGGER_RTT.h"
#if (TRC_CFG_RTT_UP_BUFFER_INDEX >= SEGGER_RTT_MAX_NUM_UP_BUFFERS)
#error "TRC_CFG_RTT_UP_BUFFER_INDEX must be smaller than SEGGER_RTT_MAX_NUM_UP_BUFFERS"
#endif
#if (TRC_CFG_RTT_DOWN_BUFFER_INDEX >= SEGGER_RTT_MAX_NUM_DOWN_BUFFERS)
#error "TRC_CFG_RTT_DOWN_BUFFER_INDEX must be smaller than SEGGER_RTT_MAX_NUM_DOWN_BUFFERS"
#endif
/* If index is defined as 0, the internal RTT buffers will be used instead of this. */
#if TRC_CFG_RTT_UP_BUFFER_INDEX == 0
#define TRC_RTT_ALLOC_UP() static char* _TzTraceData = NULL; /* Not actually used. Ignore allocation method. */
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
#else
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
#define TRC_RTT_ALLOC_UP() char _TzTraceData[TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Static allocation */
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
#endif
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Dynamic allocation */
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_RTT_BUFFER_SIZE_UP);
#endif
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Custom allocation, user needs to call vTraceSetRecorderDataBuffer before vTraceEnable, to assign this */
#define TRC_STREAM_PORT_MALLOC() /* Not used in custom mode */
#endif
#endif
/* Down-buffer. If index is defined as 0, the internal RTT buffers will be used instead of this. */ \
#if TRC_CFG_RTT_DOWN_BUFFER_INDEX == 0
#define TRC_RTT_ALLOC_DOWN() static char* _TzCtrlData = NULL; /* Not actually used. Ignore allocation method. */
#else
#define TRC_RTT_ALLOC_DOWN() static char _TzCtrlData[TRC_CFG_RTT_BUFFER_SIZE_DOWN]; /* Always static allocation, since usually small. */
#endif
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() \
TRC_RTT_ALLOC_UP() /* Macro that will result in proper UP buffer allocation */ \
TRC_RTT_ALLOC_DOWN() /* Macro that will result in proper DOWN buffer allocation */
int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead);
int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
SEGGER_RTT_ConfigUpBuffer(TRC_CFG_RTT_UP_BUFFER_INDEX, "TzData", _TzTraceData, TRC_CFG_RTT_BUFFER_SIZE_UP, TRC_CFG_RTT_MODE ); \
SEGGER_RTT_ConfigDownBuffer(TRC_CFG_RTT_DOWN_BUFFER_INDEX, "TzCtrl", _TzCtrlData, TRC_CFG_RTT_BUFFER_SIZE_DOWN, TRC_CFG_RTT_MODE);
/* Important for the J-Link port, in most other ports this can be skipped (default is 1) */
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) writeToRTT(_ptrData, _size, _ptrBytesWritten)
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) readFromRTT(_ptrData, _size, _ptrBytesRead)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use SEGGER RTT as streaming channel.
*
* Note that this stream port is more complex than the typical case, since
* the J-Link interface uses a separate RAM buffer in SEGGER_RTT.c, instead
* of the default buffer included in the recorder core. The other stream ports
* offer more typical examples of how to define a custom streaming interface.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_BUFFER_SIZE_UP
*
* Defines the size of the "up" RTT buffer (target -> host) to use for writing
* the trace data, for RTT buffer 1 or higher.
*
* This setting is ignored for RTT buffer 0, which can't be reconfigured
* in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
*
* Default buffer size for Tracealyzer is 5000 bytes.
*
* If you have a stand-alone J-Link probe, the can be decreased to around 1 KB.
* But integrated J-Link OB interfaces are slower and needs about 5-10 KB,
* depending on the amount of data produced.
******************************************************************************/
#define TRC_CFG_RTT_BUFFER_SIZE_UP 5000
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_BUFFER_SIZE_DOWN
*
* Defines the size of the "down" RTT buffer (host -> target) to use for reading
* commands from Tracealyzer, for RTT buffer 1 or higher.
*
* Default buffer size for Tracealyzer is 32 bytes.
*
* This setting is ignored for RTT buffer 0, which can't be reconfigured
* in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
******************************************************************************/
#define TRC_CFG_RTT_BUFFER_SIZE_DOWN 32
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_UP_BUFFER_INDEX
*
* Defines the RTT buffer to use for writing the trace data. Make sure that
* the PC application has the same setting (File->Settings).
*
* Default: 1
*
* We don't recommend using RTT buffer 0, since mainly intended for terminals.
* If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
******************************************************************************/
#define TRC_CFG_RTT_UP_BUFFER_INDEX 1
/*******************************************************************************
* Configuration Macro: TRC_CFG_RTT_DOWN_BUFFER_INDEX
*
* Defines the RTT buffer to use for reading the trace data. Make sure that
* the PC application has the same setting (File->Settings).
*
* Default: 1
*
* We don't recommend using RTT buffer 0, since mainly intended for terminals.
* If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
******************************************************************************/
#define TRC_CFG_RTT_DOWN_BUFFER_INDEX 1
/*******************************************************************************
* TRC_CFG_RTT_MODE
* This stream port for J-Link streaming relies on SEGGER RTT, that contains an
* internal RAM buffer read by the J-Link probes during execution.
*
* Possible values:
* - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
* - SEGGER_RTT_MODE_NO_BLOCK_SKIP (default)
*
* Using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL ensure that you get a
* complete and valid trace. This may however cause blocking if your streaming
* interface isn't fast enough, which may disturb the real-time behavior.
*
* We therefore recommend SEGGER_RTT_MODE_NO_BLOCK_SKIP. In this mode,
* Tracealyzer will report lost events if the transfer is not
* fast enough. In that case, try increasing the size of the "up buffer".
******************************************************************************/
#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_NO_BLOCK_SKIP
#include "SEGGER_RTT_Conf.h"
#include "SEGGER_RTT.h"
#if (TRC_CFG_RTT_UP_BUFFER_INDEX >= SEGGER_RTT_MAX_NUM_UP_BUFFERS)
#error "TRC_CFG_RTT_UP_BUFFER_INDEX must be smaller than SEGGER_RTT_MAX_NUM_UP_BUFFERS"
#endif
#if (TRC_CFG_RTT_DOWN_BUFFER_INDEX >= SEGGER_RTT_MAX_NUM_DOWN_BUFFERS)
#error "TRC_CFG_RTT_DOWN_BUFFER_INDEX must be smaller than SEGGER_RTT_MAX_NUM_DOWN_BUFFERS"
#endif
/* If index is defined as 0, the internal RTT buffers will be used instead of this. */
#if TRC_CFG_RTT_UP_BUFFER_INDEX == 0
#define TRC_RTT_ALLOC_UP() static char* _TzTraceData = NULL; /* Not actually used. Ignore allocation method. */
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
#else
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
#define TRC_RTT_ALLOC_UP() char _TzTraceData[TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Static allocation */
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
#endif
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Dynamic allocation */
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_RTT_BUFFER_SIZE_UP);
#endif
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Custom allocation, user needs to call vTraceSetRecorderDataBuffer before vTraceEnable, to assign this */
#define TRC_STREAM_PORT_MALLOC() /* Not used in custom mode */
#endif
#endif
/* Down-buffer. If index is defined as 0, the internal RTT buffers will be used instead of this. */ \
#if TRC_CFG_RTT_DOWN_BUFFER_INDEX == 0
#define TRC_RTT_ALLOC_DOWN() static char* _TzCtrlData = NULL; /* Not actually used. Ignore allocation method. */
#else
#define TRC_RTT_ALLOC_DOWN() static char _TzCtrlData[TRC_CFG_RTT_BUFFER_SIZE_DOWN]; /* Always static allocation, since usually small. */
#endif
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() \
TRC_RTT_ALLOC_UP() /* Macro that will result in proper UP buffer allocation */ \
TRC_RTT_ALLOC_DOWN() /* Macro that will result in proper DOWN buffer allocation */
int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead);
int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
SEGGER_RTT_ConfigUpBuffer(TRC_CFG_RTT_UP_BUFFER_INDEX, "TzData", _TzTraceData, TRC_CFG_RTT_BUFFER_SIZE_UP, TRC_CFG_RTT_MODE ); \
SEGGER_RTT_ConfigDownBuffer(TRC_CFG_RTT_DOWN_BUFFER_INDEX, "TzCtrl", _TzCtrlData, TRC_CFG_RTT_BUFFER_SIZE_DOWN, TRC_CFG_RTT_MODE);
/* Important for the J-Link port, in most other ports this can be skipped (default is 1) */
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) writeToRTT(_ptrData, _size, _ptrBytesWritten)
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) readFromRTT(_ptrData, _size, _ptrBytesRead)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -1,44 +1,83 @@
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead)
{
uint32_t bytesRead = 0;
if (SEGGER_RTT_HASDATA(TRC_CFG_RTT_DOWN_BUFFER_INDEX))
{
bytesRead = SEGGER_RTT_Read((TRC_CFG_RTT_DOWN_BUFFER_INDEX), (char*)ptrData, size);
if (ptrBytesRead != NULL)
*ptrBytesRead = (int32_t)bytesRead;
if (bytesRead != size)
{
return -1;
}
}
return 0;
}
int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)
{
uint32_t bytesWritten = SEGGER_RTT_Write((TRC_CFG_RTT_UP_BUFFER_INDEX), (const char*)ptrData, size);
if (ptrBytesWritten != NULL)
*ptrBytesWritten = (int32_t)bytesWritten;
if (bytesWritten != size)
{
return -1;
}
return 0;
}
#endif
#endif
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
*
* Note that this stream port is more complex than the typical case, since
* the J-Link interface uses a separate RAM buffer in SEGGER_RTT.c, instead
* of the default buffer included in the recorder core. The other stream ports
* offer more typical examples of how to define a custom streaming interface.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead)
{
uint32_t bytesRead = 0;
if (SEGGER_RTT_HASDATA(TRC_CFG_RTT_DOWN_BUFFER_INDEX))
{
bytesRead = SEGGER_RTT_Read((TRC_CFG_RTT_DOWN_BUFFER_INDEX), (char*)ptrData, size);
if (ptrBytesRead != NULL)
*ptrBytesRead = (int32_t)bytesRead;
}
return 0;
}
int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten)
{
uint32_t bytesWritten = SEGGER_RTT_Write((TRC_CFG_RTT_UP_BUFFER_INDEX), (const char*)ptrData, size);
if (ptrBytesWritten != NULL)
*ptrBytesWritten = (int32_t)bytesWritten;
return 0;
}
#endif
#endif

@ -1,22 +1,50 @@
Tracealyzer Stream Port for TCP/IP (lwIP example)
-------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets TCP/IP. This example assumes lwIP but is
easy to modify for other TCP/IP stacks.
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
Note that lwIP is not included, but assumed to exist in the project already.
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
Tracealyzer Stream Port for TCP/IP (lwIP example)
-------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets TCP/IP. This example assumes lwIP but is
easy to modify for other TCP/IP stacks.
Instructions:
1. Integrate the trace recorder and configure it for streaming, as described
in the Tracealyzer User Manual. For FreeRTOS this is found at:
https://percepio.com/docs/FreeRTOS/manual/index.html#Creating_and_Loading_Traces___Introduction
2. Make sure all .c and .h files from this stream port folder is included in
your build, and that no other variant of trcStreamingPort.h is included.
3. In lwipopts.h, make sure you have this line:
#define LWIP_SOCKET 1
4. Make sure that vTraceEnable(TRC_INIT) is called during the startup, before
any RTOS calls are made.
5. In Tracealyzer, open File -> Settings -> PSF Streaming Settings and
select Target Connection: TCP. Enter the IP address of the target system
and the port number (by default 12000).
6. Start your target system, wait a few seconds to ensure that the lwIP is operational,
then select Start Recording in Tracealyzer.
Troubleshooting:
- If the tracing suddenly stops, check the "errno" value in trcSocketSend (trcStreamingPort.c).
You can see the error code definitions in lwip/errno.h. If errno is ENOMEM, may you need to
increase MEM_SIZE in lwipopts.h.
- Since lwIP performs a lot of semaphore and mutex operations, we recommend filtering out
such events from the trace, at least those caused by the transmission of trace data in the
TzCtrl task. This can be done using vTraceSetFilterGroup() and vTraceSetFilterMask().
Note that lwIP is not included in the stream port, but assumed to exist in the project already.
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
www.percepio.com

@ -1,66 +1,68 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use TCP/IP as streaming channel.
* The example is for lwIP.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead);
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead)
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) trcTcpWrite(_ptrData, _size, _ptrBytesSent)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use TCP/IP as streaming channel.
* The example is for lwIP.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead);
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead)
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) trcTcpWrite(_ptrData, _size, _ptrBytesSent)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -1,186 +1,180 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
* Existing ports can easily be modified to fit another setup, e.g., a
* different TCP/IP stack, or to define your own stream port.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
/* TCP/IP includes - for lwIP in this case */
#include "lwip/tcpip.h"
#include "lwip/sockets.h"
int errno;
#define TRC_TCPIP_PORT 12000
int sock = -1, new_sd = -1;
int flags = 0;
int remoteSize;
struct sockaddr_in address, remote;
int32_t trcSocketSend( void* data, int32_t size, int32_t* bytesWritten )
{
if (new_sd < 0)
return -1;
if (bytesWritten == NULL)
return -1;
*bytesWritten = send( new_sd, data, size, 0 );
if (*bytesWritten < 0)
{
/* EWOULDBLOCK may be expected when buffers are full */
if (errno != 0 && errno != EWOULDBLOCK)
{
closesocket(new_sd);
new_sd = -1;
return -1;
}
else
*bytesWritten = 0;
}
return 0;
}
int32_t trcSocketReceive( void* data, int32_t size, int32_t* bytesRead )
{
if (new_sd < 0)
return -1;
*bytesRead = recv( new_sd, data, size, 0 );
if ( *bytesRead < 0 )
{
/* EWOULDBLOCK may be expected when there is no data to receive */
if (errno != 0 && errno != EWOULDBLOCK)
{
closesocket(new_sd);
new_sd = -1;
return -1;
}
else
*bytesRead = 0;
}
return 0;
}
int32_t trcSocketInitializeListener()
{
if (sock >= 0)
return 0;
sock = lwip_socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
return -1;
address.sin_family = AF_INET;
address.sin_port = htons( TRC_TCPIP_PORT );
address.sin_addr.s_addr = INADDR_ANY;
if (bind(sock, (struct sockaddr *)&address, sizeof (address)) < 0)
{
closesocket(sock);
sock = -1;
return -1;
}
if (lwip_listen(sock, 5) < 0)
{
closesocket(sock);
sock = -1;
return -1;
}
return 0;
}
int32_t trcSocketAccept()
{
if (sock < 0)
return -1;
if (new_sd >= 0)
return 0;
remoteSize = sizeof( remote );
new_sd = accept( sock, (struct sockaddr *)&remote, (socklen_t*)&remoteSize );
flags = fcntl( new_sd, F_GETFL, 0 );
fcntl( new_sd, F_SETFL, flags | O_NONBLOCK );
if( new_sd < 0 )
{
closesocket(new_sd);
new_sd = -1;
closesocket(sock);
sock = -1;
return -1;
}
return 0;
}
/************** MODIFY THE ABOVE PART TO USE YOUR TPC/IP STACK ****************/
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten)
{
return trcSocketSend(data, size, ptrBytesWritten);
}
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead)
{
trcSocketInitializeListener();
trcSocketAccept();
return trcSocketReceive(data, size, ptrBytesRead);
}
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
* Existing ports can easily be modified to fit another setup, e.g., a
* different TCP/IP stack, or to define your own stream port.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
/* TCP/IP includes - for lwIP in this case */
#include "lwip/tcpip.h"
#include "lwip/sockets.h"
#include "lwip/errno.h"
#define TRC_TCPIP_PORT 12000
int sock = -1, new_sd = -1;
int flags = 0;
int remoteSize;
struct sockaddr_in address, remote;
int32_t trcSocketSend( void* data, int32_t size, int32_t* bytesWritten )
{
if (new_sd < 0)
return -1;
if (bytesWritten == NULL)
return -1;
*bytesWritten = send( new_sd, data, size, 0 );
if (*bytesWritten < 0)
{
/* EWOULDBLOCK may be expected when buffers are full */
if ((errno != 0) && (errno != EWOULDBLOCK))
{
closesocket(new_sd);
new_sd = -1;
return -1;
}
else
*bytesWritten = 0;
}
return 0;
}
int32_t trcSocketReceive( void* data, int32_t size, int32_t* bytesRead )
{
if (new_sd < 0)
return -1;
*bytesRead = recv( new_sd, data, size, 0 );
/* EWOULDBLOCK may be expected when there is no data to receive */
if (errno != 0 && errno != EWOULDBLOCK)
{
closesocket(new_sd);
new_sd = -1;
return -1;
}
return 0;
}
int32_t trcSocketInitializeListener()
{
if (sock >= 0)
return 0;
sock = lwip_socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
return -1;
address.sin_family = AF_INET;
address.sin_port = htons( TRC_TCPIP_PORT );
address.sin_addr.s_addr = INADDR_ANY;
if (bind(sock, (struct sockaddr *)&address, sizeof (address)) < 0)
{
closesocket(sock);
sock = -1;
return -1;
}
if (lwip_listen(sock, 5) < 0)
{
closesocket(sock);
sock = -1;
return -1;
}
return 0;
}
int32_t trcSocketAccept()
{
if (sock < 0)
return -1;
if (new_sd >= 0)
return 0;
remoteSize = sizeof( remote );
new_sd = accept( sock, (struct sockaddr *)&remote, (socklen_t*)&remoteSize );
if( new_sd < 0 )
{
closesocket(new_sd);
new_sd = -1;
closesocket(sock);
sock = -1;
return -1;
}
flags = fcntl( new_sd, F_GETFL, 0 );
fcntl( new_sd, F_SETFL, flags | O_NONBLOCK );
return 0;
}
/************** MODIFY THE ABOVE PART TO USE YOUR TPC/IP STACK ****************/
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten)
{
return trcSocketSend(data, size, ptrBytesWritten);
}
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead)
{
trcSocketInitializeListener();
trcSocketAccept();
return trcSocketReceive(data, size, ptrBytesRead);
}
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/

@ -0,0 +1,38 @@
Tracealyzer Stream Port for TCP/IP (Win32 example)
-------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the I/O code needed for streaming a Tracealyzer RTOS trace over specific
interface. The stream port is defined by a set of macros in trcStreamingPort.h,
found in the "include" directory.
This particular stream port is for streaming over TCP/IP on Windows, intended
for the FreeRTOS Windows port (WIN32-MSVC). To try it:
1. Open the WIN32-MSVC demo project found in the FreeRTOS demo folder. You
need will Visual Studio, but there are free versions (Express or Community).
2. Make sure the project includes a recent version or the recorder library
(v3.1.x).
3. Make sure the recorder library is configured for streaming mode (see
trcConfig.h).
4. Make sure the project's include paths contains trcStreamingPort.h found in
this include folder (and not any other stream port), and the related code
in this folder.
5. Build and start the Win32 demo application. It should begin waiting for
a connection.
6. In Tracealyzer, open File -> Settings... -> Streaming Trace Settings.
Specify target connection: TCP, host: 127.0.0.1 (i.e. localhost) and port 8888.
7. In Tracealyzer, now open File -> Connect to Target System... and there
click "Start Recording". Now you should see a live CPU load graph and some
counters. Let it record for a few seconds, then click "Stop Recording" and then "View Trace".
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
www.percepio.com

@ -0,0 +1,75 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use TCP/IP as streaming channel.
* The example is for Windows sockets (Winsock), for use with Windows ports.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
int32_t readFromSocket(void* data, uint32_t size, int32_t *ptrBytesRead);
int32_t writeToSocket(void* data, uint32_t size, int32_t *ptrBytesWritten);
/* This port supports both direct write and buffered mode ...*/
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) readFromSocket(_ptrData, _size, _ptrBytesRead)
#if (TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1)
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) writeToSocket(_ptrData, _size, _ptrBytesWritten)
#else
/* In the direct mode, _ptrBytesWritten is not used, so it is assumed that "all or nothing" is written. */
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, UNUSED) writeToSocket(_ptrData, _size, NULL)
#endif
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -0,0 +1,210 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming, used by the "stream ports"
* for reading and writing data to the interface.
* Existing ports can easily be modified to fit another setup, e.g., a
* different TCP/IP stack, or to define your own stream port.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include<stdio.h>
#include<winsock2.h>
#include "trcRecorder.h"
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#pragma comment(lib,"ws2_32.lib") //Winsock Library
SOCKET server_socket = (UINT_PTR)NULL, trace_socket = (UINT_PTR)NULL;
struct sockaddr_in server, client;
int initServerSocketIfNeeded(void);
int initWinsockIfNeeded(void);
int initWinsockIfNeeded(void)
{
WSADATA wsa;
if (server_socket)
return 0;
if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
{
return -1;
}
return 0;
}
int initServerSocketIfNeeded(void)
{
if (initWinsockIfNeeded() < 0)
{
return -1;
}
if (server_socket)
return 0;
if ((server_socket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
{
return -1;
}
server.sin_family = AF_INET;
server.sin_addr.s_addr = INADDR_ANY;
server.sin_port = htons(8888);
if (bind(server_socket, (struct sockaddr *)&server, sizeof(server)) == SOCKET_ERROR)
{
closesocket(server_socket);
WSACleanup();
server_socket = (UINT_PTR)NULL;
return -1;
}
if (listen(server_socket, 3) < 0)
{
closesocket(server_socket);
WSACleanup();
server_socket = (UINT_PTR)NULL;
return -1;
}
return 0;
}
int initTraceSocketIfNeeded(void)
{
int c;
if (!server_socket)
return -1;
if (trace_socket)
return 0;
c = sizeof(struct sockaddr_in);
trace_socket = accept(server_socket, (struct sockaddr *)&client, &c);
if (trace_socket == INVALID_SOCKET)
{
trace_socket = (UINT_PTR)NULL;
closesocket(server_socket);
WSACleanup();
server_socket = (UINT_PTR)NULL;
return -1;
}
return 0;
}
int32_t writeToSocket(void* data, uint32_t size, int32_t *ptrBytesWritten)
{
int ret;
if (!trace_socket)
{
if (ptrBytesWritten != NULL)
{
*ptrBytesWritten = 0;
}
return -1;
}
ret = send(trace_socket, data, size, 0);
if (ret <= 0)
{
if (ptrBytesWritten != NULL)
{
*ptrBytesWritten = 0;
}
closesocket(trace_socket);
trace_socket = (UINT_PTR)NULL;
return ret;
}
if (ptrBytesWritten != NULL)
{
*ptrBytesWritten = ret;
}
return 0;
}
int32_t readFromSocket(void* data, uint32_t bufsize, int32_t *ptrBytesRead)
{
unsigned long bytesAvailable = 0;
if (initServerSocketIfNeeded() < 0)
return -1;
if (initTraceSocketIfNeeded() < 0)
return -1;
if (ioctlsocket(trace_socket, FIONREAD, &bytesAvailable) != NO_ERROR)
{
closesocket(trace_socket);
trace_socket = (UINT_PTR)NULL;
return -1;
}
if (bytesAvailable > 0)
{
*ptrBytesRead = recv(trace_socket, data, bufsize, 0);
if (*ptrBytesRead == SOCKET_ERROR)
{
closesocket(trace_socket);
trace_socket = (UINT_PTR)NULL;
return -1;
}
}
return 0;
}
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/

@ -1,27 +1,27 @@
Tracealyzer Stream Port for USB CDC (STM32 example)
---------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets USB CDC. This is an example for the STM32 USB
stack (from the STM32CubeMX code generation tool, v1.4.1) and has been tested on
a STM32F767ZI device on a Nucleo board. See this blog post:
http://percepio.com/2017/02/03/usb-trace-streaming-st-nucleo-f767zi-board/
However, it should be straight-forward to modify this for other USB stacks.
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
Note that the USB stack not included, but assumed to exist in the project already.
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
Tracealyzer Stream Port for USB CDC (STM32 example)
---------------------------------------------------
This directory contains a "stream port" for the Tracealyzer recorder library,
i.e., the specific code needed to use a particular interface for streaming a
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
trcStreamingPort.h, found in the "include" directory.
This particular stream port targets USB CDC. This is an example for the STM32 USB
stack (from the STM32CubeMX code generation tool, v1.4.1) and has been tested on
a STM32F767ZI device on a Nucleo board. See this blog post:
http://percepio.com/2017/02/03/usb-trace-streaming-st-nucleo-f767zi-board/
However, it should be straight-forward to modify this for other USB stacks.
To use this stream port, make sure that include/trcStreamingPort.h is found
by the compiler (i.e., add this folder to your project's include paths) and
add all included source files to your build. Make sure no other versions of
trcStreamingPort.h are included by mistake!
Note that the USB stack not included, but assumed to exist in the project already.
See also http://percepio.com/2016/10/05/rtos-tracing.
Percepio AB
www.percepio.com

@ -1,83 +1,83 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.1.5
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use USB CDC as streaming channel.
* The example is for STM32 using STM32Cube.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
#include "usb_device.h"
#include "usbd_cdc.h"
#include "usbd_CDC_if.h"
#include "usb_device.h"
/* Tested on STM32 devices using Keil/CMSIS USB stack */
extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes);
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent );
#define TRC_STREAM_PORT_INIT() \
MX_USB_DEVICE_Init(); \
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcCDCReceive(_ptrData, _size, _ptrBytesRead)
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) trcCDCTransmit(_ptrData, _size, _ptrBytesSent)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.h
*
* The interface definitions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use USB CDC as streaming channel.
* The example is for STM32 using STM32Cube.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#ifndef TRC_STREAMING_PORT_H
#define TRC_STREAMING_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
#include "usb_device.h"
#include "usbd_cdc.h"
#include "usbd_CDC_if.h"
#include "usb_device.h"
/* Tested on STM32 devices using Keil/CMSIS USB stack */
extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes);
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent );
#define TRC_STREAM_PORT_INIT() \
MX_USB_DEVICE_Init(); \
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcCDCReceive(_ptrData, _size, _ptrBytesRead)
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) trcCDCTransmit(_ptrData, _size, _ptrBytesSent)
#ifdef __cplusplus
}
#endif
#endif /* TRC_STREAMING_PORT_H */

@ -1,246 +1,291 @@
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#include "stdint.h"
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
#include "usb_device.h"
#include "usbd_cdc.h"
#include "usbd_CDC_if.h"
#include "usb_device.h"
#define BUFSIZE 64
typedef struct{
uint32_t idx;
uint8_t data[BUFSIZE];
}recBuf;
/* Define size for the receive and transmit buffer over CDC */
#define APP_RX_DATA_SIZE 8
#define APP_TX_DATA_SIZE 64
/* Received Data over USB are stored in this buffer */
uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
/* Send Data over USB CDC are stored in this buffer */
uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
extern USBD_HandleTypeDef hUsbDeviceFS;
extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
recBuf commandBuffer;
static int8_t CDC_Init_FS (void);
static int8_t CDC_DeInit_FS (void);
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length);
static int8_t CDC_Receive_FS (uint8_t* pbuf, uint32_t *Len);
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
{
CDC_Init_FS,
CDC_DeInit_FS,
CDC_Control_FS,
CDC_Receive_FS
};
/* Private functions ---------------------------------------------------------*/
/**
* @brief CDC_Init_FS
* Initializes the CDC media low layer over the FS USB IP
* @param None
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Init_FS(void)
{
/* Set Application Buffers */
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
return (USBD_OK);
}
/**
* @brief CDC_DeInit_FS
* DeInitializes the CDC media low layer
* @param None
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_DeInit_FS(void)
{
return (USBD_OK);
}
/**
* @brief CDC_Control_FS
* Manage the CDC class requests
* @param cmd: Command code
* @param pbuf: Buffer containing command data (request parameters)
* @param length: Number of data to be sent (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length)
{
switch (cmd)
{
case CDC_SEND_ENCAPSULATED_COMMAND:
break;
case CDC_GET_ENCAPSULATED_RESPONSE:
break;
case CDC_SET_COMM_FEATURE:
break;
case CDC_GET_COMM_FEATURE:
break;
case CDC_CLEAR_COMM_FEATURE:
break;
/*******************************************************************************/
/* Line Coding Structure */
/*-----------------------------------------------------------------------------*/
/* Offset | Field | Size | Value | Description */
/* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/
/* 4 | bCharFormat | 1 | Number | Stop bits */
/* 0 - 1 Stop bit */
/* 1 - 1.5 Stop bits */
/* 2 - 2 Stop bits */
/* 5 | bParityType | 1 | Number | Parity */
/* 0 - None */
/* 1 - Odd */
/* 2 - Even */
/* 3 - Mark */
/* 4 - Space */
/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
/*******************************************************************************/
case CDC_SET_LINE_CODING:
break;
case CDC_GET_LINE_CODING:
break;
case CDC_SET_CONTROL_LINE_STATE:
break;
case CDC_SEND_BREAK:
break;
default:
break;
}
return (USBD_OK);
}
/**
* @brief CDC_Receive_FS
* Data received over USB OUT endpoint are sent over CDC interface
* through this function.
*
* @note
* This function will block any OUT packet reception on USB endpoint
* until exiting this function. If you exit this function before transfer
* is complete on CDC interface (i.e. using DMA controller) it will result
* in receiving more data while previous ones are still not sent.
*
* @param Buf: Buffer of data to be received
* @param Len: Number of data received (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
for( uint32_t i=0;i<* Len;i++)
{
commandBuffer.data[commandBuffer.idx]=Buf[i];
commandBuffer.idx++;
}
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
}
/**
* @brief CDC_Transmit_FS
* Data send over USB IN endpoint are sent over CDC interface
* through this function.
* @note
*
*
* @param Buf: Buffer of data to be send
* @param Len: Number of data to be send (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
*/
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
if (hcdc->TxState != 0){
return USBD_BUSY;
}
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
return result;
}
/* The READ function, used in trcStreamingPort.h */
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes)
{
uint32_t i,diff;
if(commandBuffer.idx>0)
{
if (size >= commandBuffer.idx) // more than what is stored, number of bytes will be .idx
{
memcpy(data,commandBuffer.data, commandBuffer.idx);
*NumBytes=commandBuffer.idx;
commandBuffer.idx=0; // Make the buffer ready for a new command
}
else //If some data in the buffer is not read
{
diff = commandBuffer.idx-size;
memcpy(data,commandBuffer.data, size);
for(i=0;i<diff;i++)
{
commandBuffer.data[i]=commandBuffer.data[i+size];
}
*NumBytes=size;
commandBuffer.idx=diff;
}
}
else
{
*NumBytes=0;
}
return 0;
}
/* The WRITE function, used in trcStreamingPort.h */
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent )
{
int32_t result;
result=CDC_Transmit_FS(data, size);
*noOfBytesSent = size;
/* Return value should be 0 on success (not sure what the value of USBD_OK is) */
if (result == USBD_OK)
return 0;
else
return -1;
}
/**
* @brief This function handles USB On The Go FS global interrupt.
*/
void OTG_FS_IRQHandler(void)
{
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
}
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4.3.11
* Percepio AB, www.percepio.com
*
* trcStreamingPort.c
*
* Supporting functions for trace streaming ("stream ports").
* This "stream port" sets up the recorder to use USB CDC as streaming channel.
* The example is for STM32 using STM32Cube.
*
* Terms of Use
* This file is part of the trace recorder library (RECORDER), which is the
* intellectual property of Percepio AB (PERCEPIO) and provided under a
* license as follows.
* The RECORDER may be used free of charge for the purpose of recording data
* intended for analysis in PERCEPIO products. It may not be used or modified
* for other purposes without explicit permission from PERCEPIO.
* You may distribute the RECORDER in its original source code form, assuming
* this text (terms of use, disclaimer, copyright notice) is unchanged. You are
* allowed to distribute the RECORDER with minor modifications intended for
* configuration or porting of the RECORDER, e.g., to allow using it on a
* specific processor, processor family or with a specific communication
* interface. Any such modifications should be documented directly below
* this comment block.
*
* Disclaimer
* The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty
* as to its use or performance. PERCEPIO does not and cannot warrant the
* performance or results you may obtain by using the RECORDER or documentation.
* PERCEPIO 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, 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 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.
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2018.
* www.percepio.com
******************************************************************************/
#include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#include "stdint.h"
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
#include "usb_device.h"
#include "usbd_cdc.h"
#include "usbd_CDC_if.h"
#include "usb_device.h"
#define BUFSIZE 64
typedef struct{
uint32_t idx;
uint8_t data[BUFSIZE];
}recBuf;
/* Define size for the receive and transmit buffer over CDC */
#define APP_RX_DATA_SIZE 8
#define APP_TX_DATA_SIZE 64
/* Received Data over USB are stored in this buffer */
uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
/* Send Data over USB CDC are stored in this buffer */
uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
extern USBD_HandleTypeDef hUsbDeviceFS;
extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
recBuf commandBuffer;
static int8_t CDC_Init_FS (void);
static int8_t CDC_DeInit_FS (void);
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length);
static int8_t CDC_Receive_FS (uint8_t* pbuf, uint32_t *Len);
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
{
CDC_Init_FS,
CDC_DeInit_FS,
CDC_Control_FS,
CDC_Receive_FS
};
/* Private functions ---------------------------------------------------------*/
/**
* @brief CDC_Init_FS
* Initializes the CDC media low layer over the FS USB IP
* @param None
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Init_FS(void)
{
/* Set Application Buffers */
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
return (USBD_OK);
}
/**
* @brief CDC_DeInit_FS
* DeInitializes the CDC media low layer
* @param None
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_DeInit_FS(void)
{
return (USBD_OK);
}
/**
* @brief CDC_Control_FS
* Manage the CDC class requests
* @param cmd: Command code
* @param pbuf: Buffer containing command data (request parameters)
* @param length: Number of data to be sent (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length)
{
switch (cmd)
{
case CDC_SEND_ENCAPSULATED_COMMAND:
break;
case CDC_GET_ENCAPSULATED_RESPONSE:
break;
case CDC_SET_COMM_FEATURE:
break;
case CDC_GET_COMM_FEATURE:
break;
case CDC_CLEAR_COMM_FEATURE:
break;
/*******************************************************************************/
/* Line Coding Structure */
/*-----------------------------------------------------------------------------*/
/* Offset | Field | Size | Value | Description */
/* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/
/* 4 | bCharFormat | 1 | Number | Stop bits */
/* 0 - 1 Stop bit */
/* 1 - 1.5 Stop bits */
/* 2 - 2 Stop bits */
/* 5 | bParityType | 1 | Number | Parity */
/* 0 - None */
/* 1 - Odd */
/* 2 - Even */
/* 3 - Mark */
/* 4 - Space */
/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
/*******************************************************************************/
case CDC_SET_LINE_CODING:
break;
case CDC_GET_LINE_CODING:
break;
case CDC_SET_CONTROL_LINE_STATE:
break;
case CDC_SEND_BREAK:
break;
default:
break;
}
return (USBD_OK);
}
/**
* @brief CDC_Receive_FS
* Data received over USB OUT endpoint are sent over CDC interface
* through this function.
*
* @note
* This function will block any OUT packet reception on USB endpoint
* until exiting this function. If you exit this function before transfer
* is complete on CDC interface (i.e. using DMA controller) it will result
* in receiving more data while previous ones are still not sent.
*
* @param Buf: Buffer of data to be received
* @param Len: Number of data received (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
for( uint32_t i=0;i<* Len;i++)
{
commandBuffer.data[commandBuffer.idx]=Buf[i];
commandBuffer.idx++;
}
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
}
/**
* @brief CDC_Transmit_FS
* Data send over USB IN endpoint are sent over CDC interface
* through this function.
* @note
*
*
* @param Buf: Buffer of data to be send
* @param Len: Number of data to be send (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
*/
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
if (hcdc->TxState != 0){
return USBD_BUSY;
}
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
return result;
}
/* The READ function, used in trcStreamingPort.h */
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes)
{
uint32_t i,diff;
if(commandBuffer.idx>0)
{
if (size >= commandBuffer.idx) // more than what is stored, number of bytes will be .idx
{
memcpy(data,commandBuffer.data, commandBuffer.idx);
*NumBytes=commandBuffer.idx;
commandBuffer.idx=0; // Make the buffer ready for a new command
}
else //If some data in the buffer is not read
{
diff = commandBuffer.idx-size;
memcpy(data,commandBuffer.data, size);
for(i=0;i<diff;i++)
{
commandBuffer.data[i]=commandBuffer.data[i+size];
}
*NumBytes=size;
commandBuffer.idx=diff;
}
}
else
{
*NumBytes=0;
}
return 0;
}
/* The WRITE function, used in trcStreamingPort.h */
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent )
{
int32_t result;
result=CDC_Transmit_FS(data, size);
*noOfBytesSent = size;
/* Return value should be 0 on success (not sure what the value of USBD_OK is) */
if (result == USBD_OK)
return 0;
else
return -1;
}
/**
* @brief This function handles USB On The Go FS global interrupt.
*/
void OTG_FS_IRQHandler(void)
{
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
}
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/

@ -1,337 +1,413 @@
-------------------------------------------------------------------------------
Tracealyzer Recorder Library for FreeRTOS
-------------------------------------------------------------------------------
Tracealyzer is a sophisticated tool for tracing and visualization
of FreeRTOS-based software systems.
Tracealyzer gives an unprecedented insight into the runtime behavior, which
speeds up debugging, validation and optimization.
This, the Trace Recorder Library, is the target-side part of Tracealyzer, that
performs the actual tracing. The resulting data can then be viewed in the
Tracealyzer PC application, found at https://percepio.com/tracealyzer
To learn more, see these links.
- Getting Started (videos etc): https://percepio.com/gettingstarted
- FAQ: https://percepio.com/category/faq
In case you have any questions, don't hesitate to contact support@percepio.com
Tracealyzer supports FreeRTOS v7.3 and newer, including Amazon FreeRTOS.
-------------------------------------------------------------------------------
Changes, v4.1.4 -> v4.1.5
- Fixed a bug in the ITM stream port, that required Port 0 to be enabled.
- Added missing include of stdio.h (needed by vTraceConsoleChannelPrintF).
- Moved standard includes from trcRecorder.h into the .c files needing them.
-------------------------------------------------------------------------------
Changes, v4.1.2 -> v4.1.4
- Fixed a compile error when certain FreeRTOS settings were used
- Disabled filter support for FreeRTOS v7.3 since it uses "char" for object id
-------------------------------------------------------------------------------
Changes, v4.1.0 -> v4.1.2
- Added vTraceConsoleChannelPrintF(...)
-------------------------------------------------------------------------------
Changes, v4.0.3 -> v4.1.0
- Improved performance of User Events
- Fixed handling of format strings ending with '%'
- Improved handling of creative user configuration macros
-------------------------------------------------------------------------------
Changes, v4.0.2 -> v4.0.3
- Minor fix for TCP/IP stream port.
- Corrected default RTT mode setting.
-------------------------------------------------------------------------------
Changes, v4.0.1 -> v4.0.2
- Memory allocation trace events now ignore filters.
-------------------------------------------------------------------------------
Changes, v4.0.0 -> v4.0.1
- Minor fixes to default values.
-------------------------------------------------------------------------------
Changes, v3.3.0 -> v4.0.0
- Fixed some issues with filters.
-------------------------------------------------------------------------------
Changes, v3.2.0 -> v3.3.0
- Added support for FreeRTOS v10, including the new object types Message Buffer
and Stream Buffer.
- Improved the object-level filtering to also support Timer, Event Group,
Message Buffer and Stream Buffer objects.
- Fixed a few remaining build problems with older FreeRTOS versions (v7.x).
- vTraceStoreISRBegin now reports an error on invalid handles, i.e., if the
initialization of the handle (xTraceSetISRProperties) had not been made.
-------------------------------------------------------------------------------
Changes, v3.1.2 -> v3.2.0
- Added new filtering system - that works in both snapshot and streaming mode.
Filtering was previously not supported in streaming mode, but can be very
useful for slower streaming interfaces. By exluding irrelevant events, the
amount of data produced can be reduced a lot.
* New functions vTraceSetFilterGroup and vTraceSetFilterMask allows for
excluding all events from specific objects (like a semaphore or queue).
* Added new "generic" filters (preprocessor level) to trcConfig.h, that
exclude all events of a particular types.
- TRC_CFG_INCLUDE_NOTIFY_EVENTS
- TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
- TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
- TRC_CFG_INCLUDE_TIMER_EVENTS
* Upgraded some previous filters from "Snapshot only" to the Common API
and thereby moved them from trcSnapshotConfig.h to trcConfig.h.
- TRC_CFG_SCHEDULING_ONLY
- TRC_CFG_INCLUDE_MEMMANG_EVENTS
- TRC_CFG_INCLUDE_USER_EVENTS
- TRC_CFG_INCLUDE_ISR_TRACING
- TRC_CFG_INCLUDE_READY_EVENTS
- TRC_CFG_INCLUDE_OSTICK_EVENTS
* Removed the old filter system from trcSnapshotRecorder.c.
- Improved streaming interface - Now only two (2) macros are needed to be
defined in most cases, read and write. This makes it a lot easier to make
custom stream ports.
* Many definitions that were identical in most stream ports, have been
replaced by default definitions in the recorder core. If needed, they
can be overriden by custom definitions in trcStreamingPort.h.
* Stream ports are now assumed to use recorder's internal event buffer.
Other stream ports that writes directly to the streaming interface
(like J-Link) should define TRC_STREAM_PORT_USE_INTERNAL_BUFFER
as zero (0) to make it work correctly.
* Macro TRC_STREAM_PORT_PERIODIC_SEND_DATA has been replaced by
TRC_STREAM_PORT_WRITE_DATA. Together with TRC_STREAM_PORT_READ_DATA,
this is all that is necessary for a typical stream port.
* Return values from the stream port macros READ_DATA and WRITE_DATA are
now checked. Expects 0 on success, anything else produces a warning
that can be retrived using xTraceGetLastError() and also seen in
Tracealyzer if a trace was produced.
* Stream ports should no longer call prvPagedEventBufferInit explicitly
(e.g. in TRC_STREAM_PORT_ON_TRACE_BEGIN). This is now called
automatically if TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1.
* Macros TRC_STREAM_PORT_ON_TRACE_BEGIN and TRC_STREAM_PORT_ON_TRACE_END
are now unused by default and don't need to be defined.
You can however use them to hook in some own function at these events.
- Added two new stream ports
* TCPIP-Win32: allows for testing the streaming on Windows ports of your
RTOS, using Winsock.
* File: example of streaming to a local file system (tested on Windows,
but easy to modify).
- Added support for FreeRTOS v9.0.1
* Replaced FreeRTOS version code TRC_FREERTOS_VERSION_9_X with
- TRC_FREERTOS_VERSION_9_0_0
- TRC_FREERTOS_VERSION_9_0_1
* Using TRC_FREERTOS_VERSION_9_X is no longer allowed.
- Added additional events for xQueuePeek, for blocking and timeouts events.
- Added event for traceTIMER_EXPIRED, showing when the timer callback
function is called.
- Improved diagnostics in streaming mode, in case of errors in the recorder.
* Added prvTraceWarning() - registers a "warning" error code, without
stopping the recorder. Called if READ_DATA or WRITE_DATA returns a
non-zero value, and in several other cases where the recorder
configuration is incorrect (e.g., too small symbol table).
* Added several new warning codes (PSF_WARNING_XYZ), corresponding to the
issues detected by prvCheckRecorderStatus.
* Fixed duplicate definitions of warning messages, so the warnings reported
to Tracealyzer are the same as those provided in xTraceGetLastError().
* Added better explainations of warning/error messages in the body of
xTraceGetLastError (in streaming mode).
- Added xTraceIsRecordingEnabled() to Common API.
- Added "unofficial" hardware port for Altera Nios-II.
This is a user contribition, not yet verified by Percerpio.
- Fixed bug in vTraceEnable - option TRC_START_AWAIT_HOST was ignored if already initialized.
- Fixed a few remaining compiler warnings.
- Changed order of some settings in trcConfig.h - moved advanced stuff to the
bottom.
- Removed SEGGER_RTT_Printf.c from the J-Link stream port since not required
for Tracealyzer.
-------------------------------------------------------------------------------
Changes, v3.1.1 -> v3.1.2
- Fixed two bugs related to User Events, one in vTracePrintF and other in vTracePrint.
- Fixed a build problem related to a single reference of the old FreeRTOS type "xTaskHandle", in trcKernelPort.c.
Changed to "TaskHandle_t", unless if using an older FreeRTOS kernel or the "compatibility mode".
- Removed traceCREATE_MUTEX hook for FreeRTOS v9 or later (no longer required)
- Updated the User Manual regarding snapshot trace via IAR Embedded Workbench.
- Renamed vTraceGetTraceBuffer to xTraceGetTraceBuffer, since returning a pointer.
-------------------------------------------------------------------------------
Changes, v3.1.0 -> v3.1.1
After the major changes in the v3.1.0 trace recorder library, this update
corrects a number of minor issues. Only minor functional improvements.
- You can now use TRC_ALLOC_CUSTOM_BUFFER to declare a trace buffer on a custom
location (using linker directives).
The related function vTraceSetRecorderDataBuffer has been promoted to the
Common API (previously only supported in snapshot mode, but custom allocation
is now generally supported also in streaming mode).
- Removed TRC_CFG_USE_LINKER_PRAGMA. No longer necessary thanks to the custom
allocation mode.
- Added support for timestamping from custom periodic timers, required for
accurate timestamping on Cortex-M0/M0+ devices when using tickless idle.
Only for streaming mode so far. See TRC_CUSTOM_TIMER_INCR / DECR.
- ARM Cortex-M port: Made sure the DWT unit is initialized properly, in case
the debugger doesn't handle this.
- ARM Cortex-M port: Added possibility to use Systick timestamping also on
Cortex-M3/M4/M7 devices (that otherwise use DWT timestamping by default).
To use this option, define the macro TRC_CFG_ARM_CM_USE_SYSTICK.
- J-Link streaming: The default RTT buffer has been changed from 0 to 1.
- J-Link streaming: The RTT buffer settings for buffer 1 and higher, are now
found in trcStreamingPort.h. Note: These settings don't apply to buffer 0.
- vTracePrint has been optimized for better performance in string logging.
- Minor performance improvement related to symbol table transfer in streaming mode.
- Timer names now registered also in streaming mode.
- Timer start and stop event are now traced.
- Implemented support for queue registry (traceQUEUE_REGISTRY_ADD) also for streaming.
- Fixed a bug related to repeated calls of vTraceEnable.
- Fixed a bug where task-switches seemed to occur even though the scheduler was disabled.
- Renamed HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48, added prefix TRC.
- Fixed several language issues in the comments and documentation.
- Fixed several minor issues and warnings from different compilers
(including PowerPC/gcc) and configurations.
-------------------------------------------------------------------------------
Changes, v3.0.9 -> v3.1.0
- Merge of previously separated snapshot and streaming recorders into a single
recorder supporting both streaming and snapshot as different modes.
- New common API for supporting both streaming and snapshot modes.
- New integration guide, see the User Manual.
- Major improvement of API documentation in source files and User Manual.
- New concept of "stream ports", giving a better structure defining streaming
interfaces, and restructured the J-Link and TCP/IP streaming as stream ports.
- Added a stream port for USB CDC connections, with STM32 as example.
Since Tracealyzer now can receive serial data on Windows COM ports, this is
really easy to use.
- Added a warning (#error) for cases where FreeRTOS tickless idle mode is used
together with timestamping using SysTick or other periodic interrupt timers,
Tracing with tickless idle requires an independent time source to correctly
capture the length of the idle periods.
- Major changes in the recorder API. Important examples are:
* Some configuration macros have changed names, e.g. for "hardware port".
Make sure to remove any old "trcConfig.h" files if upgrading from an
earlier version!
* Recorder configuration in trcConfig.h has been minimized and now only
includes the important settings that are independent of recorder mode.
Advanced settings for each mode are found in trcSnapshotConfig.h and
trcStreamingConfig.h.
* vTraceEnable replaces Trace_Init and vTraceInitTraceData, as well as
vTraceStart and uiTraceStart.
* vTraceStop now part of the common API and thereby available also in
streaming. And since vTraceEnable can start the streaming directly
you have the option control the tracing from target, e.g., for
streaming to a device file system.
* vTraceStoreKernelObjectName from old streaming recorder has been replaced
by vTraceSetQueueName, vTraceSetSemaphoreName, etc.
* vTraceSetISRProperties now returns a "traceHandle" that should be passed as
parameter to vTraceStoreISRBegin and vTraceStoreISREnd.
* xTraceRegisterString has replaced the old functions xTraceOpenLabel and
vTraceStoreUserEventChannelName. This now returns a "traceString" for use
as "channel" parameter in vTracePrintF, and in other places where strings
are stored.
* Removed vTraceStoreISREndManual and vTraceStoreISREndAuto, use
vTraceStoreISREnd instead.
* Renamed the functions for saving User Events in a separate buffer:
- xTraceRegisterChannelFormat -> xTraceRegisterUBChannel
- vTraceChannelPrintF -> vTraceUBData
- vTraceChannelUserEvent -> vTraceUBEvent
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Tracealyzer Recorder Library for FreeRTOS
-------------------------------------------------------------------------------
Tracealyzer is a sophisticated tool for tracing and visualization
of FreeRTOS-based software systems.
Tracealyzer gives an unprecedented insight into the runtime behavior, which
speeds up debugging, validation and optimization.
This, the Trace Recorder Library, is the target-side part of Tracealyzer, that
performs the actual tracing. The resulting data can then be viewed in the
Tracealyzer PC application, found at https://percepio.com/tracealyzer
To learn more, see these links.
- Getting Started (videos etc): https://percepio.com/gettingstarted
- FAQ: https://percepio.com/category/faq
In case you have any questions, don't hesitate to contact support@percepio.com
Tracealyzer supports FreeRTOS v7.3 and newer, including Amazon FreeRTOS.
-------------------------------------------------------------------------------
Changes, v4.3.10 -> v4.3.11
- Adapted for new Task Notify changes
-------------------------------------------------------------------------------
Changes, v4.3.8 -> v4.3.10
- Fixed accidental C99 reliance
-------------------------------------------------------------------------------
Changes, v4.3.7 -> v4.3.8
- Modified how FreeRTOS versions are configured in the trace library.
- traceQUEUE_SET_SEND() was added.
- Now informs users of FreeRTOS v10.3.X that the trace point traceQUEUE_SEND in
prvNotifyQueueSetContainer() should be changed to traceQUEUE_SET_SEND.
-------------------------------------------------------------------------------
Changes, v4.3.5 -> v4.3.7
- Fixed issue where ISR naming would not always work.
- Fixed "errno" issue with certain compilers when using lwip streaming port.
- Recorder now makes sure all streaming trace header info is successfully sent
before moving on.
- Recorder warns if TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT > 128 since code
isn't designed for that.
- Made sure uiTraceSystemState is always declared in snapshot recorder.
-------------------------------------------------------------------------------
Changes, v4.3.1 -> v4.3.5
- A previously removed define is no longer used when configSUPPORT_STATIC_ALLOCATION is 1
-------------------------------------------------------------------------------
Changes, v4.3.0 -> v4.3.1
- Name string no longer has to have unique address when calling xTraceSetISRProperties()
-------------------------------------------------------------------------------
Changes, v4.2.12 -> v4.3.0
- Improved Streaming stability in regards to starting/stopping.
- Added support for STACK usage reports.
- Added vTraceVPrintF() that accepts a va_list as argument.
-------------------------------------------------------------------------------
Changes, v4.2.2 -> v4.2.12
- Changed a call to vTracePrintF() into vTracePrint().
-------------------------------------------------------------------------------
Changes, v4.2.1 -> v4.2.2
- TRC_STREAM_PORT_WRITE_DATA() no longer has to deal with null pointers. Better
for custom StreamPort implementations.
-------------------------------------------------------------------------------
Changes, v4.1.7 -> v4.2.1
- Added support for initial heap usage at trace start in Streaming mode.
- Fixed bug regarding failed malloc calls in Streaming mode.
- Added support for tracing failed malloc calls in Snapshot mode.
- Better way of setting initial task "(startup)" in Streaming mode.
-------------------------------------------------------------------------------
Changes, v4.1.5 -> v4.1.7
- vQueueSendToFront() and vQueueSendToFrontFromISR() are now traced properly in
Snaphot mode.
-------------------------------------------------------------------------------
Changes, v4.1.4 -> v4.1.5
- Fixed a bug in the ITM stream port, that required Port 0 to be enabled.
- Added missing include of stdio.h (needed by vTraceConsoleChannelPrintF).
- Moved standard includes from trcRecorder.h into the .c files needing them.
-------------------------------------------------------------------------------
Changes, v4.1.2 -> v4.1.4
- Fixed a compile error when certain FreeRTOS settings were used
- Disabled filter support for FreeRTOS v7.3 since it uses "char" for object id
-------------------------------------------------------------------------------
Changes, v4.1.0 -> v4.1.2
- Added vTraceConsoleChannelPrintF(...)
-------------------------------------------------------------------------------
Changes, v4.0.3 -> v4.1.0
- Improved performance of User Events
- Fixed handling of format strings ending with '%'
- Improved handling of creative user configuration macros
-------------------------------------------------------------------------------
Changes, v4.0.2 -> v4.0.3
- Minor fix for TCP/IP stream port.
- Corrected default RTT mode setting.
-------------------------------------------------------------------------------
Changes, v4.0.1 -> v4.0.2
- Memory allocation trace events now ignore filters.
-------------------------------------------------------------------------------
Changes, v4.0.0 -> v4.0.1
- Minor fixes to default values.
-------------------------------------------------------------------------------
Changes, v3.3.0 -> v4.0.0
- Fixed some issues with filters.
-------------------------------------------------------------------------------
Changes, v3.2.0 -> v3.3.0
- Added support for FreeRTOS v10, including the new object types Message Buffer
and Stream Buffer.
- Improved the object-level filtering to also support Timer, Event Group,
Message Buffer and Stream Buffer objects.
- Fixed a few remaining build problems with older FreeRTOS versions (v7.x).
- vTraceStoreISRBegin now reports an error on invalid handles, i.e., if the
initialization of the handle (xTraceSetISRProperties) had not been made.
-------------------------------------------------------------------------------
Changes, v3.1.2 -> v3.2.0
- Added new filtering system - that works in both snapshot and streaming mode.
Filtering was previously not supported in streaming mode, but can be very
useful for slower streaming interfaces. By exluding irrelevant events, the
amount of data produced can be reduced a lot.
* New functions vTraceSetFilterGroup and vTraceSetFilterMask allows for
excluding all events from specific objects (like a semaphore or queue).
* Added new "generic" filters (preprocessor level) to trcConfig.h, that
exclude all events of a particular types.
- TRC_CFG_INCLUDE_NOTIFY_EVENTS
- TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
- TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
- TRC_CFG_INCLUDE_TIMER_EVENTS
* Upgraded some previous filters from "Snapshot only" to the Common API
and thereby moved them from trcSnapshotConfig.h to trcConfig.h.
- TRC_CFG_SCHEDULING_ONLY
- TRC_CFG_INCLUDE_MEMMANG_EVENTS
- TRC_CFG_INCLUDE_USER_EVENTS
- TRC_CFG_INCLUDE_ISR_TRACING
- TRC_CFG_INCLUDE_READY_EVENTS
- TRC_CFG_INCLUDE_OSTICK_EVENTS
* Removed the old filter system from trcSnapshotRecorder.c.
- Improved streaming interface - Now only two (2) macros are needed to be
defined in most cases, read and write. This makes it a lot easier to make
custom stream ports.
* Many definitions that were identical in most stream ports, have been
replaced by default definitions in the recorder core. If needed, they
can be overriden by custom definitions in trcStreamingPort.h.
* Stream ports are now assumed to use recorder's internal event buffer.
Other stream ports that writes directly to the streaming interface
(like J-Link) should define TRC_STREAM_PORT_USE_INTERNAL_BUFFER
as zero (0) to make it work correctly.
* Macro TRC_STREAM_PORT_PERIODIC_SEND_DATA has been replaced by
TRC_STREAM_PORT_WRITE_DATA. Together with TRC_STREAM_PORT_READ_DATA,
this is all that is necessary for a typical stream port.
* Return values from the stream port macros READ_DATA and WRITE_DATA are
now checked. Expects 0 on success, anything else produces a warning
that can be retrived using xTraceGetLastError() and also seen in
Tracealyzer if a trace was produced.
* Stream ports should no longer call prvPagedEventBufferInit explicitly
(e.g. in TRC_STREAM_PORT_ON_TRACE_BEGIN). This is now called
automatically if TRC_STREAM_PORT_USE_INTERNAL_BUFFER == 1.
* Macros TRC_STREAM_PORT_ON_TRACE_BEGIN and TRC_STREAM_PORT_ON_TRACE_END
are now unused by default and don't need to be defined.
You can however use them to hook in some own function at these events.
- Added two new stream ports
* TCPIP-Win32: allows for testing the streaming on Windows ports of your
RTOS, using Winsock.
* File: example of streaming to a local file system (tested on Windows,
but easy to modify).
- Added support for FreeRTOS v9.0.1
* Replaced FreeRTOS version code TRC_FREERTOS_VERSION_9_X with
- TRC_FREERTOS_VERSION_9_0_0
- TRC_FREERTOS_VERSION_9_0_1
* Using TRC_FREERTOS_VERSION_9_X is no longer allowed.
- Added additional events for xQueuePeek, for blocking and timeouts events.
- Added event for traceTIMER_EXPIRED, showing when the timer callback
function is called.
- Improved diagnostics in streaming mode, in case of errors in the recorder.
* Added prvTraceWarning() - registers a "warning" error code, without
stopping the recorder. Called if READ_DATA or WRITE_DATA returns a
non-zero value, and in several other cases where the recorder
configuration is incorrect (e.g., too small symbol table).
* Added several new warning codes (PSF_WARNING_XYZ), corresponding to the
issues detected by prvCheckRecorderStatus.
* Fixed duplicate definitions of warning messages, so the warnings reported
to Tracealyzer are the same as those provided in xTraceGetLastError().
* Added better explainations of warning/error messages in the body of
xTraceGetLastError (in streaming mode).
- Added xTraceIsRecordingEnabled() to Common API.
- Added "unofficial" hardware port for Altera Nios-II.
This is a user contribition, not yet verified by Percerpio.
- Fixed bug in vTraceEnable - option TRC_START_AWAIT_HOST was ignored if already initialized.
- Fixed a few remaining compiler warnings.
- Changed order of some settings in trcConfig.h - moved advanced stuff to the
bottom.
- Removed SEGGER_RTT_Printf.c from the J-Link stream port since not required
for Tracealyzer.
-------------------------------------------------------------------------------
Changes, v3.1.1 -> v3.1.2
- Fixed two bugs related to User Events, one in vTracePrintF and other in vTracePrint.
- Fixed a build problem related to a single reference of the old FreeRTOS type "xTaskHandle", in trcKernelPort.c.
Changed to "TaskHandle_t", unless if using an older FreeRTOS kernel or the "compatibility mode".
- Removed traceCREATE_MUTEX hook for FreeRTOS v9 or later (no longer required)
- Updated the User Manual regarding snapshot trace via IAR Embedded Workbench.
- Renamed vTraceGetTraceBuffer to xTraceGetTraceBuffer, since returning a pointer.
-------------------------------------------------------------------------------
Changes, v3.1.0 -> v3.1.1
After the major changes in the v3.1.0 trace recorder library, this update
corrects a number of minor issues. Only minor functional improvements.
- You can now use TRC_ALLOC_CUSTOM_BUFFER to declare a trace buffer on a custom
location (using linker directives).
The related function vTraceSetRecorderDataBuffer has been promoted to the
Common API (previously only supported in snapshot mode, but custom allocation
is now generally supported also in streaming mode).
- Removed TRC_CFG_USE_LINKER_PRAGMA. No longer necessary thanks to the custom
allocation mode.
- Added support for timestamping from custom periodic timers, required for
accurate timestamping on Cortex-M0/M0+ devices when using tickless idle.
Only for streaming mode so far. See TRC_CUSTOM_TIMER_INCR / DECR.
- ARM Cortex-M port: Made sure the DWT unit is initialized properly, in case
the debugger doesn't handle this.
- ARM Cortex-M port: Added possibility to use Systick timestamping also on
Cortex-M3/M4/M7 devices (that otherwise use DWT timestamping by default).
To use this option, define the macro TRC_CFG_ARM_CM_USE_SYSTICK.
- J-Link streaming: The default RTT buffer has been changed from 0 to 1.
- J-Link streaming: The RTT buffer settings for buffer 1 and higher, are now
found in trcStreamingPort.h. Note: These settings don't apply to buffer 0.
- vTracePrint has been optimized for better performance in string logging.
- Minor performance improvement related to symbol table transfer in streaming mode.
- Timer names now registered also in streaming mode.
- Timer start and stop event are now traced.
- Implemented support for queue registry (traceQUEUE_REGISTRY_ADD) also for streaming.
- Fixed a bug related to repeated calls of vTraceEnable.
- Fixed a bug where task-switches seemed to occur even though the scheduler was disabled.
- Renamed HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48, added prefix TRC.
- Fixed several language issues in the comments and documentation.
- Fixed several minor issues and warnings from different compilers
(including PowerPC/gcc) and configurations.
-------------------------------------------------------------------------------
Changes, v3.0.9 -> v3.1.0
- Merge of previously separated snapshot and streaming recorders into a single
recorder supporting both streaming and snapshot as different modes.
- New common API for supporting both streaming and snapshot modes.
- New integration guide, see the User Manual.
- Major improvement of API documentation in source files and User Manual.
- New concept of "stream ports", giving a better structure defining streaming
interfaces, and restructured the J-Link and TCP/IP streaming as stream ports.
- Added a stream port for USB CDC connections, with STM32 as example.
Since Tracealyzer now can receive serial data on Windows COM ports, this is
really easy to use.
- Added a warning (#error) for cases where FreeRTOS tickless idle mode is used
together with timestamping using SysTick or other periodic interrupt timers,
Tracing with tickless idle requires an independent time source to correctly
capture the length of the idle periods.
- Major changes in the recorder API. Important examples are:
* Some configuration macros have changed names, e.g. for "hardware port".
Make sure to remove any old "trcConfig.h" files if upgrading from an
earlier version!
* Recorder configuration in trcConfig.h has been minimized and now only
includes the important settings that are independent of recorder mode.
Advanced settings for each mode are found in trcSnapshotConfig.h and
trcStreamingConfig.h.
* vTraceEnable replaces Trace_Init and vTraceInitTraceData, as well as
vTraceStart and uiTraceStart.
* vTraceStop now part of the common API and thereby available also in
streaming. And since vTraceEnable can start the streaming directly
you have the option control the tracing from target, e.g., for
streaming to a device file system.
* vTraceStoreKernelObjectName from old streaming recorder has been replaced
by vTraceSetQueueName, vTraceSetSemaphoreName, etc.
* vTraceSetISRProperties now returns a "traceHandle" that should be passed as
parameter to vTraceStoreISRBegin and vTraceStoreISREnd.
* xTraceRegisterString has replaced the old functions xTraceOpenLabel and
vTraceStoreUserEventChannelName. This now returns a "traceString" for use
as "channel" parameter in vTracePrintF, and in other places where strings
are stored.
* Removed vTraceStoreISREndManual and vTraceStoreISREndAuto, use
vTraceStoreISREnd instead.
* Renamed the functions for saving User Events in a separate buffer:
- xTraceRegisterChannelFormat -> xTraceRegisterUBChannel
- vTraceChannelPrintF -> vTraceUBData
- vTraceChannelUserEvent -> vTraceUBEvent
-------------------------------------------------------------------------------
Copyright Percepio AB, 2018.

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save