mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 02:07:48 -04:00
Percepio Trace Recorder v4.6.0 (#789)
* * Percepio Trace Recorder v4.6.0 * Add space between inclusion of header and comment * Fix broken posix build - part 1 * Add percepio timer implementation * Remove delted trace recorder header file * Fix Networking demo build * Fix CLI demo * Fix visual studio version number * Fix core header check * Fix more core checks * Fix last of core checks Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Co-authored-by: Alfred Gedeon <alfred2g@hotmail.com>
This commit is contained in:
parent
aa316fc1b4
commit
c568ba8c44
143 changed files with 23823 additions and 16781 deletions
74
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcString.c
Normal file
74
FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcString.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Percepio Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The implementation for strings.
|
||||
*/
|
||||
|
||||
#include <trcRecorder.h>
|
||||
|
||||
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
|
||||
|
||||
traceResult xTraceStringRegister(const char* szString, TraceStringHandle_t *pString)
|
||||
{
|
||||
TraceEntryHandle_t xEntryHandle;
|
||||
TraceEventHandle_t xEventHandle = 0;
|
||||
uint32_t i = 0, uiLength = 0, uiValue = 0;
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(szString != 0);
|
||||
|
||||
/* This should never fail */
|
||||
TRC_ASSERT(pString != 0);
|
||||
|
||||
/* We need to check this */
|
||||
if (xTraceEntryCreate(&xEntryHandle) == TRC_FAIL)
|
||||
{
|
||||
return TRC_FAIL;
|
||||
}
|
||||
|
||||
/* The address to the available symbol table slot is the address we use */
|
||||
/* This should never fail */
|
||||
TRC_ASSERT_ALWAYS_EVALUATE(xTraceEntrySetSymbol(xEntryHandle, szString) == TRC_SUCCESS);
|
||||
|
||||
*pString = (TraceStringHandle_t)xEntryHandle;
|
||||
|
||||
for (i = 0; (szString[i] != 0) && (i < (TRC_ENTRY_TABLE_SLOT_SYMBOL_SIZE)); i++) {}
|
||||
|
||||
uiLength = i;
|
||||
|
||||
/* We need to check this */
|
||||
if (xTraceEventBegin(PSF_EVENT_OBJ_NAME, sizeof(void*) + uiLength, &xEventHandle) == TRC_SUCCESS)
|
||||
{
|
||||
xTraceEventAddPointer(xEventHandle, (void*)xEntryHandle);
|
||||
xTraceEventAddData(xEventHandle, (void*)szString, uiLength);
|
||||
|
||||
/* Check if we can truncate */
|
||||
xTraceEventPayloadRemaining(xEventHandle, &uiValue);
|
||||
if (uiValue > 0)
|
||||
{
|
||||
xTraceEventAdd8(xEventHandle, 0);
|
||||
}
|
||||
|
||||
xTraceEventEnd(xEventHandle);
|
||||
}
|
||||
|
||||
return TRC_SUCCESS;
|
||||
}
|
||||
|
||||
TraceStringHandle_t xTraceRegisterString(const char *name)
|
||||
{
|
||||
TraceStringHandle_t trcStr = 0;
|
||||
xTraceStringRegister(name, &trcStr);
|
||||
|
||||
return trcStr;
|
||||
}
|
||||
|
||||
#endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */
|
||||
|
||||
#endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */
|
Loading…
Add table
Add a link
Reference in a new issue