Update FreeRTOS+Trace recorder library to v3.0.2

Add streaming version of the FreeRTOS+Trace recorder, also V3.0.2
This commit is contained in:
Richard Barry
2015-10-09 13:30:09 +00:00
parent f218cf5680
commit 96ff3925d2
32 changed files with 6067 additions and 123 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
Release notes, Trace Recorder Library for Tracealyzer v3.0.2
September 29, 2015. Percepio AB.
Changes:
v3.0.2
- Fixed bug in tracing of nested interrupts.
- Made locally used variables and functions static.
v3.0.1
- Added vTraceOnTraceBegin()/vTraceOnTraceEnd() in trcKernelPort.c to allow custom cleanup via macros TRC_STREAM_PORT_ON_TRACE_BEGIN()/TRC_STREAM_PORT_ON_TRACE_END().
v3.0.0
- Modified trcTCPIP functions to take bytes written/read as parameters and instead return potential errors.
- Added vTraceOnTraceBegin()/vTraceOnTraceEnd() in trcKernelPort that in turn uses macros from trcStreamPort.h to allow transfer method defined (as well as user defined) actions where appropriate. Currently only used by TCP/IP to re-initialize the paged event buffer so no old data is sent on trace start.
v2.8.6
- Changed void* to uint32_t to ensure 32bit for vTraceStoreEvent1(), vTraceStoreEvent2() and vTraceStoreEvent3().
- Added prefix TRC to most macros to avoid conflicts.
- Moved all trace stream macros to trcStreamPort.h.
- Now allows users to define their own trace stream macros. First specify TRC_RECORDER_TRANSFER_METHOD_CUSTOM and then modify the TRC_STREAM_CUSTOM_XXXXXXXXX macros.
- Added trcPagedEventBuffer that can be used to avoid endless recursion for trace stream methods that use kernel objects (semaphores, mutexes) when sending data.
- Added trcTCPIP/trcTCPIPConfig for easy trace stream integration with custom TCP/IP stacks.
v2.8.5
- Added internal OS tick counter that can be used by certain kernel ports to keep track of the actual OS tick, in case it can be delayed.
- Updated generic macro names.
- Removed usage of strlen().
- Added support for width and padding formats for %d, %u, %x and %X.
- Reduced RAM usage for certain cases by redefining unused buffers.
- Fixed traceTAKE_MUTEX_RECURSIVE_FAILED being called traceTAKE_MUTEX_RECURSIVE resulting in duplicate defines.
- Implemented fix for missing parameter "xCopyPosition" when using "xSemaphoreGiveFromISR()" in FreeRTOS v8.
- Added prefix to internal defines to avoid conflicts.
- Fixed possible memory alignment issue which could cause hard fault.
- Made sure TzCtrl runs every 100ms instead of every 100 OS ticks.
- Moved project specific includes to trcConfig.h.
- Added a few backwards compatibility macros.
v2.8.2
- Improved vTracePrintF() parsing.
- Added vTracePrint() that performs no formatting.
- Removed need for passing parameter to vTraceStoreISREnd() on embOS port. This parameter is detected automatically.
- Added vTraceStoreISREndManual(param) that can be used on kernel ports that doesn't automatically detect pending task switches after interrupts.
v2.8.1
- New J-Link drivers fixes the RTT Buffer Index != 0 issue.
- trcRecorder.c hotfixed to handle missing defines in embOS that haven't made it to release yet.
v2.8.0
- Initial release. Only RTT Buffer Index 0 works in this version.
For questions, contact support@percepio.com or sales@percepio.com

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,110 @@
/*********************************************************************
* SEGGER MICROCONTROLLER SYSTEME GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996-2014 SEGGER Microcontroller Systeme GmbH *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
----------------------------------------------------------------------
File : SEGGER_RTT.h
Date : 17 Dec 2014
Purpose : Implementation of SEGGER real-time terminal which allows
real-time terminal communication on targets which support
debugger memory accesses while the CPU is running.
---------------------------END-OF-HEADER------------------------------
*/
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define SEGGER_RTT_MODE_MASK (3 << 0)
#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0)
#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1 << 0)
#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (1 << 1)
#define RTT_CTRL_RESET ""
#define RTT_CTRL_CLEAR ""
#define RTT_CTRL_TEXT_BLACK ""
#define RTT_CTRL_TEXT_RED ""
#define RTT_CTRL_TEXT_GREEN ""
#define RTT_CTRL_TEXT_YELLOW ""
#define RTT_CTRL_TEXT_BLUE ""
#define RTT_CTRL_TEXT_MAGENTA ""
#define RTT_CTRL_TEXT_CYAN ""
#define RTT_CTRL_TEXT_WHITE ""
#define RTT_CTRL_TEXT_BRIGHT_BLACK ""
#define RTT_CTRL_TEXT_BRIGHT_RED ""
#define RTT_CTRL_TEXT_BRIGHT_GREEN ""
#define RTT_CTRL_TEXT_BRIGHT_YELLOW ""
#define RTT_CTRL_TEXT_BRIGHT_BLUE ""
#define RTT_CTRL_TEXT_BRIGHT_MAGENTA ""
#define RTT_CTRL_TEXT_BRIGHT_CYAN ""
#define RTT_CTRL_TEXT_BRIGHT_WHITE ""
#define RTT_CTRL_BG_BLACK ""
#define RTT_CTRL_BG_RED ""
#define RTT_CTRL_BG_GREEN ""
#define RTT_CTRL_BG_YELLOW ""
#define RTT_CTRL_BG_BLUE ""
#define RTT_CTRL_BG_MAGENTA ""
#define RTT_CTRL_BG_CYAN ""
#define RTT_CTRL_BG_WHITE ""
#define RTT_CTRL_BG_BRIGHT_BLACK ""
#define RTT_CTRL_BG_BRIGHT_RED ""
#define RTT_CTRL_BG_BRIGHT_GREEN ""
#define RTT_CTRL_BG_BRIGHT_YELLOW ""
#define RTT_CTRL_BG_BRIGHT_BLUE ""
#define RTT_CTRL_BG_BRIGHT_MAGENTA ""
#define RTT_CTRL_BG_BRIGHT_CYAN ""
#define RTT_CTRL_BG_BRIGHT_WHITE ""
/*********************************************************************
*
* RTT API functions
*
**********************************************************************
*/
int SEGGER_RTT_Read (unsigned BufferIndex, char* pBuffer, unsigned BufferSize);
int SEGGER_RTT_Write (unsigned BufferIndex, const char* pBuffer, unsigned NumBytes);
int SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s);
int SEGGER_RTT_GetKey (void);
int SEGGER_RTT_WaitKey (void);
int SEGGER_RTT_HasKey (void);
int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, char* pBuffer, int BufferSize, int Flags);
int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, char* pBuffer, int BufferSize, int Flags);
void SEGGER_RTT_Init (void);
/*********************************************************************
*
* RTT "Terminal" API functions
*
**********************************************************************
*/
void SEGGER_RTT_SetTerminal (char TerminalId);
int SEGGER_RTT_TerminalOut (char TerminalId, const char* s);
/*********************************************************************
*
* RTT printf functions (require SEGGER_RTT_printf.c)
*
**********************************************************************
*/
int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...);
/*************************** End of file ****************************/

View File

@ -0,0 +1,57 @@
/*********************************************************************
* SEGGER MICROCONTROLLER SYSTEME GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996-2014 SEGGER Microcontroller Systeme GmbH *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
----------------------------------------------------------------------
File : SEGGER_RTT_Conf.h
Date : 17 Dec 2014
Purpose : Implementation of SEGGER real-time terminal which allows
real-time terminal communication on targets which support
debugger memory accesses while the CPU is running.
---------------------------END-OF-HEADER------------------------------
*/
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (2) // Max. number of up-buffers (T->H) available on this target (Default: 2)
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (2) // Max. number of down-buffers (H->T) available on this target (Default: 2)
#define BUFFER_SIZE_UP (10 * 1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
#define BUFFER_SIZE_DOWN (32) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
//
// 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.
// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
//
#define SEGGER_RTT_LOCK()
#define SEGGER_RTT_UNLOCK()
//
// Define SEGGER_RTT_IN_RAM as 1
// when using RTT in RAM targets (init and data section both in RAM).
// This prevents the host to falsly identify the RTT Callback Structure
// in the init segment as the used Callback Structure.
//
// When defined as 1,
// the first call to an RTT function will modify the ID of the RTT Callback Structure.
// To speed up identifying on the host,
// especially when RTT functions are not called at the beginning of execution,
// SEGGER_RTT_Init() should be called at the start of the application.
//
#define SEGGER_RTT_IN_RAM (0)
/*************************** End of file ****************************/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,194 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcHardwarePort.h
*
* The hardware abstraction layer for the trace recorder library.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#ifndef TRC_HARDWARE_PORT_H
#define TRC_HARDWARE_PORT_H
#ifdef __cplusplus
extern <EFBFBD>C<EFBFBD> {
#endif
#include <stdint.h>
/******************************************************************************
* Hardware 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 */
#define TRC_PORT_APPLICATION_DEFINED -1
#define TRC_PORT_NOT_SET 0
#define TRC_PORT_ARM_Cortex_M 1
#define TRC_PORT_ARM_CORTEX_A9 2
#define TRC_PORT_Renesas_RX600 3
#define TRC_PORT_TEXAS_INSTRUMENTS_TMS570_RM48 4
#define TRC_PORT_MICROCHIP_PIC32_MX_MZ 5
/*******************************************************************************
*
* HWTC Macros - Hardware Timer/Counter Isolation Layer
*
* These two HWTC macros provides a hardware isolation layer representing a
* generic hardware timer/counter used for the timestamping.
*
* HWTC_COUNT: The current value of the counter. This is expected to be reset
* a each tick interrupt. Thus, when the tick handler starts, the counter has
* already wrapped.
*
* HWTC_TYPE: Defines the type of timer/counter used for HWTC_COUNT:
*
* - FREE_RUNNING_32BIT_INCR:
* Free-running 32-bit timer, counting upwards from 0 - > 0xFFFFFFFF
*
* - FREE_RUNNING_32BIT_DECR
* Free-running 32-bit counter, counting downwards from 0xFFFFFFFF -> 0
*
* - OS_TIMER_INCR
* Interrupt timer, counts upwards from 0 until HWTC_PERIOD-1
*
* - OS_TIMER_DECR
* Interrupt timer, counts downwards from HWTC_PERIOD-1 until 0
*
*******************************************************************************
*
* IRQ_PRIORITY_ORDER
*
* Macro which should be defined as an integer of 0 or 1.
*
* It is only used only to sort and colorize the interrupts in priority order,
* in case you record interrupts using the vTraceStoreISRBegin and
* vTraceStoreISREnd routines. 1 indicates higher value is more important.
*
******************************************************************************/
#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
#if (TRC_RECORDER_HARDWARE_PORT == TRC_PORT_ARM_Cortex_M)
#define HWTC_TYPE TRC_OS_TIMER_DECR
#define HWTC_COUNT (*((uint32_t*)0xE000E018)) /* SysTick counter */
#define IRQ_PRIORITY_ORDER 0
#elif (TRC_RECORDER_HARDWARE_PORT == TRC_PORT_Renesas_RX600)
#include "iodefine.h"
#define HWTC_TYPE TRC_OS_TIMER_INCR
#define HWTC_COUNT (CMT0.CMCNT)
#define IRQ_PRIORITY_ORDER 1
#elif (TRC_RECORDER_HARDWARE_PORT == TRC_PORT_MICROCHIP_PIC32_MX_MZ)
#define HWTC_TYPE TRC_OS_TIMER_INCR
#define HWTC_COUNT (TMR1)
#define IRQ_PRIORITY_ORDER 0
#elif (TRC_RECORDER_HARDWARE_PORT == TRC_PORT_TEXAS_INSTRUMENTS_TMS570_RM48)
#define RTIFRC0 *((uint32_t *)0xFFFFFC10)
#define RTICOMP0 *((uint32_t *)0xFFFFFC50)
#define RTIUDCP0 *((uint32_t *)0xFFFFFC54)
#define HWTC_TYPE TRC_OS_TIMER_INCR
#define HWTC_COUNT (RTIFRC0 - (RTICOMP0 - RTIUDCP0))
#define IRQ_PRIORITY_ORDER 0
#elif (TRC_RECORDER_HARDWARE_PORT == TRC_PORT_ARM_CORTEX_A9)
/* INPUT YOUR PERIPHERAL BASE ADDRESS HERE */
#define CA9_MPCORE_PERIPHERAL_BASE_ADDRESS 0xSOMETHING
#define CA9_MPCORE_PRIVATE_MEMORY_OFFSET 0x0600
#define CA9_MPCORE_PRIVCTR_PERIOD_REG (*(volatile uint32_t*)(CA9_MPCORE_PERIPHERAL_BASE_ADDRESS + CA9_MPCORE_PRIVATE_MEMORY_OFFSET + 0x00))
#define CA9_MPCORE_PRIVCTR_COUNTER_REG (*(volatile uint32_t*)(CA9_MPCORE_PERIPHERAL_BASE_ADDRESS + CA9_MPCORE_PRIVATE_MEMORY_OFFSET + 0x04))
#define CA9_MPCORE_PRIVCTR_CONTROL_REG (*(volatile uint32_t*)(CA9_MPCORE_PERIPHERAL_BASE_ADDRESS + CA9_MPCORE_PRIVATE_MEMORY_OFFSET + 0x08))
#define CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_MASK 0x0000FF00
#define CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_SHIFT 8
#define CA9_MPCORE_PRIVCTR_PRESCALER (((CA9_MPCORE_PRIVCTR_CONTROL_REG & CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_MASK) >> CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_SHIFT) + 1)
#define HWTC_TYPE TRC_OS_TIMER_DECR
#define HWTC_COUNT CA9_MPCORE_PRIVCTR_COUNTER_REG
#define IRQ_PRIORITY_ORDER 0
#elif (TRC_RECORDER_HARDWARE_PORT == TRC_PORT_APPLICATION_DEFINED)
#if !( defined (HWTC_TYPE) && defined (HWTC_COUNT) && defined (IRQ_PRIORITY_ORDER))
#error RECORDER_HARDWARE_PORT is PORT_APPLICATION_DEFINED but not all of the necessary constants have been defined.
#endif
#elif (TRC_RECORDER_HARDWARE_PORT != TRC_PORT_NOT_SET)
#error "RECORDER_HARDWARE_PORT had unsupported value!"
#define TRC_RECORDER_HARDWARE_PORT PORT_NOT_SET
#endif
#if (TRC_RECORDER_HARDWARE_PORT != TRC_PORT_NOT_SET)
#ifndef HWTC_COUNT
#error "HWTC_COUNT is not set!"
#endif
#ifndef HWTC_TYPE
#error "HWTC_TYPE is not set!"
#endif
#ifndef IRQ_PRIORITY_ORDER
#error "IRQ_PRIORITY_ORDER is not set!"
#elif (IRQ_PRIORITY_ORDER != 0) && (IRQ_PRIORITY_ORDER != 1)
#error "IRQ_PRIORITY_ORDER has bad value!"
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* TRC_HARDWARE_PORT_H */

View File

@ -0,0 +1,267 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcKernelPort.c
*
* The kernel-specific code for integration with FreeRTOS.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#include "trcKernelPort.h"
#if (USE_TRACEALYZER_RECORDER == 1)
#include <stdint.h>
#include "trcRecorder.h"
#include "trcStreamPort.h"
#include "task.h"
/* TzCtrl task TCB */
static xTaskHandle HandleTzCtrl;
/* Called by TzCtrl task periodically (every 100 ms) */
static void CheckRecorderStatus(void);
/* The TzCtrl task - receives commands from Tracealyzer (start/stop) */
static portTASK_FUNCTION( TzCtrl, pvParameters );
/* Monitored by TzCtrl task, that give warnings as User Events */
extern volatile uint32_t NoRoomForSymbol;
extern volatile uint32_t NoRoomForObjectData;
extern volatile uint32_t LongestSymbolName;
extern volatile uint32_t MaxBytesTruncated;
#define TRC_PORT_MALLOC(size) pvPortMalloc(size)
#if ((TRC_STREAM_PORT_BLOCKING_TRANSFER == 1) && (TRC_MEASURE_BLOCKING_TIME == 1))
/*** Used in blocking transfer mode, if enabled TRC_MEASURE_BLOCKING_TIME **************/
/* The highest number of cycles used by SEGGER_RTT_Write. */
static volatile int32_t blockingCyclesMax;
/* The number of times SEGGER_RTT_Write has blocked due to a full buffer. */
static volatile uint32_t blockingCount;
/* User Event Channel for giving warnings regarding blocking */
static char* trcDiagnosticsChannel;
#endif /*((TRC_STREAM_PORT_BLOCKING_TRANSFER==1) && (TRC_MEASURE_BLOCKING_TIME))*/
TRC_STREAM_PORT_ALLOCATE_FIELDS()
/* User Event Channel for giving warnings regarding NoRoomForSymbol etc. */
char* trcWarningChannel;
/* Keeps track of previous values, to only react on changes. */
static uint32_t NoRoomForSymbol_last = 0;
static uint32_t NoRoomForObjectData_last = 0;
static uint32_t LongestSymbolName_last = 0;
static uint32_t MaxBytesTruncated_last = 0;
/*******************************************************************************
* prvTraceGetCurrentTaskHandle
*
* Function that returns the handle to the currently executing task.
*
******************************************************************************/
void* prvTraceGetCurrentTaskHandle(void)
{
return xTaskGetCurrentTaskHandle();
}
/*******************************************************************************
* prvIsNewTCB
*
* Function that returns the handle to the currently executing task.
*
******************************************************************************/
static void* pCurrentTCB = NULL;
uint32_t prvIsNewTCB(void* pNewTCB)
{
if (pCurrentTCB != pNewTCB)
{
pCurrentTCB = pNewTCB;
return 1;
}
return 0;
}
/*******************************************************************************
* CheckRecorderStatus
*
* Called by TzCtrl task periodically (every 100 ms - seems reasonable).
* Checks a number of diagnostic variables and give warnings as user events,
* in most cases including a suggested solution.
******************************************************************************/
static void CheckRecorderStatus(void)
{
if (NoRoomForSymbol > NoRoomForSymbol_last)
{
vTracePrintF(trcWarningChannel, "TRC_SYMBOL_TABLE_SLOTS too small. Add %d slots.",
NoRoomForSymbol);
NoRoomForSymbol_last = NoRoomForSymbol;
}
if (NoRoomForObjectData > NoRoomForObjectData_last)
{
vTracePrintF(trcWarningChannel, "TRC_OBJECT_DATA_SLOTS too small. Add %d slots.",
NoRoomForObjectData);
NoRoomForObjectData_last = NoRoomForObjectData;
}
if (LongestSymbolName > LongestSymbolName_last)
{
if (LongestSymbolName > TRC_SYMBOL_MAX_LENGTH)
{
vTracePrintF(trcWarningChannel, "TRC_SYMBOL_MAX_LENGTH too small. Add %d chars.",
LongestSymbolName);
}
LongestSymbolName_last = LongestSymbolName;
}
if (MaxBytesTruncated > MaxBytesTruncated_last)
{
/* Some string event generated a too long string that was truncated.
This may happen for the following functions:
- vTracePrintF
- vTracePrintF
- vTraceStoreKernelObjectName
- vTraceStoreUserEventChannelName
- vTraceSetISRProperties
A PSF event may store maximum 60 bytes payload, including data arguments
and string characters. For User Events, also the User Event Channel ptr
must be squeezed in, if a channel is specified. */
vTracePrintF(trcWarningChannel, "String event too long, up to %d bytes truncated.",
MaxBytesTruncated);
MaxBytesTruncated_last = MaxBytesTruncated;
}
#if ((TRC_STREAM_PORT_BLOCKING_TRANSFER==1) && (TRC_MEASURE_BLOCKING_TIME))
if (blockingCount > 0)
{
/* At least one case of blocking since the last check and this is
the longest case. */
vTracePrintF(trcDiagnosticsChannel, "Longest since last: %d us",
(uint32_t)blockingCyclesMax/(TRACE_CPU_CLOCK_HZ/1000000));
blockingCyclesMax = 0;
}
#endif
}
/*******************************************************************************
* vTraceOnTraceBegin
*
* Called on trace begin.
******************************************************************************/
void vTraceOnTraceBegin(void)
{
TRC_STREAM_PORT_ON_TRACE_BEGIN();
}
/*******************************************************************************
* vTraceOnTraceEnd
*
* Called on trace end.
******************************************************************************/
void vTraceOnTraceEnd(void)
{
TRC_STREAM_PORT_ON_TRACE_END();
}
/*******************************************************************************
* TzCtrl
*
* Task for receiving commands from Tracealyzer and for recorder diagnostics.
*
******************************************************************************/
static portTASK_FUNCTION( TzCtrl, pvParameters )
{
TracealyzerCommandType msg;
int bytes = 0;
while (1)
{
bytes = 0;
TRC_STREAM_PORT_READ_DATA(&msg, sizeof(TracealyzerCommandType), &bytes);
if (bytes != 0)
{
if (bytes == sizeof(TracealyzerCommandType))
{
if (isValidCommand(&msg))
{
processCommand(&msg); /* Start or Stop currently... */
}
}
}
do
{
bytes = 0;
TRC_STREAM_PORT_PERIODIC_SEND_DATA(&bytes);
}
while (bytes != 0);
CheckRecorderStatus();
vTaskDelay(TRC_CTRL_TASK_DELAY); /* 10ms */
}
}
/*******************************************************************************
* Trace_Init
*
* The main initialization routine for the trace recorder. Configures the stream
* and activates the TzCtrl task.
* Also sets up the diagnostic User Event channels used by TzCtrl task.
*
******************************************************************************/
void Trace_Init(void)
{
TRC_STREAM_PORT_INIT();
trcWarningChannel = vTraceStoreUserEventChannelName("Warnings from Recorder");
#if ((TRC_STREAM_PORT_BLOCKING_TRANSFER==1) && (TRC_MEASURE_BLOCKING_TIME))
trcDiagnosticsChannel = vTraceStoreUserEventChannelName("Blocking on trace buffer");
#endif
/* Creates the TzCtrl task - receives trace commands (start, stop, ...) */
xTaskCreate( TzCtrl, "TzCtrl", configMINIMAL_STACK_SIZE, NULL, TRC_CTRL_TASK_PRIORITY, &HandleTzCtrl );
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcPagedEventBuffer.h
*
* Implements a paged buffer that can be used by TCP/IP or custom transfer
* methods.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#ifndef TRC_PAGED_EVENT_BUFFER_H
#define TRC_PAGED_EVENT_BUFFER_H
#ifdef __cplusplus
extern <EFBFBD>C<EFBFBD> {
#endif
void vPagedEventBufferInit(char* buffer);
void* vPagedEventBufferGetWritePointer(int sizeOfEvent);
int32_t vPagedEventBufferTransfer(int32_t (*writeFunc)(void* data, uint32_t size, int32_t* ptrBytesWritten), int32_t* nofBytes);
void vPagedEventBufferReset(void);
#ifdef __cplusplus
}
#endif
#endif /*TRC_PAGED_EVENT_BUFFER_H*/

View File

@ -0,0 +1,56 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcPagedEventBuffer.h
*
* Configuration for the paged event buffer that can be used by TCP/IP or
* custom transfer methods.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#ifndef TRC_PAGED_EVENT_BUFFER_CONFIG_H
#define TRC_PAGED_EVENT_BUFFER_CONFIG_H
#ifdef __cplusplus
extern <EFBFBD>C<EFBFBD> {
#endif
#define TRC_PAGED_EVENT_BUFFER_PAGE_COUNT 5
#define TRC_PAGED_EVENT_BUFFER_PAGE_SIZE 1440
#ifdef __cplusplus
}
#endif
#endif /*TRC_PAGED_EVENT_BUFFER_CONFIG_H*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,219 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcStreamPort.h
*
* This file defines the trace streaming interface used by the
* Trace Recorder Library. It comes preconfigured for use with SEGGER's RTT and
* a TCP/IP (needs additional configuration in trcTCPIPConfig.h).
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#ifndef _TRC_STREAM_PORT_H
#define _TRC_STREAM_PORT_H
#ifdef __cplusplus
extern <EFBFBD>C<EFBFBD> {
#endif
#if (USE_TRACEALYZER_RECORDER == 1)
#define TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_BLOCK (0x01)
#define TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_NOBLOCK (0x02)
#define TRC_RECORDER_TRANSFER_METHOD_TCPIP (0x03)
#define TRC_RECORDER_TRANSFER_METHOD_CUSTOM (0xFF)
#define TRC_RECORDER_BUFFER_ALLOCATION_STATIC (0x00)
#define TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC (0x01)
/*******************************************************************************
* TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_BLOCK / NOBLOCK
******************************************************************************/
#if TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_BLOCK || TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_NOBLOCK
#if TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_BLOCK
#define TRC_STREAM_PORT_BLOCKING_TRANSFER 1
#define RTT_MODE SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
#else
#define TRC_STREAM_PORT_BLOCKING_TRANSFER 0
#define RTT_MODE SEGGER_RTT_MODE_NO_BLOCK_SKIP
#endif
#include "SEGGER_RTT_Conf.h"
#include "SEGGER_RTT.h"
/* Up-buffer. If index is defined as 0, the internal RTT buffers will be used instead of this. */ \
#if TRC_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_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
#define TRC_RTT_ALLOC_UP() static char _TzTraceData[BUFFER_SIZE_UP]; /* Static allocation */
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
#else
#define TRC_RTT_ALLOC_UP() static char* _TzTraceData = NULL; /* Dynamic allocation */
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(BUFFER_SIZE_UP);
#endif
#endif
/* Down-buffer. If index is defined as 0, the internal RTT buffers will be used instead of this. */ \
#if TRC_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[BUFFER_SIZE_DOWN]; /* This buffer should be ~32bytes. Ignore allocation method. */
#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 */
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
SEGGER_RTT_ConfigUpBuffer(TRC_RTT_UP_BUFFER_INDEX, "TzData", _TzTraceData, sizeof(_TzTraceData), RTT_MODE ); \
SEGGER_RTT_ConfigDownBuffer(TRC_RTT_DOWN_BUFFER_INDEX, "TzCtrl", _TzCtrlData, sizeof(_TzCtrlData), 0);
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) uint8_t tmpEvt[_size]; _type* _ptrData = (_type*)tmpEvt;
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) SEGGER_RTT_Write(TRC_RTT_UP_BUFFER_INDEX, (const char*)_ptrData, _size);
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) *_ptrBytesRead = SEGGER_RTT_Read(TRC_RTT_DOWN_BUFFER_INDEX, (char*)_ptrData, _size);
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent)
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() /* Do nothing */
#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */
#endif /*TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_BLOCK || TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_JLINK_RTT_NOBLOCK*/
/*******************************************************************************
* TRC_RECORDER_TRANSFER_METHOD_TCPIP
*
* This TCP/IP implementation is using a secondary buffer consisting of multiple
* pages to avoid the endless recursive calls that occurr when "socket_send"
* uses kernel objects such as mutexes and semaphores, which in turn needs to be
* traced. To use your own TCP/IP stack, modify the functions declared in
* trcTCPIPConfig.h.
******************************************************************************/
#if TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_TCPIP
#include "trcTCPIP.h"
#include "trcPagedEventBuffer.h"
#include "trcPagedEventBufferConfig.h"
#define TRC_STREAM_PORT_BLOCKING_TRANSFER 0
#if TRC_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char _TzTraceData[TRC_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_PAGED_EVENT_BUFFER_PAGE_SIZE]; /* Static allocation. */
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
#else
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char* _TzTraceData = NULL; /* Dynamic allocation. */
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_PAGED_EVENT_BUFFER_PAGE_SIZE);
#endif
#define TRC_STREAM_PORT_INIT() \
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
vPagedEventBufferInit(_TzTraceData);
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)vPagedEventBufferGetWritePointer(_size);
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not needed since we write immediately into the buffer received above by TRC_STREAM_PORT_ALLOCATE_EVENT, and the TRC_STREAM_PORT_PERIODIC_SEND_DATA defined below will take care of the actual trace transfer. */
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead);
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) vPagedEventBufferTransfer(trcTcpWrite, _ptrBytesSent);
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() vPagedEventBufferInit(_TzTraceData);
#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */
#endif /*TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_TCPIP*/
/*******************************************************************************
* TRC_RECORDER_TRANSFER_METHOD_CUSTOM
*
* Implement the following macros in trcConfig.h. If your transfer method uses
* kernel objects when sending data you will need to use a secondary buffer to
* store the trace data before sending it. For this reason we provide
* trcPagedEventBuffer. Look at the TCP/IP macros above to see how to use it.
******************************************************************************/
#if TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_CUSTOM
/* When using the custom transfer method, define TRC_STREAM_CUSTOM_XXXXXXXXXXXXX in trcConfig.h */
#define TRC_STREAM_PORT_BLOCKING_TRANSFER TRC_STREAM_CUSTOM_BLOCKING_TRANSFER
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() TRC_STREAM_CUSTOM_ALLOCATE_FIELDS()
#define TRC_STREAM_PORT_INIT() TRC_STREAM_CUSTOM_INIT()
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptr, _size) TRC_STREAM_CUSTOM_ALLOCATE_EVENT(_type, _ptr, _size)
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptr, _size) TRC_STREAM_CUSTOM_COMMIT_EVENT(_ptr, _size)
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) TRC_STREAM_CUSTOM_READ_DATA(_ptrData, _size, _ptrBytesRead)
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) TRC_STREAM_CUSTOM_PERIODIC_SEND_DATA(_ptrBytesSent)
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() TRC_STREAM_CUSTOM_ON_TRACE_BEGIN()
#define TRC_STREAM_PORT_ON_TRACE_END() TRC_STREAM_CUSTOM_ON_TRACE_END()
#endif /*TRC_RECORDER_TRANSFER_METHOD == TRC_RECORDER_TRANSFER_METHOD_CUSTOM*/
#ifndef TRC_STREAM_PORT_ALLOCATE_FIELDS
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_ALLOCATE_FIELDS!"
#endif
#ifndef TRC_STREAM_PORT_ALLOCATE_EVENT
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_ALLOCATE_EVENT!"
#endif
#ifndef TRC_STREAM_PORT_COMMIT_EVENT
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_COMMIT_EVENT!"
#endif
#ifndef TRC_STREAM_PORT_INIT
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_INIT!"
#endif
#ifndef TRC_STREAM_PORT_BLOCKING_TRANSFER
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_BLOCKING_TRANSFER!"
#endif
#ifndef TRC_STREAM_PORT_READ_DATA
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_READ_DATA!"
#endif
#ifndef TRC_STREAM_PORT_PERIODIC_SEND_DATA
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_PERIODIC_SEND_DATA!"
#endif
#ifndef TRC_STREAM_PORT_ON_TRACE_BEGIN
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_ON_TRACE_BEGIN!"
#endif
#ifndef TRC_STREAM_PORT_ON_TRACE_END
#error "Selected TRC_RECORDER_TRANSFER_METHOD does not define TRC_STREAM_PORT_ON_TRACE_END!"
#endif
#endif /*(USE_TRACEALYZER_RECORDER == 1)*/
#ifdef __cplusplus
}
#endif
#endif /* _TRC_STREAM_PORT_H */

View File

@ -0,0 +1,58 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcTCPIP.c
*
* Simple generic TCP/IP layer. Modify trcTCPIPConfig.h to adapt it to any
* custom stack.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#include <stdint.h>
#include "trcTCPIP.h"
#include "trcTCPIPConfig.h"
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);
}

View File

@ -0,0 +1,56 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcTCPIP.h
*
* Simple generic TCP/IP layer. Modify trcTCPIPConfig.h to adapt it to any
* custom stack.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#ifndef TRC_TCPIP_H
#define TRC_TCPIP_H
#ifdef __cplusplus
extern <EFBFBD>C<EFBFBD> {
#endif
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead);
#ifdef __cplusplus
}
#endif
#endif /*TRC_TCPIP_H*/

View File

@ -0,0 +1,163 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v3.0.2
* Percepio AB, www.percepio.com
*
* trcTCPIPConfig.h
*
* Trace TCP/IP configuration. Modify these includes and functions to perform
* the same functionality using your specific TCP/IP stack.
* Will only be included by trcTCPIP.c.
*
* Terms of Use
* This software (the "Tracealyzer Recorder Library") is the intellectual
* property of Percepio AB and may not be sold or in other ways commercially
* redistributed without explicit written permission by Percepio AB.
*
* Separate conditions applies for the SEGGER branded source code included.
*
* The recorder library is free for use together with Percepio products.
* You may distribute the recorder library in its original form, but public
* distribution of modified versions require approval by Percepio AB.
*
* Disclaimer
* The trace tool and recorder library is being delivered to you AS IS and
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
* not and cannot warrant the performance or results you may obtain by using the
* software or documentation. Percepio AB make no warranties, express or
* implied, as to noninfringement of third party rights, merchantability, or
* fitness for any particular purpose. In no event will Percepio AB, its
* technology partners, or distributors be liable to you for any consequential,
* incidental or special damages, including any lost profits or lost savings,
* even if a representative of Percepio AB has been advised of the possibility
* of such damages, or for any claim by any third party. Some jurisdictions do
* not allow the exclusion or limitation of incidental, consequential or special
* damages, or the exclusion of implied warranties or limitations on how long an
* 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, 2015.
* www.percepio.com
******************************************************************************/
#ifndef TRC_TCPIP_CONFIG_H
#define TRC_TCPIP_CONFIG_H
#ifdef __cplusplus
extern <EFBFBD>C<EFBFBD> {
#endif
/* TCP/IP includes*/
#include "tcpip.h"
#define TRC_TCPIP_PORT 12000
socket* sock = NULL;
socket* listenerSocket = NULL;
int32_t trcSocketSend(void* data, int32_t size, int32_t* bytesWritten)
{
int32_t error;
if (sock == NULL)
return 1;
error = socket_send(sock, data, size, (size_t*)bytesWritten, 0);
if (error)
{
socket_close(sock);
sock = NULL;
}
return (int32_t)error;
}
int32_t trcSocketReceive(void* data, int32_t size, int32_t* bytesRead)
{
int32_t error;
if (sock == NULL)
return 1;
error = socket_receive(sock, data, size, (size_t*)bytesRead, SOCKET_WAIT_ALL);
if (error != ERROR_NONE && error != ERROR_TIMEOUT) /* Timeout may be expected when there is no data */
{
socket_close(sock);
sock = NULL;
return error;
}
return 0;
}
int32_t trcSocketInitializeListener()
{
int32_t error;
if (listenerSocket)
return 0;
//Start of exception handling block
do
{
listenerSocket = socket_open(SOCKET_STREAM, SOCKET_TCP);
if(listenerSocket == NULL)
{
error = 1;
break;
}
error = socket_set_timeout(listenerSocket, INFINITE);
if(error) break;
error = socket_set_tx_buffer_size(listenerSocket, 1440 * 2);
if(error) break;
error = socket_set_rx_buffer_size(listenerSocket, 128);
if(error) break;
error = socket_bind_to_interface(listenerSocket, pNetInterface);
if(error) break;
error = socket_bind(listenerSocket, ADDR_ANY, TRC_TCPIP_PORT);
if(error) break;
error = socket_listen(listenerSocket);
if(error) break;
} while(0);
if(error)
{
socket_close(listenerSocket);
listenerSocket = NULL;
}
return error;
}
int32_t trcSocketAccept()
{
ip_addr clientIpAddr;
uint16_t clientPort;
if (sock != NULL)
return 0;
if (listenerSocket == NULL)
return 1;
/* Wait for connection */
sock = socket_accept(listenerSocket, &clientIpAddr, &clientPort);
if(sock != NULL)
{
socket_set_timeout(sock, 20);
}
else
return 1;
return 0;
}
#ifdef __cplusplus
}
#endif
#endif /*TRC_TCPIP_CONFIG_H*/

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcConfig.h
@ -38,7 +38,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/
@ -116,7 +116,7 @@
* recording is stopped when the buffer becomes full. This is useful for
* recording events following a specific state, e.g., the startup sequence.
*****************************************************************************/
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_STOP_WHEN_FULL
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
/*******************************************************************************
* TRACE_SCHEDULING_ONLY
@ -126,8 +126,8 @@
* If this setting is enabled (= 1), only scheduling events are recorded.
* If disabled (= 0), all events are recorded.
*
* Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this
* option can be used to avoid storing unsupported events.
* For users of "Free Edition", that only displays scheduling events, this
* option can be used to avoid storing other events.
*
* Default value is 0 (store all enabled events).
*

View File

@ -1,10 +1,10 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcKernel.c
* trcBase.h
*
* Functions used by trcKernelHooks.h for storing various kernel events.
* Core functionality of the Tracealyzer recorder library.
*
* Terms of Use
* This software is copyright Percepio AB. The recorder library is free for
@ -33,7 +33,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/
@ -65,8 +65,10 @@
/* Max number of event codes supported */
#define NEventCodes 0x100
extern volatile int recorder_busy; // This is used to keep track of the recorder's critical sections, to determine if it is busy
// Our local critical sections for the recorder - updates an internal busy flag
/* Keeps track of the recorder's critical sections */
extern volatile int recorder_busy;
/* Our local critical sections for the recorder */
#define trcCRITICAL_SECTION_BEGIN() {TRACE_ENTER_CRITICAL_SECTION(); recorder_busy++;}
#define trcCRITICAL_SECTION_END() {recorder_busy--; TRACE_EXIT_CRITICAL_SECTION();}
@ -335,7 +337,7 @@ typedef struct
/* Used to determine Kernel and Endianess */
uint16_t version;
/* Currently 3, since v2.6.0 */
/* Currently 3 */
uint8_t minor_version;
/* This should be 0 if lower IRQ priority values implies higher priority

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcHardwarePort.h
@ -34,7 +34,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcKernel.h
@ -31,7 +31,7 @@
* damages, or the exclusion of implied warranties or limitations on how long an
* implied warranty may last, so the above limitations may not apply to you.
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2013.
* www.percepio.com
******************************************************************************/

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcKernelHooks.h
@ -40,7 +40,7 @@
* damages, or the exclusion of implied warranties or limitations on how long an
* implied warranty may last, so the above limitations may not apply to you.
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2013.
* www.percepio.com
******************************************************************************/

