* * 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
parent
70dcbe4527
commit
d248555de5
@ -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_ */
|
File diff suppressed because it is too large
Load Diff
@ -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
|
@ -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)*/
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue