From b18501ad7682bc672fd4ca61203e6cd77ab99cc6 Mon Sep 17 00:00:00 2001 From: rtel Date: Thu, 6 Sep 2018 03:23:03 +0000 Subject: [PATCH] Update trace recorder code to the latest. Some minor changes to enable the configREMOVE_STATIC_QUALIFIER constant to be used by those debuggers that cannot cope with statics being used. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2574 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../Include/trcHardwarePort.h | 2 +- .../Include/trcKernelPort.h | 192 +++++++-------- .../Include/trcPortDefines.h | 2 +- .../FreeRTOS-Plus-Trace/Include/trcRecorder.h | 86 +++++-- .../FreeRTOS-Plus-Trace/config/trcConfig.h | 2 +- .../config/trcSnapshotConfig.h | 2 +- .../config/trcStreamingConfig.h | 2 +- .../ARM_ITM/include/trcStreamingPort.h | 2 +- .../streamports/ARM_ITM/trcStreamingPort.c | 2 +- .../File/include/trcStreamingPort.h | 2 +- .../streamports/File/trcStreamingPort.c | 2 +- .../Jlink_RTT/include/trcStreamingPort.h | 2 +- .../TCPIP/include/trcStreamingPort.h | 2 +- .../streamports/TCPIP/trcStreamingPort.c | 2 +- .../USB_CDC/include/trcStreamingPort.h | 2 +- .../tracealyzer_readme.txt | 22 +- .../FreeRTOS-Plus-Trace/trcKernelPort.c | 2 +- .../FreeRTOS-Plus-Trace/trcSnapshotRecorder.c | 228 +++++++++--------- .../trcStreamingRecorder.c | 39 ++- .../Trace_Recorder_Configuration/trcConfig.h | 16 +- .../trcSnapshotConfig.h | 8 +- FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h | 5 +- FreeRTOS/Source/include/timers.h | 4 +- FreeRTOS/Source/tasks.c | 10 +- FreeRTOS/Source/timers.c | 2 +- 25 files changed, 370 insertions(+), 270 deletions(-) diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h index da31e9364..6bd981c4c 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcHardwarePort.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h index 59d57f80f..a7ba816bd 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * Terms of Use @@ -357,8 +357,14 @@ void prvTraceSetStreamBufferNumberHigh16(void* handle, uint16_t value); #define TRACE_GET_STREAMBUFFER_FILTER(pxObject) prvTraceGetStreamBufferNumberHigh16((void*)pxObject) #define TRACE_SET_STREAMBUFFER_FILTER(pxObject, group) prvTraceSetStreamBufferNumberHigh16((void*)pxObject, group) +/* We can only support filtering if FreeRTOS is at least v7.4 */ +#if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4) #define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) TRACE_GET_##CLASS##_FILTER(pxObject) #define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) TRACE_SET_##CLASS##_FILTER(pxObject, group) +#else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4) */ +#define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) 1 +#define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) +#endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4) */ /******************************************************************************/ /*** Definitions for Snapshot mode ********************************************/ @@ -1262,7 +1268,7 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si #undef traceTASK_NOTIFY_WAIT #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) #define traceTASK_NOTIFY_WAIT() \ - if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ { \ if (pxCurrentTCB->eNotifyState == eNotified) \ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ @@ -1271,7 +1277,7 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si } #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */ #define traceTASK_NOTIFY_WAIT() \ - if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ { \ if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ @@ -1282,24 +1288,24 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si #undef traceTASK_NOTIFY_WAIT_BLOCK #define traceTASK_NOTIFY_WAIT_BLOCK() \ - if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCBLOCK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); #undef traceTASK_NOTIFY #define traceTASK_NOTIFY() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ prvTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); #undef traceTASK_NOTIFY_FROM_ISR #define traceTASK_NOTIFY_FROM_ISR() \ - if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); #undef traceTASK_NOTIFY_GIVE_FROM_ISR #define traceTASK_NOTIFY_GIVE_FROM_ISR() \ - if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); #if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) @@ -1311,12 +1317,10 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si #undef traceSTREAM_BUFFER_CREATE_FAILED #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) \ trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, STREAMBUFFER, xIsMessageBuffer), 0); - -#if 0 /*_RB_ Not defined anywhere*/ + #undef traceSTREAM_BUFFER_CREATE_STATIC_FAILED #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ) \ - traceSTREAM_BUFFER_CREATE_TRCFAILED( xIsMessageBuffer ) -#endif + traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) #undef traceSTREAM_BUFFER_DELETE #define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) \ @@ -1639,7 +1643,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called on each task-switch */ #undef traceTASK_SWITCHED_IN #define traceTASK_SWITCHED_IN() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ { \ if (prvIsNewTCB(pxCurrentTCB)) \ { \ @@ -1651,7 +1655,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); #if (TRC_CFG_INCLUDE_READY_EVENTS == 1) #undef traceMOVED_TASK_TO_READY_STATE #define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_READY, (uint32_t)pxTCB); #endif @@ -1663,9 +1667,9 @@ uint32_t prvIsNewTCB(void* pNewTCB); prvTraceSaveSymbol(pxNewTCB, pxNewTCB->pcTaskName); \ prvTraceSaveObjectData(pxNewTCB, pxNewTCB->uxPriority); \ prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, pxNewTCB->pcTaskName, pxNewTCB); \ - TRACE_SET_TASK_FILTER(pxNewTCB, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxNewTCB) & CurrentFilterMask) \ + TRACE_SET_OBJECT_FILTER(TASK, pxNewTCB, CurrentFilterGroup); \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxNewTCB) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, pxNewTCB->uxPriority); \ } #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ @@ -1675,9 +1679,9 @@ uint32_t prvIsNewTCB(void* pNewTCB); prvTraceSaveSymbol(pxNewTCB, (const char*)pcName); \ prvTraceSaveObjectData(pxNewTCB, uxPriority); \ prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)pcName, pxNewTCB); \ - TRACE_SET_TASK_FILTER(pxNewTCB, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxNewTCB) & CurrentFilterMask) \ + TRACE_SET_OBJECT_FILTER(TASK, pxNewTCB, CurrentFilterGroup); \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxNewTCB) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, uxPriority); \ } #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ @@ -1685,14 +1689,14 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */ #undef traceTASK_CREATE_FAILED #define traceTASK_CREATE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent0(PSF_EVENT_TASK_CREATE_FAILED); /* Called on vTaskDelete */ #undef traceTASK_DELETE // We don't allow for filtering out "delete" events. They are important and not very frequent. Moreover, we can't exclude create events, so this should be symmetrical. #define traceTASK_DELETE( pxTaskToDelete ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTaskToDelete) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToDelete) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_DELETE, (uint32_t)pxTaskToDelete, (pxTaskToDelete != NULL) ? (pxTaskToDelete->uxPriority) : 0); \ prvTraceDeleteSymbol(pxTaskToDelete); \ prvTraceDeleteObjectData(pxTaskToDelete); @@ -1718,25 +1722,25 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called on vTaskSuspend */ #undef traceTASK_SUSPEND #define traceTASK_SUSPEND( pxTaskToSuspend ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTaskToSuspend) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToSuspend) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_SUSPEND, (uint32_t)pxTaskToSuspend); /* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */ #undef traceTASK_DELAY #define traceTASK_DELAY() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY, xTicksToDelay); /* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */ #undef traceTASK_DELAY_UNTIL #if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 #define traceTASK_DELAY_UNTIL(xTimeToWake) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake); #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ #define traceTASK_DELAY_UNTIL() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake); #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ @@ -1756,7 +1760,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); #undef traceQUEUE_CREATE #define traceQUEUE_CREATE( pxNewQueue )\ TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ { \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \ { \ @@ -1788,7 +1792,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called in xQueueCreate, if the queue creation fails */ #undef traceQUEUE_CREATE_FAILED #define traceQUEUE_CREATE_FAILED( queueType ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ { \ switch (queueType) \ { \ @@ -1804,7 +1808,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); #undef traceQUEUE_DELETE // We don't allow for filtering out "delete" events. They are important and not very frequent. Moreover, we can't exclude create events, so this should be symmetrical. #define traceQUEUE_DELETE( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ { \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ { \ @@ -1831,25 +1835,25 @@ uint32_t prvIsNewTCB(void* pNewTCB); #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) #define traceCREATE_COUNTING_SEMAPHORE() \ TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxMaxCount) #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_OR_7_6) #define traceCREATE_COUNTING_SEMAPHORE() \ TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxInitialCount); #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4) #define traceCREATE_COUNTING_SEMAPHORE() \ TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxCountValue); #else #define traceCREATE_COUNTING_SEMAPHORE() \ TRACE_SET_OBJECT_FILTER(QUEUE, pxHandle, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxHandle) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)pxHandle, uxCountValue); #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */ @@ -1857,19 +1861,19 @@ uint32_t prvIsNewTCB(void* pNewTCB); #undef traceCREATE_COUNTING_SEMAPHORE_FAILED #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxMaxCount); #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_OR_7_6) #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxInitialCount); #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4) #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxCountValue); #else #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxCountValue); #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */ @@ -1880,7 +1884,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); #undef traceCREATE_MUTEX #define traceCREATE_MUTEX( pxNewQueue ) \ TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ { \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \ { \ @@ -1899,14 +1903,14 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */ #undef traceCREATE_MUTEX_FAILED #define traceCREATE_MUTEX_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE_FAILED, 0); #endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */ /* Called when a message is sent to a queue */ /* CS IS NEW ! */ #undef traceQUEUE_SEND #define traceQUEUE_SEND( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -1926,7 +1930,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called when a message failed to be sent to a queue (timeout) */ #undef traceQUEUE_SEND_FAILED #define traceQUEUE_SEND_FAILED( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -1946,7 +1950,7 @@ uint32_t prvIsNewTCB(void* pNewTCB); /* Called when the task is blocked due to a send operation on a full queue */ #undef traceBLOCKING_ON_QUEUE_SEND #define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2018,7 +2022,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Called when a message is received from a queue */ #undef traceQUEUE_RECEIVE #define traceQUEUE_RECEIVE( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2047,7 +2051,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Called when a receive operation on a queue fails (timeout) */ #undef traceQUEUE_RECEIVE_FAILED #define traceQUEUE_RECEIVE_FAILED( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2067,7 +2071,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Called when the task is blocked due to a receive operation on an empty queue */ #undef traceBLOCKING_ON_QUEUE_RECEIVE #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2088,7 +2092,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Called when a peek operation on a queue fails (timeout) */ #undef traceQUEUE_PEEK_FAILED #define traceQUEUE_PEEK_FAILED( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2108,7 +2112,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Called when the task is blocked due to a peek operation on an empty queue */ #undef traceBLOCKING_ON_QUEUE_PEEK #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2160,7 +2164,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Called on xQueuePeek */ #undef traceQUEUE_PEEK #define traceQUEUE_PEEK( pxQueue ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ switch (pxQueue->ucQueueType) \ { \ @@ -2181,47 +2185,47 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceTASK_PRIORITY_SET #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \ prvTraceSaveObjectData(pxTask, uxNewPriority); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTask) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_PRIORITY, (uint32_t)pxTask, uxNewPriority); /* Called in vTaskPriorityInherit, which is called by Mutex operations */ #undef traceTASK_PRIORITY_INHERIT #define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTask) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_INHERIT, (uint32_t)pxTask, uxNewPriority); /* Called in vTaskPriorityDisinherit, which is called by Mutex operations */ #undef traceTASK_PRIORITY_DISINHERIT #define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTask) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_DISINHERIT, (uint32_t)pxTask, uxNewPriority); /* Called in vTaskResume */ #undef traceTASK_RESUME #define traceTASK_RESUME( pxTaskToResume ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTaskToResume) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToResume) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME, (uint32_t)pxTaskToResume); /* Called in vTaskResumeFromISR */ #undef traceTASK_RESUME_FROM_ISR #define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \ - if (TRACE_GET_TASK_FILTER(pxTaskToResume) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToResume) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME_FROMISR, (uint32_t)pxTaskToResume); #if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) #undef traceMALLOC #define traceMALLOC( pvAddress, uiSize ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_MALLOC, (uint32_t)pvAddress, uiSize); #undef traceFREE #define traceFREE( pvAddress, uiSize ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_FREE, (uint32_t)pvAddress, (uint32_t)(0 - uiSize)); /* "0 -" instead of just "-" to get rid of a warning... */ #endif /* (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) */ @@ -2234,13 +2238,13 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) TRACE_SET_OBJECT_FILTER(TIMER, tmr, CurrentFilterGroup); \ prvTraceSaveSymbol(tmr, tmr->pcTimerName); \ prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, tmr->pcTimerName, tmr); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TIMER_CREATE, (uint32_t)tmr, tmr->xTimerPeriodInTicks); #undef traceTIMER_CREATE_FAILED #define traceTIMER_CREATE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent0(PSF_EVENT_TIMER_CREATE_FAILED); #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X) @@ -2267,7 +2271,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) /* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */ #undef traceTIMER_COMMAND_SEND #define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \ switch(xCommandID) \ { \ @@ -2288,7 +2292,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceTIMER_EXPIRED #define traceTIMER_EXPIRED(tmr) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TIMER_EXPIRED, (uint32_t)tmr->pxCallbackFunction, (uint32_t)tmr->pvTimerID); @@ -2312,49 +2316,49 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceEVENT_GROUP_CREATE #define traceEVENT_GROUP_CREATE(eg) \ TRACE_SET_OBJECT_FILTER(EVENTGROUP, eg, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_CREATE, (uint32_t)eg); #undef traceEVENT_GROUP_DELETE #define traceEVENT_GROUP_DELETE(eg) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_DELETE, (uint32_t)eg); \ prvTraceDeleteSymbol(eg); #undef traceEVENT_GROUP_CREATE_FAILED #define traceEVENT_GROUP_CREATE_FAILED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent0(PSF_EVENT_EVENTGROUP_CREATE_FAILED); #undef traceEVENT_GROUP_SYNC_BLOCK #define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SYNC_BLOCK, (uint32_t)eg, bitsToWaitFor); #undef traceEVENT_GROUP_SYNC_END #define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_SYNC : PSF_EVENT_EVENTGROUP_SYNC_FAILED, (uint32_t)eg, bitsToWaitFor); #undef traceEVENT_GROUP_WAIT_BITS_BLOCK #define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK, (uint32_t)eg, bitsToWaitFor); #undef traceEVENT_GROUP_WAIT_BITS_END #define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_WAITBITS : PSF_EVENT_EVENTGROUP_WAITBITS_FAILED, (uint32_t)eg, bitsToWaitFor); #undef traceEVENT_GROUP_CLEAR_BITS #define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS, (uint32_t)eg, bitsToClear); @@ -2365,7 +2369,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceEVENT_GROUP_SET_BITS #define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS, (uint32_t)eg, bitsToSet); @@ -2379,14 +2383,14 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceTASK_NOTIFY_TAKE #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0) #define traceTASK_NOTIFY_TAKE() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \ else \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ #define traceTASK_NOTIFY_TAKE() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ if (pxCurrentTCB->eNotifyState == eNotified) \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \ else \ @@ -2395,20 +2399,20 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceTASK_NOTIFY_TAKE_BLOCK #define traceTASK_NOTIFY_TAKE_BLOCK() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); #undef traceTASK_NOTIFY_WAIT #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0) #define traceTASK_NOTIFY_WAIT() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \ else \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ #define traceTASK_NOTIFY_WAIT() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ if (pxCurrentTCB->eNotifyState == eNotified) \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \ else \ @@ -2417,23 +2421,23 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceTASK_NOTIFY_WAIT_BLOCK #define traceTASK_NOTIFY_WAIT_BLOCK() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); #undef traceTASK_NOTIFY #define traceTASK_NOTIFY() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY, (uint32_t)xTaskToNotify); #undef traceTASK_NOTIFY_FROM_ISR #define traceTASK_NOTIFY_FROM_ISR() \ - if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_FROM_ISR, (uint32_t)xTaskToNotify); #undef traceTASK_NOTIFY_GIVE_FROM_ISR #define traceTASK_NOTIFY_GIVE_FROM_ISR() \ - if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR, (uint32_t)xTaskToNotify); #undef traceQUEUE_REGISTRY_ADD @@ -2446,13 +2450,13 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceSTREAM_BUFFER_CREATE #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) \ TRACE_SET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer, CurrentFilterGroup); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent2(xIsMessageBuffer == 1 ? PSF_EVENT_MESSAGEBUFFER_CREATE : PSF_EVENT_STREAMBUFFER_CREATE, (uint32_t)pxStreamBuffer, xBufferSizeBytes); #undef traceSTREAM_BUFFER_CREATE_FAILED #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreEvent2(xIsMessageBuffer == 1 ? PSF_EVENT_MESSAGEBUFFER_CREATE_FAILED : PSF_EVENT_STREAMBUFFER_CREATE_FAILED, 0 , xBufferSizeBytes); #undef traceSTREAM_BUFFER_CREATE_STATIC_FAILED @@ -2461,50 +2465,50 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition) #undef traceSTREAM_BUFFER_DELETE #define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_DELETE : PSF_EVENT_STREAMBUFFER_DELETE, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \ prvTraceDeleteSymbol(xStreamBuffer); #undef traceSTREAM_BUFFER_RESET #define traceSTREAM_BUFFER_RESET( xStreamBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RESET : PSF_EVENT_STREAMBUFFER_RESET, (uint32_t)xStreamBuffer, 0); #undef traceSTREAM_BUFFER_SEND #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND : PSF_EVENT_STREAMBUFFER_SEND, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); #undef traceBLOCKING_ON_STREAM_BUFFER_SEND #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_BLOCK : PSF_EVENT_STREAMBUFFER_SEND_BLOCK, (uint32_t)xStreamBuffer); #undef traceSTREAM_BUFFER_SEND_FAILED #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FAILED : PSF_EVENT_STREAMBUFFER_SEND_FAILED, (uint32_t)xStreamBuffer); #undef traceSTREAM_BUFFER_RECEIVE #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE: PSF_EVENT_STREAMBUFFER_RECEIVE, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); #undef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_BLOCK: PSF_EVENT_STREAMBUFFER_RECEIVE_BLOCK, (uint32_t)xStreamBuffer); #undef traceSTREAM_BUFFER_RECEIVE_FAILED #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FAILED: PSF_EVENT_STREAMBUFFER_RECEIVE_FAILED, (uint32_t)xStreamBuffer); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcPortDefines.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcPortDefines.h index 36cf0b2b3..258bf220a 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcPortDefines.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcPortDefines.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcPortDefines.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcRecorder.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcRecorder.h index a7012fbed..edcd5f0ae 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcRecorder.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcRecorder.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcRecorder.h @@ -49,9 +49,9 @@ extern "C" { #endif -#include #include #include + #include "trcConfig.h" #include "trcPortDefines.h" @@ -70,6 +70,9 @@ typedef uint8_t traceHandle; #include "trcHardwarePort.h" #include "trcKernelPort.h" +// Not available in snapshot mode +#define vTraceConsoleChannelPrintF(fmt, ...) + #endif #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) @@ -85,6 +88,9 @@ typedef const void* traceHandle; #if (TRC_USE_TRACEALYZER_RECORDER == 1) +/* The user event channel for recorder warnings, must be defined in trcKernelPort.c */ +extern traceString trcWarningChannel; + #define TRACE_GET_LOW16(value) ((uint16_t)((value) & 0x0000FFFF)) #define TRACE_GET_HIGH16(value) ((uint16_t)(((value) >> 16) & 0x0000FFFF)) #define TRACE_SET_LOW16(current, value) (((current) & 0xFFFF0000) | (value)) @@ -237,6 +243,26 @@ void vTracePrint(traceString chn, const char* str); #define vTracePrint(chn, ...) (void)chn #endif + +/******************************************************************************* +* vTraceConsoleChannelPrintF +* +* Wrapper for vTracePrint, using the default channel. Can be used as a drop-in +* replacement for printf and similar functions, e.g. in a debug logging macro. +* +* Example: +* +* // Old: #define LogString debug_console_printf +* +* // New, log to Tracealyzer instead: +* #define LogString vTraceConsoleChannelPrintF +* ... +* LogString("My value is: %d", myValue); +******************************************************************************/ +#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) +void vTraceConsoleChannelPrintF(const char* fmt, ...); +#endif + /******************************************************************************* * xTraceRegisterString * @@ -626,19 +652,19 @@ void vTraceClear(void); /* This macro will create a task in the object table */ #undef trcKERNEL_HOOKS_TASK_CREATE #define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, CLASS, pxTCB) \ - TRACE_SET_TASK_NUMBER(pxTCB); \ - TRACE_SET_TASK_FILTER(pxTCB, CurrentFilterGroup); \ + TRACE_SET_OBJECT_NUMBER(TASK, pxTCB); \ + TRACE_SET_OBJECT_FILTER(TASK, pxTCB, CurrentFilterGroup); \ prvTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \ prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); /* This macro will remove the task and store it in the event buffer */ #undef trcKERNEL_HOOKS_TASK_DELETE #define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, SERVICE_NAME, SERVICE_PROP, pxTCB) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \ prvTraceStoreObjectNameOnCloseEvent(SERVICE_NAME, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \ prvTraceStoreObjectPropertiesOnCloseEvent(SERVICE_PROP, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \ @@ -653,7 +679,7 @@ void vTraceClear(void); TRACE_SET_OBJECT_NUMBER(CLASS, pxObject);\ TRACE_SET_OBJECT_FILTER(CLASS, pxObject, CurrentFilterGroup); \ prvMarkObjectAsUsed(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));\ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \ prvTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), 0); @@ -661,7 +687,7 @@ void vTraceClear(void); /* This macro will remove the object and store it in the event buffer */ #undef trcKERNEL_HOOKS_OBJECT_DELETE #define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, SERVICE_NAME, SERVICE_PROP, CLASS, pxObject) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \ prvTraceStoreObjectNameOnCloseEvent(SERVICE_NAME, TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \ @@ -671,21 +697,33 @@ void vTraceClear(void); /* This macro will create a call to a kernel service with a certain result, with an object as parameter */ #undef trcKERNEL_HOOKS_KERNEL_SERVICE #define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, CLASS, pxObject) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); +/* This macro will create a call to a kernel service with a certain result, with a null object as parameter */ +#undef trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT +#define trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(SERVICE, TRACECLASS) \ + if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + prvTraceStoreKernelCall(SERVICE, TRACECLASS, 0); + /* This macro will create a call to a kernel service with a certain result, with an object as parameter */ #undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM #define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(SERVICE, CLASS, pxObject, param) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ if (TRACE_GET_OBJECT_FILTER(CLASS, pxObject) & CurrentFilterMask) \ prvTraceStoreKernelCallWithParam(SERVICE, TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), (uint32_t)param); +/* This macro will create a call to a kernel service with a certain result, with a null object and other value as parameter */ +#undef trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_WITH_PARAM +#define trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_WITH_PARAM(SERVICE, TRACECLASS, param) \ + if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + prvTraceStoreKernelCallWithParam(SERVICE, TRACECLASS, 0, param); + /* This macro will create a call to a kernel service with a certain result, with an object as parameter */ #undef trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY #define trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(SERVICE, param) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, (uint32_t)param); /* This macro will create a call to a kernel service with a certain result, with an object as parameter */ @@ -713,14 +751,14 @@ void vTraceClear(void); /* This macro will flag a certain task as a finished instance */ #undef trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED #define trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED() \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ prvTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK())); #if (TRC_CFG_INCLUDE_READY_EVENTS == 1) /* This macro will create an event to indicate that a task became Ready */ #undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE #define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB)); #else /*(TRC_CFG_INCLUDE_READY_EVENTS == 1)*/ #undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE @@ -749,21 +787,21 @@ void vTraceClear(void); /* This macro will create a task switch event to the currently executing task */ #undef trcKERNEL_HOOKS_TASK_SWITCH #define trcKERNEL_HOOKS_TASK_SWITCH( pxTCB ) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB)); /* This macro will create an event to indicate that the task has been suspended */ #undef trcKERNEL_HOOKS_TASK_SUSPEND #define trcKERNEL_HOOKS_TASK_SUSPEND(SERVICE, pxTCB) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \ prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB)); /* This macro will create an event to indicate that a task has called a wait/delay function */ #undef trcKERNEL_HOOKS_TASK_DELAY #define trcKERNEL_HOOKS_TASK_DELAY(SERVICE, pxTCB, xValue) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ { \ prvTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \ prvTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB)); \ @@ -772,7 +810,7 @@ void vTraceClear(void); /* This macro will create an event to indicate that a task has gotten its priority changed */ #undef trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE #define trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(SERVICE, pxTCB, uxNewPriority) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ { \ prvTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), prvTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\ prvTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority); \ @@ -781,13 +819,13 @@ void vTraceClear(void); /* This macro will create an event to indicate that the task has been resumed */ #undef trcKERNEL_HOOKS_TASK_RESUME #define trcKERNEL_HOOKS_TASK_RESUME(SERVICE, pxTCB) \ - if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); #undef trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR #define trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR(SERVICE, pxTCB) \ - if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \ + if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ prvTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); #if !defined TRC_CFG_INCLUDE_READY_EVENTS || TRC_CFG_INCLUDE_READY_EVENTS == 1 @@ -1732,6 +1770,8 @@ void prvProcessCommand(TracealyzerCommandType* cmd); #define vTraceSetRecorderDataBuffer(pRecorderData) #endif +#define vTraceConsoleChannelPrintF(fmt, ...) + #ifndef TRC_ALLOC_CUSTOM_BUFFER #define TRC_ALLOC_CUSTOM_BUFFER(bufname) #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcConfig.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcConfig.h index ba6ddd299..dceb6d85b 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcConfig.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcConfig.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.4 * Percepio AB, www.percepio.com * * trcConfig.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcSnapshotConfig.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcSnapshotConfig.h index e926139e6..5ce12fcaa 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcSnapshotConfig.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcSnapshotConfig.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.4 * Percepio AB, www.percepio.com * * trcSnapshotConfig.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcStreamingConfig.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcStreamingConfig.h index 5b916c33a..f578f10ec 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcStreamingConfig.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/config/trcStreamingConfig.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.4 * Percepio AB, www.percepio.com * * trcStreamingConfig.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/include/trcStreamingPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/include/trcStreamingPort.h index 559c46ce9..ca20ae753 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/include/trcStreamingPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/include/trcStreamingPort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/trcStreamingPort.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/trcStreamingPort.c index 51f7c3b6a..0d36b4ab3 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/trcStreamingPort.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/trcStreamingPort.c @@ -40,7 +40,7 @@ static void itm_write_32(uint32_t data) { if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) && // Trace enabled (ITM->TCR & ITM_TCR_ITMENA_Msk) && // ITM enabled - (ITM->TER & (1UL << 0))) // ITM Port #0 enabled + (ITM->TER & (1UL << TRC_CFG_ITM_PORT))) // ITM port enabled { while (ITM->PORT[TRC_CFG_ITM_PORT].u32 == 0); // Block until room in ITM FIFO - This stream port is always in "blocking mode", since intended for high-speed ITM! ITM->PORT[TRC_CFG_ITM_PORT].u32 = data; // Write the data diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h index 55088508f..2897b7ce2 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c index edd71d9b5..a019791cd 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.c diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/Jlink_RTT/include/trcStreamingPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/Jlink_RTT/include/trcStreamingPort.h index 815a61e08..b1074b424 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/Jlink_RTT/include/trcStreamingPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/Jlink_RTT/include/trcStreamingPort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/include/trcStreamingPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/include/trcStreamingPort.h index c9edd9ee2..51e52e862 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/include/trcStreamingPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/include/trcStreamingPort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/trcStreamingPort.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/trcStreamingPort.c index 0d06a1f39..d420d121a 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/trcStreamingPort.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/trcStreamingPort.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.c diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/USB_CDC/include/trcStreamingPort.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/USB_CDC/include/trcStreamingPort.h index 34c2e0c5f..6940b4d6d 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/USB_CDC/include/trcStreamingPort.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/USB_CDC/include/trcStreamingPort.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingPort.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/tracealyzer_readme.txt b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/tracealyzer_readme.txt index 1e191f584..09daa78f4 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/tracealyzer_readme.txt +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/tracealyzer_readme.txt @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- - Tracealyzer Recorder Library v4.1.0 for FreeRTOS + Tracealyzer Recorder Library for FreeRTOS ------------------------------------------------------------------------------- Tracealyzer is a sophisticated tool for tracing and visualization @@ -22,6 +22,26 @@ In case you have any questions, don't hesitate to contact support@percepio.com Tracealyzer supports FreeRTOS v7.3 and newer, including Amazon FreeRTOS. +------------------------------------------------------------------------------- +Changes, v4.1.4 -> v4.1.5 + +- Fixed a bug in the ITM stream port, that required Port 0 to be enabled. +- Added missing include of stdio.h (needed by vTraceConsoleChannelPrintF). +- Moved standard includes from trcRecorder.h into the .c files needing them. + +------------------------------------------------------------------------------- + +Changes, v4.1.2 -> v4.1.4 + +- Fixed a compile error when certain FreeRTOS settings were used +- Disabled filter support for FreeRTOS v7.3 since it uses "char" for object id + +------------------------------------------------------------------------------- + +Changes, v4.1.0 -> v4.1.2 + +- Added vTraceConsoleChannelPrintF(...) + ------------------------------------------------------------------------------- Changes, v4.0.3 -> v4.1.0 diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernelPort.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernelPort.c index e86f88ed8..d41b52687 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernelPort.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernelPort.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcKernelPort.c diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c index 76a1345f5..9eec9d2ed 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcSnapshotRecorder.c @@ -7,7 +7,7 @@ * The generic core of the trace recorder's snapshot mode. * * Terms of Use - * This file is part of the trace recorder library (RECORDER), which is the + * This file is part of the trace recorder library (RECORDER), which is the * intellectual property of Percepio AB (PERCEPIO) and provided under a * license as follows. * The RECORDER may be used free of charge for the purpose of recording data @@ -16,14 +16,14 @@ * You may distribute the RECORDER in its original source code form, assuming * this text (terms of use, disclaimer, copyright notice) is unchanged. You are * allowed to distribute the RECORDER with minor modifications intended for - * configuration or porting of the RECORDER, e.g., to allow using it on a + * configuration or porting of the RECORDER, e.g., to allow using it on a * specific processor, processor family or with a specific communication * interface. Any such modifications should be documented directly below - * this comment block. + * this comment block. * * Disclaimer * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty - * as to its use or performance. PERCEPIO does not and cannot warrant the + * as to its use or performance. PERCEPIO does not and cannot warrant the * performance or results you may obtain by using the RECORDER or documentation. * PERCEPIO make no warranties, express or implied, as to noninfringement of * third party rights, merchantability, or fitness for any particular purpose. @@ -107,9 +107,9 @@ extern traceHandle handle_of_last_logged_task; /*************** Private Functions *******************************************/ static void prvStrncpy(char* dst, const char* src, uint32_t maxLength); -static uint8_t prvTraceGetObjectState(uint8_t objectclass, traceHandle id); -static void prvTraceGetChecksum(const char *pname, uint8_t* pcrc, uint8_t* plength); -static void* prvTraceNextFreeEventBufferSlot(void); +static uint8_t prvTraceGetObjectState(uint8_t objectclass, traceHandle id); +static void prvTraceGetChecksum(const char *pname, uint8_t* pcrc, uint8_t* plength); +static void* prvTraceNextFreeEventBufferSlot(void); static uint16_t prvTraceGetDTS(uint16_t param_maxDTS); static traceString prvTraceOpenSymbol(const char* name, traceString userEventChannel); static void prvTraceUpdateCounters(void); @@ -136,7 +136,7 @@ static traceString prvTraceLookupSymbolTableEntry(const char* name, void prvTraceIncreaseISRActive(void); void prvTraceDecreaseISRActive(void); #endif /*(TRC_CFG_INCLUDE_ISR_TRACING == 0)*/ - + #if (TRC_CFG_USE_16BIT_OBJECT_HANDLES == 1) static uint8_t prvTraceGet8BitHandle(traceHandle handle); #else @@ -204,19 +204,19 @@ void prvTraceError(const char* msg); * Initializes and optionally starts the trace, depending on the start option. * To use the trace recorder, the startup must call vTraceEnable before any RTOS * calls are made (including "create" calls). Three start options are provided: -* -* TRC_START: Starts the tracing directly. In snapshot mode this allows for +* +* TRC_START: Starts the tracing directly. In snapshot mode this allows for * starting the trace at any point in your code, assuming vTraceEnable(TRC_INIT) * has been called in the startup. * Can also be used for streaming without Tracealyzer control, e.g. to a local * flash file system (assuming such a "stream port", see trcStreamingPort.h). -* +* * TRC_INIT: Initializes the trace recorder, but does not start the tracing. * In snapshot mode, this must be followed by a vTraceEnable(TRC_START) sometime * later. * * Usage examples, in snapshot mode: -* +* * Snapshot trace, from startup: * * vTraceEnable(TRC_START); @@ -228,14 +228,14 @@ void prvTraceError(const char* msg); * * ... * vTraceEnable(TRC_START); // e.g., in task context, at some relevant event -* +* * * Note: See other implementation of vTraceEnable in trcStreamingRecorder.c ******************************************************************************/ void vTraceEnable(int startOption) { prvTraceInitTraceData(); - + if (startOption == TRC_START) { vTraceStart(); @@ -247,7 +247,7 @@ void vTraceEnable(int startOption) else if (startOption != TRC_INIT) { prvTraceError("Unexpected argument to vTraceEnable (snapshot mode)"); - } + } } /******************************************************************************* @@ -325,7 +325,7 @@ uint32_t uiTraceStart(void) TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized. Use vTraceEnable() instead!", 0); return 0; } - + if (RecorderDataPtr->recorderActive == 1) return 1; /* Already running */ @@ -553,7 +553,7 @@ void vTraceInstanceFinishedNow(void) * xTraceSetISRProperties * * Stores a name and priority level for an Interrupt Service Routine, to allow - * for better visualization. Returns a traceHandle used by vTraceStoreISRBegin. + * for better visualization. Returns a traceHandle used by vTraceStoreISRBegin. * * Example: * #define PRIO_ISR_TIMER1 3 // the hardware priority of the interrupt @@ -569,7 +569,7 @@ void vTraceInstanceFinishedNow(void) ******************************************************************************/ traceHandle xTraceSetISRProperties(const char* name, uint8_t priority) { - static traceHandle handle = 0; + static traceHandle handle = 0; TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized, call vTraceEnable() first!", (traceHandle)0); TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "xTraceSetISRProperties: Invalid value for handle", 0); TRACE_ASSERT(name != NULL, "xTraceSetISRProperties: name == NULL", 0); @@ -578,7 +578,7 @@ void vTraceInstanceFinishedNow(void) prvTraceSetObjectName(TRACE_CLASS_ISR, handle, name); prvTraceSetPriorityProperty(TRACE_CLASS_ISR, handle, priority); - + return handle; } @@ -608,7 +608,7 @@ void vTraceStoreISRBegin(traceHandle handle) { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -620,14 +620,14 @@ void vTraceStoreISRBegin(traceHandle handle) return; } trcCRITICAL_SECTION_BEGIN(); - + if (RecorderDataPtr->recorderActive && handle_of_last_logged_task) { uint16_t dts4; - - TRACE_ASSERT(handle != 0, "vTraceStoreISRBegin: Invalid ISR handle (NULL)", TRC_UNUSED); + + TRACE_ASSERT(handle != 0, "vTraceStoreISRBegin: Invalid ISR handle (NULL)", TRC_UNUSED); TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[TRACE_CLASS_ISR], "vTraceStoreISRBegin: Invalid ISR handle (> NISR)", TRC_UNUSED); - + dts4 = (uint16_t)prvTraceGetDTS(0xFFFF); if (RecorderDataPtr->recorderActive) /* Need to repeat this check! */ @@ -663,7 +663,7 @@ void vTraceStoreISRBegin(traceHandle handle) * Registers the end of an Interrupt Service Routine. * * The parameter pendingISR indicates if the interrupt has requested a - * task-switch (= 1), e.g., by signaling a semaphore. Otherwise (= 0) the + * task-switch (= 1), e.g., by signaling a semaphore. Otherwise (= 0) the * interrupt is assumed to return to the previous context. * * Example: @@ -684,7 +684,7 @@ void vTraceStoreISREnd(int pendingISR) TSEvent* ts; uint16_t dts5; uint8_t hnd8 = 0, type = 0; - + TRACE_ALLOC_CRITICAL_SECTION(); if (! RecorderDataPtr->recorderActive || ! handle_of_last_logged_task) @@ -696,7 +696,7 @@ void vTraceStoreISREnd(int pendingISR) { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -707,7 +707,7 @@ void vTraceStoreISREnd(int pendingISR) prvTraceError("vTraceStoreISREnd - recorder busy! See code comment."); return; } - + if (nISRactive == 0) { prvTraceError("Unmatched call to vTraceStoreISREnd (nISRactive == 0, expected > 0)"); @@ -723,7 +723,7 @@ void vTraceStoreISREnd(int pendingISR) 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) || (prvTraceIsSchedulerSuspended())) + else if ((isPendingContextSwitch == 0) || (prvTraceIsSchedulerSuspended())) { /* Return to interrupted task, if no context switch will occur in between. */ type = TS_TASK_RESUME; @@ -1081,7 +1081,7 @@ static void prvTraceClearChannelBuffer(uint32_t count) static void prvTraceCopyToDataBuffer(uint32_t* data, uint32_t count) { uint32_t slots; - + TRACE_ASSERT(data != NULL, "prvTraceCopyToDataBuffer: data == NULL.", TRC_UNUSED); TRACE_ASSERT(count <= (TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE), @@ -1137,7 +1137,7 @@ static void prvTraceUBHelper2(traceUBChannel channel, uint32_t* data, uint32_t n { static uint32_t old_timestamp = 0; uint32_t old_nextSlotToWrite = 0; - + TRACE_ALLOC_CRITICAL_SECTION(); TRACE_ASSERT((TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE) >= noOfSlots, "prvTraceUBHelper2: TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE is too small to handle this event.", TRC_UNUSED); @@ -1189,7 +1189,7 @@ traceUBChannel xTraceRegisterUBChannel(traceString channel, traceString formatSt { uint8_t i; traceUBChannel retVal = 0; - + TRACE_ALLOC_CRITICAL_SECTION(); TRACE_ASSERT(formatStr != 0, "xTraceRegisterChannelFormat: formatStr == 0", (traceUBChannel)0); @@ -1231,7 +1231,7 @@ traceUBChannel xTraceRegisterUBChannel(traceString channel, traceString formatSt void vTraceUBData(traceUBChannel channelPair, ...) { va_list vl; - + TRACE_ASSERT(channelPair != 0, "vTraceUBData: Not a valid traceUBChannel!", TRC_UNUSED); va_start(vl, channelPair); @@ -1531,7 +1531,7 @@ traceString xTraceRegisterString(const char* label) #if ((!defined TRC_CFG_INCLUDE_READY_EVENTS) || (TRC_CFG_INCLUDE_READY_EVENTS == 1)) -void prvTraceSetReadyEventsEnabled(int status) +void prvTraceSetReadyEventsEnabled(int status) { readyEventsEnabled = status; } @@ -1541,7 +1541,7 @@ void prvTraceSetReadyEventsEnabled(int status) * * This function stores a ready state for the task handle sent in as parameter. ******************************************************************************/ -void prvTraceStoreTaskReady(traceHandle handle) +void prvTraceStoreTaskReady(traceHandle handle) { uint16_t dts3; TREvent* tr; @@ -1555,11 +1555,11 @@ void prvTraceStoreTaskReady(traceHandle handle) placement of the trace macro. In that case, the events are ignored. */ return; } - + if (! readyEventsEnabled) { - /* When creating tasks, ready events are also created. If creating - a "hidden" (not traced) task, we must therefore disable recording + /* When creating tasks, ready events are also created. If creating + a "hidden" (not traced) task, we must therefore disable recording of ready events to avoid an undesired ready event... */ return; } @@ -1570,7 +1570,7 @@ void prvTraceStoreTaskReady(traceHandle handle) { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -1605,7 +1605,7 @@ void prvTraceStoreTaskReady(traceHandle handle) * * This function stores a low power state. ******************************************************************************/ -void prvTraceStoreLowPower(uint32_t flag) +void prvTraceStoreLowPower(uint32_t flag) { uint16_t dts; LPEvent* lp; @@ -1617,7 +1617,7 @@ void prvTraceStoreLowPower(uint32_t flag) { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -1671,16 +1671,16 @@ void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_si /* Occurs in vTraceInitTraceData, if using dynamic allocation. */ return; } - + if (signed_size < 0) size = (uint32_t)(- signed_size); else size = (uint32_t)(signed_size); trcCRITICAL_SECTION_BEGIN(); - + heapMemUsage = heapMemUsage + (uint32_t)signed_size; - + if (RecorderDataPtr->recorderActive) { dts1 = (uint8_t)prvTraceGetDTS(0xFF); @@ -1699,7 +1699,7 @@ void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_si /* If the heap address range is within 16 MB, i.e., the upper 8 bits of addresses are constant, this optimization avoids storing an extra event record by ignoring the upper 8 bit of the address */ - addr_low = address & 0xFFFF; + addr_low = address & 0xFFFF; addr_high = (address >> 16) & 0xFF; #else /* The whole 32 bit address is stored using a second event record @@ -1715,7 +1715,7 @@ void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_si ma->addr_high = addr_high; ma->type = (uint8_t) (ecode + 1); /* Note this! */ ms->type = (uint8_t) ecode; - prvTraceUpdateCounters(); + prvTraceUpdateCounters(); RecorderDataPtr->heapMemUsage = heapMemUsage; } } @@ -1747,7 +1747,7 @@ void prvTraceStoreKernelCall(uint32_t ecode, traceObjectClass objectClass, uint3 { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -1809,7 +1809,7 @@ void prvTraceStoreKernelCallWithParam(uint32_t evtcode, { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -1899,7 +1899,7 @@ void prvTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode, uint32_t para { /************************************************************************* * This occurs if an ISR calls a trace function, preempting a previous - * trace call that is being processed in a different ISR or task. + * trace call that is being processed in a different ISR or task. * If this occurs, there is probably a problem in the definition of the * recorder's internal critical sections (TRACE_ENTER_CRITICAL_SECTION and * TRACE_EXIT_CRITICAL_SECTION). They must disable the RTOS tick interrupt @@ -2109,13 +2109,13 @@ void prvTraceSetTaskInstanceFinished(traceHandle handle) ******************************************************************************/ /* 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 TRC_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 TRC_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; @@ -2134,14 +2134,14 @@ RecorderDataType RecorderData; /******************************************************************************* * RecorderDataPtr * - * Pointer to the main data structure, when in snapshot mode. + * Pointer to the main data structure, when in snapshot mode. ******************************************************************************/ RecorderDataType* RecorderDataPtr = NULL; /* This version of the function dynamically allocates the trace data */ void prvTraceInitTraceData() -{ - +{ + if (RecorderDataPtr == NULL) { #if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC) @@ -2169,11 +2169,11 @@ void prvTraceInitTraceData() return; } } - + init_hwtc_count = TRC_HWTC_COUNT; - + (void)memset(RecorderDataPtr, 0, sizeof(RecorderDataType)); - + RecorderDataPtr->version = TRACE_KERNEL_VERSION; RecorderDataPtr->minor_version = TRACE_MINOR_VERSION; RecorderDataPtr->irq_priority_order = TRC_IRQ_PRIORITY_ORDER; @@ -2218,20 +2218,20 @@ void prvTraceInitTraceData() /* Kernel specific initialization of the objectHandleStacks variable */ vTraceInitObjectHandleStack(); - - /* Finally, the 12-byte "start markers" are initialized, allowing for - Tracealyzer to find the trace data in a larger RAM dump. - + + /* Finally, the 12-byte "start markers" are initialized, allowing for + Tracealyzer to find the trace data in a larger RAM dump. + The start and end markers must be unique, but without proper precautions there might be a risk of accidental duplicates of the start/end markers, e.g., due to compiler optimizations. - - The below initialization of the start marker is therefore made in reverse order - and the fields are volatile to ensure this assignment order. This to avoid any + + The below initialization of the start marker is therefore made in reverse order + and the fields are volatile to ensure this assignment order. This to avoid any chance of accidental duplicates of this elsewhere in memory. - + Moreover, the fields are set byte-by-byte to avoid endian issues.*/ - + RecorderDataPtr->startmarker11 = 0xF4; RecorderDataPtr->startmarker10 = 0xF3; RecorderDataPtr->startmarker9 = 0xF2; @@ -2242,8 +2242,8 @@ void prvTraceInitTraceData() RecorderDataPtr->startmarker4 = 0x71; RecorderDataPtr->startmarker3 = 0x04; RecorderDataPtr->startmarker2 = 0x03; - RecorderDataPtr->startmarker1 = 0x02; - RecorderDataPtr->startmarker0 = 0x01; + RecorderDataPtr->startmarker1 = 0x02; + RecorderDataPtr->startmarker0 = 0x01; if (traceErrorMessage != NULL) { @@ -2254,7 +2254,7 @@ void prvTraceInitTraceData() } - + #ifdef TRC_PORT_SPECIFIC_INIT TRC_PORT_SPECIFIC_INIT(); #endif @@ -2280,15 +2280,15 @@ void* prvTraceNextFreeEventBufferSlot(void) uint16_t uiIndexOfObject(traceHandle 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))); } @@ -2304,8 +2304,8 @@ traceHandle prvTraceGetObjectHandle(traceObjectClass objectclass) TRACE_ALLOC_CRITICAL_SECTION(); TRACE_ASSERT(RecorderDataPtr != NULL, "Recorder not initialized, call vTraceEnable() first!", (traceHandle)0); - - TRACE_ASSERT(objectclass < TRACE_NCLASSES, + + TRACE_ASSERT(objectclass < TRACE_NCLASSES, "prvTraceGetObjectHandle: Invalid value for objectclass", (traceHandle)0); trcCRITICAL_SECTION_BEGIN(); @@ -2352,9 +2352,9 @@ void prvTraceFreeObjectHandle(traceObjectClass objectclass, traceHandle handle) { int indexOfHandle; - TRACE_ASSERT(objectclass < TRACE_NCLASSES, + TRACE_ASSERT(objectclass < TRACE_NCLASSES, "prvTraceFreeObjectHandle: Invalid value for objectclass", TRC_UNUSED); - TRACE_ASSERT(handle > 0 && handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], + TRACE_ASSERT(handle > 0 && handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "prvTraceFreeObjectHandle: Invalid value for handle", TRC_UNUSED); /* Check that there is room to push the handle on the stack */ @@ -2451,10 +2451,10 @@ traceString prvTraceOpenSymbol(const char* name, traceString userEventChannel) uint8_t len; uint8_t crc; TRACE_ALLOC_CRITICAL_SECTION(); - + len = 0; crc = 0; - + TRACE_ASSERT(name != NULL, "prvTraceOpenSymbol: name == NULL", (traceString)0); prvTraceGetChecksum(name, &crc, &len); @@ -2557,7 +2557,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", TRC_UNUSED); while (i < nofEntriesToCheck) @@ -2597,12 +2597,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++; @@ -2641,34 +2641,34 @@ uint16_t prvTraceGetDTS(uint16_t param_maxDTS) TRACE_ASSERT(param_maxDTS == 0xFF || param_maxDTS == 0xFFFF, "prvTraceGetDTS: Invalid value for param_maxDTS", 0); - + if (RecorderDataPtr->frequency == 0) - { + { if (timestampFrequency != 0) { /* If to override default TRC_HWTC_FREQ_HZ value with value set by vTraceSetFrequency */ RecorderDataPtr->frequency = timestampFrequency / (TRC_HWTC_DIVISOR); - } + } else if (init_hwtc_count != (TRC_HWTC_COUNT)) { - /* If using default value and timer has been started. + /* If using default value and timer has been started. Note: If the default frequency value set here would be incorrect, e.g., - if the timer has actually not been configured yet, override this + if the timer has actually not been configured yet, override this with vTraceSetFrequency. */ - RecorderDataPtr->frequency = (TRC_HWTC_FREQ_HZ) / (TRC_HWTC_DIVISOR); + RecorderDataPtr->frequency = (TRC_HWTC_FREQ_HZ) / (TRC_HWTC_DIVISOR); } /* If no override (vTraceSetFrequency) and timer inactive -> no action */ } - + /************************************************************************** * The below statements read the timestamp from the timer port module. * If necessary, whole seconds are extracted using division while the rest * comes from the modulo operation. **************************************************************************/ - - prvTracePortGetTimeStamp(×tamp); - + + prvTracePortGetTimeStamp(×tamp); + /*************************************************************************** * Since dts is unsigned the result will be correct even if timestamp has * wrapped around. @@ -2878,14 +2878,14 @@ void prvTraceGetChecksum(const char *pname, uint8_t* pcrc, uint8_t* plength) #if (TRC_CFG_USE_16BIT_OBJECT_HANDLES == 1) -static void prvTraceStoreXID(traceHandle handle); +static void prvTraceStoreXID(traceHandle 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. @@ -2903,7 +2903,7 @@ static void prvTraceStoreXID(traceHandle handle) xid->type = XID; /* This function is (only) used when traceHandle is 16 bit... */ - xid->xps_16 = handle; + xid->xps_16 = handle; prvTraceUpdateCounters(); } @@ -2912,11 +2912,11 @@ static void prvTraceStoreXID(traceHandle handle) static uint8_t prvTraceGet8BitHandle(traceHandle 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 (uint8_t)(handle & 0xFF); } @@ -2939,15 +2939,15 @@ void prvTraceInitCortexM() if (TRC_REG_DEMCR == 0) { /* This function is called on Cortex-M3, M4 and M7 devices to initialize - the DWT unit, assumed present. The DWT cycle counter is used for timestamping. - + the DWT unit, assumed present. The DWT cycle counter is used for timestamping. + If the below error is produced, the DWT unit does not seem to be available. - + In that case, define the macro TRC_CFG_ARM_CM_USE_SYSTICK in your build - to use SysTick timestamping instead, or define your own timestamping by + to use SysTick timestamping instead, or define your own timestamping by setting TRC_CFG_HARDWARE_PORT to TRC_HARDWARE_PORT_APPLICATION_DEFINED and make the necessary definitions, as explained in trcHardwarePort.h.*/ - + prvTraceError("DWT unit not available, see code comment."); break; } @@ -2956,12 +2956,12 @@ void prvTraceInitCortexM() if (TRC_REG_DWT_CTRL & TRC_DWT_CTRL_NOCYCCNT) { /* This function is called on Cortex-M3, M4 and M7 devices to initialize - the DWT unit, assumed present. The DWT cycle counter is used for timestamping. - + the DWT unit, assumed present. The DWT cycle counter is used for timestamping. + If the below error is produced, the cycle counter does not seem to be available. - + In that case, define the macro TRC_CFG_ARM_CM_USE_SYSTICK in your build - to use SysTick timestamping instead, or define your own timestamping by + to use SysTick timestamping instead, or define your own timestamping by setting TRC_CFG_HARDWARE_PORT to TRC_HARDWARE_PORT_APPLICATION_DEFINED and make the necessary definitions, as explained in trcHardwarePort.h.*/ @@ -3071,20 +3071,20 @@ void prvTracePortGetTimeStamp(uint32_t *pTimestamp) } /* Store the previous value */ last_traceTickCount = traceTickCount; - + #else /*(TRC_HWTC_TYPE == TRC_OS_TIMER_INCR || TRC_HWTC_TYPE == TRC_OS_TIMER_DECR)*/ - + /* Timestamping is based on a free running timer */ /* This part handles free running clocks that can be scaled down to avoid too large DTS values. Without this, the scaled timestamp will incorrectly wrap at (2^32 / TRC_HWTC_DIVISOR) ticks. The scaled timestamp returned from this function is supposed to go from 0 -> 2^32, which in real time would represent (0 -> 2^32 * TRC_HWTC_DIVISOR) ticks. */ - + /* First we see how long time has passed since the last timestamp call, and we also add the ticks that was lost when we scaled down the last time. */ diff = (hwtc_count - last_hwtc_count) + last_hwtc_rest; - + /* Scale down the diff */ diff_scaled = diff / (TRC_HWTC_DIVISOR); - + /* Find out how many ticks were lost when scaling down, so we can add them the next time */ last_hwtc_rest = diff % (TRC_HWTC_DIVISOR); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c index c86d688e6..dc1b87865 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v4.1.1 + * Trace Recorder Library for Tracealyzer v4.1.5 * Percepio AB, www.percepio.com * * trcStreamingRecorder.c @@ -48,6 +48,9 @@ #if (TRC_USE_TRACEALYZER_RECORDER == 1) +#include +#include + typedef struct{ uint16_t EventID; uint16_t EventCount; @@ -174,9 +177,6 @@ static uint16_t FormatVersion = 0x0004; /* The number of events stored. Used as event sequence number. */ static uint32_t eventCounter = 0; -/* The user event channel for recorder warnings, defined in trcKernelPort.c */ -extern char* trcWarningChannel; - /* Remembers if an earlier ISR in a sequence of adjacent ISRs has triggered a task switch. In that case, vTraceStoreISREnd does not store a return to the previously executing task. */ int32_t isPendingContextSwitch = 0; @@ -399,6 +399,37 @@ void vTracePrint(traceString chn, const char* str) prvTraceStoreSimpleStringEventHelper(chn, str); } + +/******************************************************************************* +* vTraceConsoleChannelPrintF +* +* Wrapper for vTracePrint, using the default channel. Can be used as a drop-in +* replacement for printf and similar functions, e.g. in a debug logging macro. +* +* Example: +* +* // Old: #define LogString debug_console_printf +* +* // New, log to Tracealyzer instead: +* #define LogString vTraceConsoleChannelPrintF +* ... +* LogString("My value is: %d", myValue); +******************************************************************************/ +void vTraceConsoleChannelPrintF(const char* fmt, ...) +{ + va_list vl; + char tempBuf[60]; + static traceString consoleChannel = NULL; + + if (consoleChannel == NULL) + consoleChannel = xTraceRegisterString("Debug Console"); + + va_start(vl, fmt); + vsnprintf(tempBuf, 60, fmt, vl); + vTracePrint(consoleChannel, tempBuf); + va_end(vl); +} + /****************************************************************************** * vTracePrintF * diff --git a/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcConfig.h b/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcConfig.h index 37345d497..610b0d97e 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcConfig.h +++ b/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcConfig.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v3.1.2 + * Trace Recorder Library for Tracealyzer v4.1.4 * Percepio AB, www.percepio.com * * trcConfig.h @@ -41,7 +41,7 @@ * * Tabs are used for indent in this file (1 tab = 4 spaces) * - * Copyright Percepio AB, 2016. + * Copyright Percepio AB, 2018. * www.percepio.com ******************************************************************************/ @@ -105,7 +105,7 @@ extern "C" { * trace recorder library with an older version of FreeRTOS). * * TRC_FREERTOS_VERSION_7_3 If using FreeRTOS v7.3.x - * TRC_FREERTOS_VERSION_7_4 If using FreeRTOS v7.4.x + * TRC_FREERTOS_VERSION_7_4 If using FreeRTOS v7.4.x * TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0 * TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X * TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0 @@ -144,13 +144,13 @@ extern "C" { * * Macro which should be defined as either zero (0) or one (1). * - * If this is zero (0), all code related to User Events is excluded in order + * If this is zero (0), all code related to User Events is excluded in order * to reduce code size. Any attempts of storing User Events are then silently * ignored. * - * User Events are application-generated events, like "printf" but for the - * trace log, generated using vTracePrint and vTracePrintF. - * The formatting is done on host-side, by Tracealyzer. User Events are + * User Events are application-generated events, like "printf" but for the + * trace log, generated using vTracePrint and vTracePrintF. + * The formatting is done on host-side, by Tracealyzer. User Events are * therefore much faster than a console printf and can often be used * in timing critical code without problems. * @@ -234,7 +234,7 @@ extern "C" { * * Macro which should be defined as either zero (0) or one (1). * - * If this is zero (0), the trace will exclude any "pending function call" + * If this is zero (0), the trace will exclude any "pending function call" * events, such as xTimerPendFunctionCall(). * * Default value is 0 since dependent on timers.c diff --git a/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcSnapshotConfig.h b/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcSnapshotConfig.h index 8bb9221d7..aa2229346 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcSnapshotConfig.h +++ b/FreeRTOS/Demo/WIN32-MSVC/Trace_Recorder_Configuration/trcSnapshotConfig.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Trace Recorder Library for Tracealyzer v3.1.2 + * Trace Recorder Library for Tracealyzer v4.1.4 * Percepio AB, www.percepio.com * * trcSnapshotConfig.h @@ -39,7 +39,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,8 +113,8 @@ #define TRC_CFG_NMUTEX 90 #define TRC_CFG_NTIMER 250 #define TRC_CFG_NEVENTGROUP 90 -#define TRC_CFG_NSTREAMBUFFER 5 -#define TRC_CFG_NMESSAGEBUFFER 5 +#define TRC_CFG_NSTREAMBUFFER 50 +#define TRC_CFG_NMESSAGEBUFFER 50 /****************************************************************************** diff --git a/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h b/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h index 5ff74c977..a10b1c793 100644 --- a/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h @@ -24,8 +24,6 @@ * * 1 tab == 4 spaces! */ - - #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H @@ -140,6 +138,9 @@ used with multiple project configurations. If it is /* Allows tests of trying to allocate more than the heap has free. */ #define configUSE_MALLOC_FAILED_HOOK 0 + + /* To test builds that remove the static qualifier for debug builds. */ + #define portREMOVE_STATIC_QUALIFIER #else /* It is a good idea to define configASSERT() while developing. configASSERT() uses the same semantics as the standard C assert() macro. Don't define diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index 8fbc54987..c13e82721 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -73,8 +73,8 @@ or interrupt version of the queue send function should be used. */ * reference the subject timer in calls to other software timer API functions * (for example, xTimerStart(), xTimerReset(), etc.). */ -struct TimerDef_t; -typedef struct TimerDef_t * TimerHandle_t; +struct tmrTimerControl; +typedef struct tmrTimerControl * TimerHandle_t; /* * Defines the prototype to which timer callback functions must conform. diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 242dd360d..d8b75bee5 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -399,6 +399,13 @@ when the scheduler is unsuspended. The pending ready list itself can only be accessed from a critical section. */ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE; +#if ( configGENERATE_RUN_TIME_STATS == 1 ) + + PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */ + PRIVILEGED_DATA static uint32_t ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */ + +#endif + /*lint -restore */ /*-----------------------------------------------------------*/ @@ -2900,9 +2907,6 @@ void vTaskSwitchContext( void ) #if ( configGENERATE_RUN_TIME_STATS == 1 ) { - PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */ - PRIVILEGED_DATA static uint32_t ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */ - #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime ); #else diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index 1c95d865e..5a3a2afe0 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -65,7 +65,7 @@ defining trmTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */ #endif /* The definition of the timers themselves. */ -typedef struct TimerDef_t +typedef struct tmrTimerControl { const char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */ -- 2.39.2