View File

@ -1,8 +1,8 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcKernelPortFreeRTOS.h
* trcKernelPort.h
*
* Kernel-specific functionality for FreeRTOS, used by the recorder library.
*
@ -33,7 +33,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/
@ -57,8 +57,7 @@ extern int uiInEventGroupSetBitsFromISR;
#if (SELECTED_PORT == PORT_ARM_CortexM)
/* If you get warnings regarding __get_PRIMASK and __set_PRIMASK, make sure that ARM's CMSIS API is included
by the recorder using your chip vendor header file (e.g., "board.h", "stm32f4xx.h", "lpc17xx.h") */
/* Uses CMSIS API */
#define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);}
@ -66,6 +65,12 @@ extern int uiInEventGroupSetBitsFromISR;
#endif
#if (SELECTED_PORT == PORT_ARM_CORTEX_M0)
#define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}
#define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);}
#endif
#if ((SELECTED_PORT == PORT_ARM_CORTEX_A9) || (SELECTED_PORT == PORT_Renesas_RX600) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ))
#define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}
@ -471,7 +476,6 @@ void* prvTraceGetCurrentTaskHandle(void);
#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TraceObjectClassTable[kernelClass]
#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_CLASS_TRACE_CLASS(CLASS, prvTraceGetObjectType(pxObject))
/* Note: Timer tracing only supported on FreeRTOS v8 or later, so "Timer_t" is safe to use! */
#define TRACE_GET_TIMER_NUMBER(tmr) ( ( objectHandleType ) ((Timer_t*)tmr)->uxTimerNumber )
#define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = xTraceGetObjectHandle(TRACE_CLASS_TIMER);
#define TRACE_GET_TIMER_NAME(pxTimer) pxTimer->pcTimerName
@ -553,6 +557,12 @@ void* prvTraceGetCurrentTaskHandle(void);
#define traceTASK_SUSPEND( pxTaskToSuspend ) \
trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend);
/* Called from special case with timer only */
#undef traceTASK_DELAY_SUSPEND
#define traceTASK_DELAY_SUSPEND( pxTaskToSuspend ) \
trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */
#undef traceTASK_DELAY
#define traceTASK_DELAY() \
@ -1064,11 +1074,3 @@ vTraceSetObjectName(TRACE_CLASS_EVENTGROUP, (objectHandleType)uxEventGroupGetNum
#endif
#endif /* TRCKERNELPORTFREERTOS_H_ */

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcTypes.h
@ -33,7 +33,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcUser.h
@ -32,7 +32,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/
@ -385,7 +385,7 @@ void vTraceUserEvent(traceLabel eventLabel);
*
* Calling xTraceOpenLabel multiple times will not create duplicate entries, but
* it is of course faster to just do it once, and then keep the handle for later
* use. If you don<6F>t have any data arguments, only a text label/string, it is
* use. If you don<6F>t have any data arguments, only a text label/string, it is
* better to use vTraceUserEvent - it is faster.
*
* Format specifiers supported:

View File

@ -4,10 +4,10 @@ Tracealyzer Trace Recorder Library
Percepio AB
www.percepio.com
This directory contains the a generic trace recorder library for Tracealyzer v2.7.
This directory contains the a generic trace recorder library for Tracealyzer v3.0.2.
For information on how to upload the trace data from your target system RAM to
Tracealyzer, see the User Manual (e.g., http://percepio.com/docs/FreeRTOS/manual/Recorder.html)
Tracealyzer, see the User Manual.
Files included
--------------

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcBase.c
@ -33,11 +33,11 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/
#include "trcBase.h"
#include "trcBase.h"
#if (USE_TRACEALYZER_RECORDER == 1)
@ -166,7 +166,7 @@ void prvTraceInitTraceData()
RecorderDataPtr->SymbolTable.symTableSize = SYMBOL_TABLE_SIZE;
RecorderDataPtr->SymbolTable.nextFreeSymbolIndex = 1;
#if (INCLUDE_FLOAT_SUPPORT == 1)
RecorderDataPtr->exampleFloatEncoding = (float)1.0; /* otherwise already zero */
RecorderDataPtr->exampleFloatEncoding = 1.0f; /* otherwise already zero */
#endif
RecorderDataPtr->debugMarker2 = 0xF2F2F2F2;
(void)strncpy(RecorderDataPtr->systemInfo, "Trace Recorder Demo", 80);

View File

@ -1,15 +1,16 @@
/*******************************************************************************
* Tracealyzer v2.7.7 Recorder Library
* Tracealyzer v3.0.2 Recorder Library
* Percepio AB, www.percepio.com
*
* trcBase.c
* trcHardwarePort.c
*
* Core functionality of the trace recorder library.
* Contains together with trcHardwarePort.h all hardware portability issues of
* the trace recorder library.
*
* Terms of Use
* This software is copyright Percepio AB. The recorder library is free for
* use together with Percepio products. You may distribute the recorder library
* in its original form, including modifications in trcHardwarePort.c/.h
* in its original form, including modifications in trcPort.c and trcPort.h
* given that these modification are clearly marked as your own modifications
* and documented in the initial comment section of these source files.
* This software is the intellectual property of Percepio AB and may not be
@ -33,7 +34,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2012-2015.
* Copyright Percepio AB, 2014.
* www.percepio.com
******************************************************************************/

Some files were not shown because too many files have changed in this diff Show More