mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-01 08:54:14 -04:00
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:
parent
f218cf5680
commit
96ff3925d2
32 changed files with 6067 additions and 123 deletions
|
@ -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).
|
||||
*
|
||||
|
|
|
@ -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();}
|
||||
|
||||
|
@ -145,7 +147,7 @@ typedef struct
|
|||
|
||||
/* This is used to calculate the index in the dynamic object table
|
||||
(handle - 1 - nofStaticObjects = index)*/
|
||||
#if (USE_16BIT_OBJECT_HANDLES == 1)
|
||||
#if (USE_16BIT_OBJECT_HANDLES == 1)
|
||||
objectHandleType NumberOfObjectsPerClass[2*((TRACE_NCLASSES+1)/2)];
|
||||
#else
|
||||
objectHandleType NumberOfObjectsPerClass[4*((TRACE_NCLASSES+3)/4)];
|
||||
|
@ -242,7 +244,7 @@ typedef struct
|
|||
uint8_t type;
|
||||
uint8_t unused1;
|
||||
uint8_t unused2;
|
||||
uint8_t dts;
|
||||
uint8_t dts;
|
||||
} TaskInstanceStatusEvent;
|
||||
|
||||
typedef struct
|
||||
|
@ -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
|
||||
|
@ -374,7 +376,7 @@ typedef struct
|
|||
|
||||
/* Not used, remains for compatibility and future use */
|
||||
uint8_t notused[28];
|
||||
|
||||
|
||||
/* The amount of heap memory remaining at the last malloc or free event */
|
||||
uint32_t heapMemUsage;
|
||||
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -56,16 +56,21 @@ extern int uiInEventGroupSetBitsFromISR;
|
|||
#define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOSConfig.h" */
|
||||
|
||||
#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") */
|
||||
|
||||
#define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
|
||||
/* Uses CMSIS API */
|
||||
|
||||
#define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
|
||||
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);}
|
||||
#define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);}
|
||||
|
||||
#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_ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -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´t have any data arguments, only a text label/string, it is
|
||||
* use. If you don<EFBFBD>t have any data arguments, only a text label/string, it is
|
||||
* better to use vTraceUserEvent - it is faster.
|
||||
*
|
||||
* Format specifiers supported:
|
||||
|
|
|
@ -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
|
||||
--------------
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/* Tasks and kernel objects can be explicitly excluded from the trace to reduce
|
||||
buffer usage. This structure handles the exclude flags for all objects and tasks.
|
||||
buffer usage. This structure handles the exclude flags for all objects and tasks.
|
||||
Note that slot 0 is not used, since not a valid handle. */
|
||||
uint8_t excludedObjects[(TRACE_KERNEL_OBJECT_COUNT + TRACE_NCLASSES) / 8 + 1] = { 0 };
|
||||
|
||||
|
@ -58,43 +58,43 @@ This structure handle the exclude flags for all event codes */
|
|||
uint8_t excludedEventCodes[NEventCodes / 8 + 1] = { 0 };
|
||||
|
||||
/* A set of stacks that keeps track of available object handles for each class.
|
||||
The stacks are empty initially, meaning that allocation of new handles will be
|
||||
The stacks are empty initially, meaning that allocation of new handles will be
|
||||
based on a counter (for each object class). Any delete operation will
|
||||
return the handle to the corresponding stack, for reuse on the next allocate.*/
|
||||
objectHandleStackType objectHandleStacks = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 } };
|
||||
|
||||
/* Initial HWTC_COUNT value, for detecting if the time-stamping source is
|
||||
enabled. If using the OS periodic timer for time-stamping, this might not
|
||||
/* Initial HWTC_COUNT value, for detecting if the time-stamping source is
|
||||
enabled. If using the OS periodic timer for time-stamping, this might not
|
||||
have been configured on the earliest events during the startup. */
|
||||
uint32_t init_hwtc_count;
|
||||
|
||||
/*******************************************************************************
|
||||
* RecorderData
|
||||
*
|
||||
* The main data structure. This is the data read by the Tracealyzer tools,
|
||||
* typically through a debugger RAM dump. The recorder uses the pointer
|
||||
* The main data structure. This is the data read by the Tracealyzer tools,
|
||||
* typically through a debugger RAM dump. The recorder uses the pointer
|
||||
* RecorderDataPtr for accessing this, to allow for dynamic allocation.
|
||||
*
|
||||
* On the NXP LPC17xx you may use the secondary RAM bank (AHB RAM) for this
|
||||
* purpose. For instance, the LPC1766 has 32 KB AHB RAM which allows for
|
||||
* allocating a buffer size of at least 7500 events without affecting the main
|
||||
* RAM. To place RecorderData in this RAM bank using IAR Embedded Workbench
|
||||
* RAM. To place RecorderData in this RAM bank using IAR Embedded Workbench
|
||||
* for ARM, use this pragma right before the declaration:
|
||||
*
|
||||
* #pragma location="AHB_RAM_MEMORY"
|
||||
*
|
||||
* This of course works for other hardware architectures with additional RAM
|
||||
* banks as well, just replace "AHB_RAM_MEMORY" with the section name from the
|
||||
* banks as well, just replace "AHB_RAM_MEMORY" with the section name from the
|
||||
* linker .map file, or simply the desired address.
|
||||
*
|
||||
* For portability reasons, we don't add the pragma directly in trcBase.c, but
|
||||
* For portability reasons, we don't add the pragma directly in trcBase.c, but
|
||||
* in a header file included below. To include this header, you need to enable
|
||||
* USE_LINKER_PRAGMA, defined in trcConfig.h.
|
||||
*
|
||||
* If using GCC, you need to modify the declaration as follows:
|
||||
*
|
||||
* RecorderDataType RecorderData __attribute__ ((section ("name"))) = ...
|
||||
*
|
||||
*
|
||||
* Remember to replace "name" with the correct section name.
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -113,9 +113,9 @@ RecorderDataType* RecorderDataPtr = NULL;
|
|||
|
||||
/* This version of the function dynamically allocates the trace data */
|
||||
void prvTraceInitTraceData()
|
||||
{
|
||||
{
|
||||
init_hwtc_count = HWTC_COUNT;
|
||||
|
||||
|
||||
#if TRACE_DATA_ALLOCATION == TRACE_DATA_ALLOCATION_STATIC
|
||||
RecorderDataPtr = &RecorderData;
|
||||
#elif TRACE_DATA_ALLOCATION == TRACE_DATA_ALLOCATION_DYNAMIC
|
||||
|
@ -132,7 +132,7 @@ void prvTraceInitTraceData()
|
|||
vTraceError("No recorder data structure allocated!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
(void)memset(RecorderDataPtr, 0, sizeof(RecorderDataType));
|
||||
|
||||
RecorderDataPtr->startmarker0 = 0x00;
|
||||
|
@ -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);
|
||||
|
@ -196,7 +196,7 @@ void prvTraceInitTraceData()
|
|||
|
||||
/* Fix the start markers of the trace data structure */
|
||||
vInitStartMarkers();
|
||||
|
||||
|
||||
#ifdef PORT_SPECIFIC_INIT
|
||||
PORT_SPECIFIC_INIT();
|
||||
#endif
|
||||
|
@ -242,15 +242,15 @@ void* xTraceNextFreeEventBufferSlot(void)
|
|||
|
||||
uint16_t uiIndexOfObject(objectHandleType objecthandle, uint8_t objectclass)
|
||||
{
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
"uiIndexOfObject: Invalid value for objectclass", 0);
|
||||
TRACE_ASSERT(objecthandle > 0 && objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],
|
||||
TRACE_ASSERT(objecthandle > 0 && objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],
|
||||
"uiIndexOfObject: Invalid value for objecthandle", 0);
|
||||
|
||||
if ((objectclass < TRACE_NCLASSES) && (objecthandle > 0) &&
|
||||
if ((objectclass < TRACE_NCLASSES) && (objecthandle > 0) &&
|
||||
(objecthandle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass]))
|
||||
{
|
||||
return (uint16_t)(RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[objectclass] +
|
||||
return (uint16_t)(RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[objectclass] +
|
||||
(RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[objectclass] * (objecthandle-1)));
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ objectHandleType xTraceGetObjectHandle(traceObjectClass objectclass)
|
|||
objectHandleType handle;
|
||||
static int indexOfHandle;
|
||||
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
"xTraceGetObjectHandle: Invalid value for objectclass", (objectHandleType)0);
|
||||
|
||||
indexOfHandle = objectHandleStacks.indexOfNextAvailableHandle[objectclass];
|
||||
|
@ -335,9 +335,9 @@ void vTraceFreeObjectHandle(traceObjectClass objectclass, objectHandleType handl
|
|||
{
|
||||
int indexOfHandle;
|
||||
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
"vTraceFreeObjectHandle: Invalid value for objectclass", );
|
||||
TRACE_ASSERT(handle > 0 && handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],
|
||||
TRACE_ASSERT(handle > 0 && handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],
|
||||
"vTraceFreeObjectHandle: Invalid value for handle", );
|
||||
|
||||
/* Check that there is room to push the handle on the stack */
|
||||
|
@ -421,10 +421,10 @@ traceLabel prvTraceOpenSymbol(const char* name, traceLabel userEventChannel)
|
|||
uint8_t len;
|
||||
uint8_t crc;
|
||||
TRACE_SR_ALLOC_CRITICAL_SECTION();
|
||||
|
||||
|
||||
len = 0;
|
||||
crc = 0;
|
||||
|
||||
|
||||
TRACE_ASSERT(name != NULL, "prvTraceOpenSymbol: name == NULL", (traceLabel)0);
|
||||
|
||||
prvTraceGetChecksum(name, &crc, &len);
|
||||
|
@ -470,9 +470,9 @@ void vTraceError(const char* msg)
|
|||
{
|
||||
traceErrorMessage = (char*)msg;
|
||||
(void)strncpy(RecorderDataPtr->systemInfo, traceErrorMessage, 80);
|
||||
RecorderDataPtr->internalErrorOccured = 1;
|
||||
RecorderDataPtr->internalErrorOccured = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -496,7 +496,7 @@ void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nofEntriesToCheck)
|
|||
unsigned int i = 0;
|
||||
unsigned int e = 0;
|
||||
|
||||
TRACE_ASSERT(nofEntriesToCheck != 0,
|
||||
TRACE_ASSERT(nofEntriesToCheck != 0,
|
||||
"prvCheckDataToBeOverwrittenForMultiEntryEvents: nofEntriesToCheck == 0", );
|
||||
|
||||
while (i < nofEntriesToCheck)
|
||||
|
@ -535,12 +535,12 @@ void prvCheckDataToBeOverwrittenForMultiEntryEvents(uint8_t nofEntriesToCheck)
|
|||
* Updates the index of the event buffer.
|
||||
******************************************************************************/
|
||||
void prvTraceUpdateCounters(void)
|
||||
{
|
||||
{
|
||||
if (RecorderDataPtr->recorderActive == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RecorderDataPtr->numEvents++;
|
||||
|
||||
RecorderDataPtr->nextFreeIndex++;
|
||||
|
@ -584,9 +584,9 @@ uint16_t prvTraceGetDTS(uint16_t param_maxDTS)
|
|||
if (RecorderDataPtr->frequency == 0 && init_hwtc_count != HWTC_COUNT)
|
||||
{
|
||||
/* If HWTC_PERIOD is mapped to the timer reload register,
|
||||
it might not be initialized before the scheduler has been started.
|
||||
it might not be initialized before the scheduler has been started.
|
||||
We therefore store the frequency of the timer when the counter
|
||||
register has changed from its initial value.
|
||||
register has changed from its initial value.
|
||||
(Note that this function is called also by vTraceStart and
|
||||
uiTraceStart, which might be called before the scheduler
|
||||
has been started.) */
|
||||
|
@ -605,9 +605,9 @@ uint16_t prvTraceGetDTS(uint16_t param_maxDTS)
|
|||
* If necessary, whole seconds are extracted using division while the rest
|
||||
* comes from the modulo operation.
|
||||
**************************************************************************/
|
||||
|
||||
vTracePortGetTimeStamp(×tamp);
|
||||
|
||||
|
||||
vTracePortGetTimeStamp(×tamp);
|
||||
|
||||
/***************************************************************************
|
||||
* Since dts is unsigned the result will be correct even if timestamp has
|
||||
* wrapped around.
|
||||
|
@ -818,14 +818,14 @@ void prvTraceGetChecksum(const char *pname, uint8_t* pcrc, uint8_t* plength)
|
|||
|
||||
#if (USE_16BIT_OBJECT_HANDLES == 1)
|
||||
|
||||
void prvTraceStoreXID(objectHandleType handle);
|
||||
void prvTraceStoreXID(objectHandleType handle);
|
||||
|
||||
/******************************************************************************
|
||||
* prvTraceStoreXID
|
||||
*
|
||||
* Stores an XID (eXtended IDentifier) event.
|
||||
* This is used if an object/task handle is larger than 255.
|
||||
* The parameter "handle" is the full (16 bit) handle, assumed to be 256 or
|
||||
* The parameter "handle" is the full (16 bit) handle, assumed to be 256 or
|
||||
* larger. Handles below 256 should not use this function.
|
||||
*
|
||||
* NOTE: this function MUST be called from within a critical section.
|
||||
|
@ -844,7 +844,7 @@ void prvTraceStoreXID(objectHandleType handle)
|
|||
xid->type = XID;
|
||||
|
||||
/* This function is (only) used when objectHandleType is 16 bit... */
|
||||
xid->xps_16 = handle;
|
||||
xid->xps_16 = handle;
|
||||
|
||||
prvTraceUpdateCounters();
|
||||
}
|
||||
|
@ -853,11 +853,11 @@ void prvTraceStoreXID(objectHandleType handle)
|
|||
unsigned char prvTraceGet8BitHandle(objectHandleType handle)
|
||||
{
|
||||
if (handle > 255)
|
||||
{
|
||||
{
|
||||
prvTraceStoreXID(handle);
|
||||
/* The full handle (16 bit) is stored in the XID event.
|
||||
/* The full handle (16 bit) is stored in the XID event.
|
||||
This code (255) is used instead of zero (which is an error code).*/
|
||||
return 255;
|
||||
return 255;
|
||||
}
|
||||
return (unsigned char)(handle & 0xFF);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Tracealyzer v2.7.7 Recorder Library
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcKernel.c
|
||||
|
@ -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
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -48,9 +48,9 @@ int8_t nISRactive = 0;
|
|||
objectHandleType handle_of_last_logged_task = 0;
|
||||
uint8_t inExcludedTask = 0;
|
||||
|
||||
#if (INCLUDE_MEMMANG_EVENTS == 1)
|
||||
/* Current heap usage. Always updated. */
|
||||
static uint32_t heapMemUsage = 0;
|
||||
#if (INCLUDE_MEMMANG_EVENTS == 1) && (TRACE_SCHEDULING_ONLY == 0)
|
||||
/* Current heap usage. Always updated. */
|
||||
static uint32_t heapMemUsage = 0;
|
||||
#endif
|
||||
|
||||
#if (TRACE_SCHEDULING_ONLY == 0)
|
||||
|
@ -639,9 +639,9 @@ void vTraceSetPriorityProperty(uint8_t objectclass, objectHandleType id, uint8_t
|
|||
uint8_t uiTraceGetPriorityProperty(uint8_t objectclass, objectHandleType id)
|
||||
{
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
|
||||
"uiTraceGetPriorityProperty: Invalid objectclass number (>= TRACE_NCLASSES)", 0);
|
||||
"uiTraceGetPriorityProperty: objectclass >= TRACE_NCLASSES", 0);
|
||||
TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],
|
||||
"uiTraceGetPriorityProperty: Task handle exceeds NTask. You may need to increase this constant in trcConfig.h.", 0);
|
||||
"uiTraceGetPriorityProperty: Invalid value for id", 0);
|
||||
|
||||
return TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Tracealyzer v2.7.7 Recorder Library
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcUser.c
|
||||
|
@ -33,12 +33,9 @@
|
|||
*
|
||||
* 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 "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "trcUser.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
@ -367,6 +364,7 @@ void vTraceTaskInstanceFinishDirect(void)
|
|||
|
||||
#define MAX_ISR_NESTING 16
|
||||
static uint8_t isrstack[MAX_ISR_NESTING];
|
||||
int32_t isPendingContextSwitch = 0;
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceSetISRProperties
|
||||
|
@ -572,11 +570,15 @@ void vTraceStoreISRBegin(objectHandleType handle)
|
|||
return;
|
||||
}
|
||||
trcCRITICAL_SECTION_BEGIN();
|
||||
|
||||
if (nISRactive == 0)
|
||||
isPendingContextSwitch = 0; /* We are at the start of a possible ISR chain. No context switches should have been triggered now. */
|
||||
|
||||
if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)
|
||||
{
|
||||
|
||||
TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceStoreISRBegin: Invalid value for handle", );
|
||||
|
||||
|
||||
dts4 = (uint16_t)prvTraceGetDTS(0xFFFF);
|
||||
|
||||
if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */
|
||||
|
@ -632,6 +634,8 @@ void vTraceStoreISREnd(int pendingISR)
|
|||
{
|
||||
TSEvent* ts;
|
||||
uint16_t dts5;
|
||||
uint8_t hnd8 = 0, type = 0;
|
||||
|
||||
TRACE_SR_ALLOC_CRITICAL_SECTION();
|
||||
|
||||
if (! RecorderDataPtr->recorderActive || ! handle_of_last_logged_task)
|
||||
|
@ -652,24 +656,28 @@ void vTraceStoreISREnd(int pendingISR)
|
|||
}
|
||||
|
||||
trcCRITICAL_SECTION_BEGIN();
|
||||
if (pendingISR == 0)
|
||||
isPendingContextSwitch |= pendingISR; /* Is there a pending context switch right now? */
|
||||
nISRactive--;
|
||||
if (nISRactive > 0)
|
||||
{
|
||||
/* Return to another isr */
|
||||
type = TS_ISR_RESUME;
|
||||
hnd8 = prvTraceGet8BitHandle(isrstack[nISRactive - 1]); /* isrstack[nISRactive] is the handle of the ISR we're currently exiting. isrstack[nISRactive - 1] is the handle of the ISR that was executing previously. */
|
||||
}
|
||||
else if (isPendingContextSwitch == 0)
|
||||
{
|
||||
/* No context switch has been triggered by any ISR in the chain. Return to task */
|
||||
type = TS_TASK_RESUME;
|
||||
hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Context switch has been triggered by some ISR. We expect a proper context switch event shortly so we do nothing. */
|
||||
}
|
||||
|
||||
if (type != 0)
|
||||
{
|
||||
uint8_t hnd8, type;
|
||||
dts5 = (uint16_t)prvTraceGetDTS(0xFFFF);
|
||||
|
||||
if (nISRactive > 1)
|
||||
{
|
||||
/* return to another isr */
|
||||
type = TS_ISR_RESUME;
|
||||
hnd8 = prvTraceGet8BitHandle(isrstack[nISRactive]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* return to task */
|
||||
type = TS_TASK_RESUME;
|
||||
hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task);
|
||||
}
|
||||
|
||||
ts = (TSEvent*)xTraceNextFreeEventBufferSlot();
|
||||
if (ts != NULL)
|
||||
{
|
||||
|
@ -684,7 +692,6 @@ void vTraceStoreISREnd(int pendingISR)
|
|||
ptrLastISRExitEvent = (uint8_t*)ts;
|
||||
#endif
|
||||
}
|
||||
nISRactive--;
|
||||
|
||||
#if (SELECTED_PORT == PORT_ARM_CortexM)
|
||||
DWTCycleCountAtLastISRExit = REG_DWT_CYCCNT;
|
||||
|
@ -1251,7 +1258,7 @@ void vTraceChannelUserEvent(UserEventChannel channelPair)
|
|||
*
|
||||
* 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´t have any data arguments, only a text label/string, it is
|
||||
* use. If you don<EFBFBD>t have any data arguments, only a text label/string, it is
|
||||
* better to use vTraceUserEvent - it is faster.
|
||||
*
|
||||
* Format specifiers supported:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue