mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
Update trace recorder code.
Add TCP Echo server to the FreeR_Plus_TCP_Minimal_Window_Simulator project.
This commit is contained in:
parent
f7fc215247
commit
d525d5092d
35 changed files with 4431 additions and 2436 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Trace Recorder Library for Tracealyzer v4.1.1
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcStreamingPort.h
|
||||
|
@ -7,6 +7,11 @@
|
|||
* The interface definitions for trace streaming ("stream ports").
|
||||
* This "stream port" sets up the recorder to use SEGGER RTT as streaming channel.
|
||||
*
|
||||
* Note that this stream port is more complex than the typical case, since
|
||||
* the J-Link interface uses a separate RAM buffer in SEGGER_RTT.c, instead
|
||||
* of the default buffer included in the recorder core. The other stream ports
|
||||
* offer more typical examples of how to define a custom streaming interface.
|
||||
*
|
||||
* Terms of Use
|
||||
* This file is part of the trace recorder library (RECORDER), which is the
|
||||
* intellectual property of Percepio AB (PERCEPIO) and provided under a
|
||||
|
@ -39,7 +44,7 @@
|
|||
*
|
||||
* Tabs are used for indent in this file (1 tab = 4 spaces)
|
||||
*
|
||||
* Copyright Percepio AB, 2017.
|
||||
* Copyright Percepio AB, 2018.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -113,17 +118,18 @@ extern "C" {
|
|||
* internal RAM buffer read by the J-Link probes during execution.
|
||||
*
|
||||
* Possible values:
|
||||
* - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (default)
|
||||
* - SEGGER_RTT_MODE_NO_BLOCK_SKIP
|
||||
* - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
* - SEGGER_RTT_MODE_NO_BLOCK_SKIP (default)
|
||||
*
|
||||
* We recommend using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL, to ensure you get a
|
||||
* Using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL ensure that you get a
|
||||
* complete and valid trace. This may however cause blocking if your streaming
|
||||
* interface isn't fast enough, which may disturb the real-time behavior.
|
||||
* We therefore recommend to try SEGGER_RTT_MODE_NO_BLOCK_SKIP as well.
|
||||
* In this mode, Tracealyzer will report lost events if the transfer is not
|
||||
*
|
||||
* We therefore recommend SEGGER_RTT_MODE_NO_BLOCK_SKIP. In this mode,
|
||||
* Tracealyzer will report lost events if the transfer is not
|
||||
* fast enough. In that case, try increasing the size of the "up buffer".
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_NO_BLOCK_SKIP
|
||||
|
||||
#include "SEGGER_RTT_Conf.h"
|
||||
#include "SEGGER_RTT.h"
|
||||
|
@ -140,22 +146,18 @@ extern "C" {
|
|||
#if TRC_CFG_RTT_UP_BUFFER_INDEX == 0
|
||||
#define TRC_RTT_ALLOC_UP() static char* _TzTraceData = NULL; /* Not actually used. Ignore allocation method. */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */
|
||||
#else
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
#define TRC_RTT_ALLOC_UP() char _TzTraceData[TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Static allocation */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */
|
||||
#endif
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC
|
||||
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Dynamic allocation */
|
||||
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_RTT_BUFFER_SIZE_UP);
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */
|
||||
#endif
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM
|
||||
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Custom allocation, user needs to call vTraceSetRecorderDataBuffer before vTraceEnable, to assign this */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Not used in custom mode */
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) char bufname [TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Not static in this case, since declared in user code */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -170,20 +172,22 @@ extern "C" {
|
|||
TRC_RTT_ALLOC_UP() /* Macro that will result in proper UP buffer allocation */ \
|
||||
TRC_RTT_ALLOC_DOWN() /* Macro that will result in proper DOWN buffer allocation */
|
||||
|
||||
int32_t readFromRTT(void* ptrData, uint32_t size, int32_t* ptrBytesRead);
|
||||
|
||||
int32_t writeToRTT(void* ptrData, uint32_t size, int32_t* ptrBytesWritten);
|
||||
|
||||
|
||||
#define TRC_STREAM_PORT_INIT() \
|
||||
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
|
||||
SEGGER_RTT_ConfigUpBuffer(TRC_CFG_RTT_UP_BUFFER_INDEX, "TzData", _TzTraceData, TRC_CFG_RTT_BUFFER_SIZE_UP, TRC_CFG_RTT_MODE ); \
|
||||
SEGGER_RTT_ConfigDownBuffer(TRC_CFG_RTT_DOWN_BUFFER_INDEX, "TzCtrl", _TzCtrlData, TRC_CFG_RTT_BUFFER_SIZE_DOWN, TRC_CFG_RTT_MODE);
|
||||
|
||||
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type _tmpArray[_size / sizeof(_type)]; _type* _ptrData = _tmpArray;
|
||||
#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) _type _tmpArray[sizeof(largestEventType) / sizeof(_type)]; _type* _ptrData = _tmpArray;
|
||||
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) SEGGER_RTT_Write(TRC_CFG_RTT_UP_BUFFER_INDEX, (const char*)_ptrData, _size);
|
||||
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) if (SEGGER_RTT_HASDATA(TRC_CFG_RTT_DOWN_BUFFER_INDEX)) *_ptrBytesRead = (int)SEGGER_RTT_Read(TRC_CFG_RTT_DOWN_BUFFER_INDEX, (char*)_ptrData, _size);
|
||||
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent)
|
||||
/* Important for the J-Link port, in most other ports this can be skipped (default is 1) */
|
||||
#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 0
|
||||
|
||||
#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesWritten) writeToRTT(_ptrData, _size, _ptrBytesWritten)
|
||||
|
||||
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() /* Do nothing */
|
||||
#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */
|
||||
|
||||
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) readFromRTT(_ptrData, _size, _ptrBytesRead)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue