mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-14 00:37:44 -04:00
FreeRTOS Trace Fixes (#888)
* Updating the FreeRTOS/Demo/Posix_GCC Demo's Trace.dump file Creation * Updating the FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix Demo's Trace.dump file Creation Co-authored-by: Soren Ptak <skptak@amazon.com>
This commit is contained in:
parent
228f76cbe3
commit
1fc1e01fb6
23 changed files with 2696 additions and 2132 deletions
|
@ -43,10 +43,10 @@
|
|||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
|
||||
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65 * 1024 ) )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) PTHREAD_STACK_MIN ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 84 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
|
@ -58,6 +58,7 @@
|
|||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Software timer related configuration options. The maximum possible task
|
||||
|
@ -76,6 +77,10 @@ unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that re
|
|||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo can use of one or more example stats formatting functions. These
|
||||
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||
|
@ -122,15 +127,32 @@ used with multiple project configurations. If it is
|
|||
#error projCOVERAGE_TEST should be defined to 1 or 0 on the command line.
|
||||
#endif
|
||||
|
||||
/* Insert NOPs in empty decision paths to ensure both true and false paths
|
||||
are being tested. */
|
||||
#define mtCOVERAGE_TEST_MARKER() __asm volatile( "NOP" )
|
||||
#if( projCOVERAGE_TEST == 1 )
|
||||
/* Insert NOPs in empty decision paths to ensure both true and false paths
|
||||
are being tested. */
|
||||
#define mtCOVERAGE_TEST_MARKER() __asm volatile( "NOP" )
|
||||
|
||||
/* Ensure the tick count overflows during the coverage test. */
|
||||
#define configINITIAL_TICK_COUNT 0xffffd800UL
|
||||
/* Ensure the tick count overflows during the coverage test. */
|
||||
#define configINITIAL_TICK_COUNT 0xffffd800UL
|
||||
|
||||
/* Allows tests of trying to allocate more than the heap has free. */
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
/* 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
|
||||
configASSERT() when performing code coverage tests though, as it is not
|
||||
intended to asserts() to fail, some some code is intended not to run if no
|
||||
errors are present. */
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
|
||||
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#include "trcRecorder.h"
|
||||
#endif
|
||||
|
||||
/* networking definitions */
|
||||
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
|
|
|
@ -2,6 +2,7 @@ CC := gcc
|
|||
BIN := posix_tcp_demo
|
||||
|
||||
BUILD_DIR := build
|
||||
BUILD_DIR_ABS := $(abspath $(BUILD_DIR))
|
||||
|
||||
FREERTOS_DIR_REL := ../../../FreeRTOS
|
||||
FREERTOS_DIR := $(abspath $(FREERTOS_DIR_REL))
|
||||
|
@ -9,14 +10,21 @@ FREERTOS_DIR := $(abspath $(FREERTOS_DIR_REL))
|
|||
FREERTOS_PLUS_DIR_REL := ../../../FreeRTOS-Plus
|
||||
FREERTOS_PLUS_DIR := $(abspath $(FREERTOS_PLUS_DIR_REL))
|
||||
|
||||
KERNEL_DIR := ${FREERTOS_DIR}/Source
|
||||
|
||||
INCLUDE_DIRS := -I.
|
||||
INCLUDE_DIRS += -I${FREERTOS_DIR}/Source/include
|
||||
INCLUDE_DIRS += -I${FREERTOS_DIR}/Source/portable/ThirdParty/GCC/Posix
|
||||
INCLUDE_DIRS += -I${FREERTOS_DIR}/Source/portable/ThirdParty/GCC/Posix/utils
|
||||
INCLUDE_DIRS += -I./Trace_Recorder_Configuration
|
||||
INCLUDE_DIRS += -I${KERNEL_DIR}/include
|
||||
INCLUDE_DIRS += -I${KERNEL_DIR}/portable/ThirdParty/GCC/Posix
|
||||
INCLUDE_DIRS += -I${KERNEL_DIR}/portable/ThirdParty/GCC/Posix/utils
|
||||
INCLUDE_DIRS += -I${FREERTOS_DIR}/Demo/Common/include
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/linux/
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/include/
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/portable/Compiler/GCC/
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/Include
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/config
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/streamports/File/include
|
||||
INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/streamports/File/config
|
||||
|
||||
# FreeRTOS Kernel source files
|
||||
SOURCE_FILES :=
|
||||
|
@ -28,8 +36,8 @@ SOURCE_FILES += ${FREERTOS_DIR}/Source/tasks.c
|
|||
SOURCE_FILES += ${FREERTOS_DIR}/Source/timers.c
|
||||
|
||||
# FreeRTOS Kernel POSIX Port
|
||||
SOURCE_FILES += ${FREERTOS_DIR}/Source/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c
|
||||
SOURCE_FILES += ${FREERTOS_DIR}/Source/portable/ThirdParty/GCC/Posix/port.c
|
||||
SOURCE_FILES += ${KERNEL_DIR}/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c
|
||||
SOURCE_FILES += ${KERNEL_DIR}/portable/ThirdParty/GCC/Posix/port.c
|
||||
|
||||
# FreeRTOS+TCP demo source file
|
||||
SOURCE_FILES += SimpleTCPEchoServer.c
|
||||
|
@ -68,8 +76,33 @@ SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_UD
|
|||
SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/portable/BufferManagement/BufferAllocation_2.c
|
||||
SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/linux/NetworkInterface.c
|
||||
|
||||
CFLAGS := -ggdb3 -O0 -DprojCOVERAGE_TEST=0 -D_WINDOWS_
|
||||
LDFLAGS := -ggdb3 -O0 -pthread -lpcap
|
||||
|
||||
CFLAGS := -ggdb3
|
||||
LDFLAGS := -ggdb3 -pthread -lpcap
|
||||
CPPFLAGS := $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\"
|
||||
|
||||
ifeq ($(TRACE_ON_ENTER),1)
|
||||
CPPFLAGS += -DTRACE_ON_ENTER=1
|
||||
else
|
||||
CPPFLAGS += -DTRACE_ON_ENTER=0
|
||||
endif
|
||||
|
||||
ifeq ($(COVERAGE_TEST),1)
|
||||
CPPFLAGS += -DprojCOVERAGE_TEST=1
|
||||
else
|
||||
CPPFLAGS += -DprojCOVERAGE_TEST=0
|
||||
# Trace library.
|
||||
SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcKernelPort.c
|
||||
SOURCE_FILES += $(wildcard ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/*.c )
|
||||
endif
|
||||
|
||||
ifdef PROFILE
|
||||
CFLAGS += -pg -O0
|
||||
LDFLAGS += -pg -O0
|
||||
else
|
||||
CFLAGS += -O3
|
||||
LDFLAGS += -O3
|
||||
endif
|
||||
|
||||
OBJ_FILES = $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.o)
|
||||
|
||||
|
@ -79,16 +112,21 @@ ${BIN} : $(BUILD_DIR)/$(BIN)
|
|||
|
||||
${BUILD_DIR}/${BIN} : ${OBJ_FILES}
|
||||
-mkdir -p ${@D}
|
||||
$(CC) $^ $(CFLAGS) $(INCLUDE_DIRS) ${LDFLAGS} -o $@
|
||||
$(CC) $^ ${LDFLAGS} -o $@
|
||||
|
||||
|
||||
-include ${DEP_FILE}
|
||||
|
||||
${BUILD_DIR}/%.o : %.c
|
||||
${BUILD_DIR}/%.o : %.c Makefile
|
||||
-mkdir -p $(@D)
|
||||
$(CC) $(CFLAGS) ${INCLUDE_DIRS} -MMD -c $< -o $@
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -c $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILD_DIR)
|
||||
|
||||
GPROF_OPTIONS := --directory-path=$(INCLUDE_DIRS)
|
||||
profile:
|
||||
gprof -a -p --all-lines $(GPROF_OPTIONS) $(BUILD_DIR)/$(BIN) $(BUILD_DIR)/gmon.out > $(BUILD_DIR)/prof_flat.txt
|
||||
gprof -a --graph $(GPROF_OPTIONS) $(BUILD_DIR)/$(BIN) $(BUILD_DIR)/gmon.out > $(BUILD_DIR)/prof_call_graph.txt
|
||||
|
|
|
@ -25,35 +25,35 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
*/
|
||||
* http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
* the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
* defined configASSERT()?
|
||||
*
|
||||
* http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
* embedded software for free we request you assist our global community by
|
||||
* participating in the support forum.
|
||||
*
|
||||
* http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
* be as productive as possible as early as possible. Now you can receive
|
||||
* FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
* Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
*
|
||||
* http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
* including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
* compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
*
|
||||
* http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
* Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
*
|
||||
* http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
* Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
* licenses offer ticketed support, indemnification and commercial middleware.
|
||||
*
|
||||
* http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
* engineered and independently SIL3 certified version for use in safety and
|
||||
* mission critical applications that require provable dependability.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FreeRTOS tasks are used with FreeRTOS+TCP to create a TCP echo server on the
|
||||
|
@ -67,6 +67,7 @@
|
|||
/* Standard includes. */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
@ -78,33 +79,33 @@
|
|||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
/* Remove the whole file if FreeRTOSIPConfig.h is set to exclude TCP. */
|
||||
#if( ipconfigUSE_TCP == 1 )
|
||||
#if ( ipconfigUSE_TCP == 1 )
|
||||
|
||||
/* The maximum time to wait for a closing socket to close. */
|
||||
#define tcpechoSHUTDOWN_DELAY ( pdMS_TO_TICKS( 5000 ) )
|
||||
#define tcpechoSHUTDOWN_DELAY ( pdMS_TO_TICKS( 5000 ) )
|
||||
|
||||
/* The standard echo port number. */
|
||||
#define tcpechoPORT_NUMBER 7
|
||||
#define tcpechoPORT_NUMBER 7
|
||||
|
||||
/* If ipconfigUSE_TCP_WIN is 1 then the Tx sockets will use a buffer size set by
|
||||
ipconfigTCP_TX_BUFFER_LENGTH, and the Tx window size will be
|
||||
configECHO_SERVER_TX_WINDOW_SIZE times the buffer size. Note
|
||||
ipconfigTCP_TX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
|
||||
stack constant, whereas configECHO_SERVER_TX_WINDOW_SIZE is set in
|
||||
FreeRTOSConfig.h as it is a demo application constant. */
|
||||
#ifndef configECHO_SERVER_TX_WINDOW_SIZE
|
||||
* ipconfigTCP_TX_BUFFER_LENGTH, and the Tx window size will be
|
||||
* configECHO_SERVER_TX_WINDOW_SIZE times the buffer size. Note
|
||||
* ipconfigTCP_TX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
|
||||
* stack constant, whereas configECHO_SERVER_TX_WINDOW_SIZE is set in
|
||||
* FreeRTOSConfig.h as it is a demo application constant. */
|
||||
#ifndef configECHO_SERVER_TX_WINDOW_SIZE
|
||||
#define configECHO_SERVER_TX_WINDOW_SIZE 2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If ipconfigUSE_TCP_WIN is 1 then the Rx sockets will use a buffer size set by
|
||||
ipconfigTCP_RX_BUFFER_LENGTH, and the Rx window size will be
|
||||
configECHO_SERVER_RX_WINDOW_SIZE times the buffer size. Note
|
||||
ipconfigTCP_RX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
|
||||
stack constant, whereas configECHO_SERVER_RX_WINDOW_SIZE is set in
|
||||
FreeRTOSConfig.h as it is a demo application constant. */
|
||||
#ifndef configECHO_SERVER_RX_WINDOW_SIZE
|
||||
* ipconfigTCP_RX_BUFFER_LENGTH, and the Rx window size will be
|
||||
* configECHO_SERVER_RX_WINDOW_SIZE times the buffer size. Note
|
||||
* ipconfigTCP_RX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
|
||||
* stack constant, whereas configECHO_SERVER_RX_WINDOW_SIZE is set in
|
||||
* FreeRTOSConfig.h as it is a demo application constant. */
|
||||
#ifndef configECHO_SERVER_RX_WINDOW_SIZE
|
||||
#define configECHO_SERVER_RX_WINDOW_SIZE 2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -112,41 +113,55 @@ FreeRTOSConfig.h as it is a demo application constant. */
|
|||
* Uses FreeRTOS+TCP to listen for incoming echo connections, creating a task
|
||||
* to handle each connection.
|
||||
*/
|
||||
static void prvConnectionListeningTask( void *pvParameters );
|
||||
static void prvConnectionListeningTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* Created by the connection listening task to handle a single connection.
|
||||
*/
|
||||
static void prvServerConnectionInstance( void *pvParameters );
|
||||
static void prvServerConnectionInstance( void * pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Stores the stack size passed into vStartSimpleTCPServerTasks() so it can be
|
||||
reused when the server listening task creates tasks to handle connections. */
|
||||
static uint16_t usUsedStackSize = 0;
|
||||
* reused when the server listening task creates tasks to handle connections. */
|
||||
static uint16_t usUsedStackSize = 0;
|
||||
|
||||
/* Create task stack and buffers for use in the Listening and Server connection tasks */
|
||||
static StaticTask_t listenerTaskBuffer;
|
||||
static StackType_t listenerTaskStack[ PTHREAD_STACK_MIN ];
|
||||
|
||||
static StaticTask_t echoServerTaskBuffer;
|
||||
static StackType_t echoServerTaskStack[ PTHREAD_STACK_MIN ];
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartSimpleTCPServerTasks( uint16_t usStackSize, UBaseType_t uxPriority )
|
||||
{
|
||||
void vStartSimpleTCPServerTasks( uint16_t usStackSize,
|
||||
UBaseType_t uxPriority )
|
||||
{
|
||||
/* Create the TCP echo server. */
|
||||
xTaskCreate( prvConnectionListeningTask, "ServerListener", usStackSize, NULL, uxPriority + 1, NULL );
|
||||
xTaskCreateStatic( prvConnectionListeningTask,
|
||||
"ServerListener",
|
||||
PTHREAD_STACK_MIN,
|
||||
NULL,
|
||||
uxPriority + 1,
|
||||
listenerTaskStack,
|
||||
&listenerTaskBuffer );
|
||||
|
||||
/* Remember the requested stack size so it can be re-used by the server
|
||||
listening task when it creates tasks to handle connections. */
|
||||
* listening task when it creates tasks to handle connections. */
|
||||
usUsedStackSize = usStackSize;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvConnectionListeningTask( void *pvParameters )
|
||||
{
|
||||
struct freertos_sockaddr xClient, xBindAddress;
|
||||
Socket_t xListeningSocket, xConnectedSocket;
|
||||
socklen_t xSize = sizeof( xClient );
|
||||
static const TickType_t xReceiveTimeOut = portMAX_DELAY;
|
||||
const BaseType_t xBacklog = 20;
|
||||
static void prvConnectionListeningTask( void * pvParameters )
|
||||
{
|
||||
struct freertos_sockaddr xClient, xBindAddress;
|
||||
Socket_t xListeningSocket, xConnectedSocket;
|
||||
socklen_t xSize = sizeof( xClient );
|
||||
static const TickType_t xReceiveTimeOut = portMAX_DELAY;
|
||||
const BaseType_t xBacklog = 20;
|
||||
|
||||
#if( ipconfigUSE_TCP_WIN == 1 )
|
||||
#if ( ipconfigUSE_TCP_WIN == 1 )
|
||||
WinProperties_t xWinProps;
|
||||
|
||||
/* Fill in the buffer and window sizes that will be used by the socket. */
|
||||
|
@ -154,7 +169,7 @@ const BaseType_t xBacklog = 20;
|
|||
xWinProps.lTxWinSize = configECHO_SERVER_TX_WINDOW_SIZE;
|
||||
xWinProps.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;
|
||||
xWinProps.lRxWinSize = configECHO_SERVER_RX_WINDOW_SIZE;
|
||||
#endif /* ipconfigUSE_TCP_WIN */
|
||||
#endif /* ipconfigUSE_TCP_WIN */
|
||||
|
||||
/* Just to prevent compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -167,14 +182,14 @@ const BaseType_t xBacklog = 20;
|
|||
FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
|
||||
|
||||
/* Set the window and buffer sizes. */
|
||||
#if( ipconfigUSE_TCP_WIN == 1 )
|
||||
#if ( ipconfigUSE_TCP_WIN == 1 )
|
||||
{
|
||||
FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
|
||||
}
|
||||
#endif /* ipconfigUSE_TCP_WIN */
|
||||
|
||||
/* Bind the socket to the port that the client task will send to, then
|
||||
listen for incoming connections. */
|
||||
* listen for incoming connections. */
|
||||
xBindAddress.sin_port = tcpechoPORT_NUMBER;
|
||||
xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
|
||||
FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
|
||||
|
@ -187,25 +202,31 @@ const BaseType_t xBacklog = 20;
|
|||
configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
|
||||
|
||||
/* Spawn a task to handle the connection. */
|
||||
xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY, NULL );
|
||||
xTaskCreateStatic( prvServerConnectionInstance,
|
||||
"EchoServer",
|
||||
PTHREAD_STACK_MIN,
|
||||
( void * ) xConnectedSocket,
|
||||
tskIDLE_PRIORITY,
|
||||
echoServerTaskStack,
|
||||
&echoServerTaskBuffer );
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvServerConnectionInstance( void *pvParameters )
|
||||
{
|
||||
int32_t lBytes, lSent, lTotalSent;
|
||||
Socket_t xConnectedSocket;
|
||||
static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );
|
||||
static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );
|
||||
TickType_t xTimeOnShutdown;
|
||||
uint8_t *pucRxBuffer;
|
||||
static void prvServerConnectionInstance( void * pvParameters )
|
||||
{
|
||||
int32_t lBytes, lSent, lTotalSent;
|
||||
Socket_t xConnectedSocket;
|
||||
static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );
|
||||
static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );
|
||||
TickType_t xTimeOnShutdown;
|
||||
uint8_t * pucRxBuffer;
|
||||
|
||||
xConnectedSocket = ( Socket_t ) pvParameters;
|
||||
|
||||
/* Attempt to create the buffer used to receive the string to be echoed
|
||||
back. This could be avoided using a zero copy interface that just returned
|
||||
the same buffer. */
|
||||
* back. This could be avoided using a zero copy interface that just returned
|
||||
* the same buffer. */
|
||||
pucRxBuffer = ( uint8_t * ) pvPortMalloc( ipconfigTCP_MSS );
|
||||
|
||||
if( pucRxBuffer != NULL )
|
||||
|
@ -216,7 +237,7 @@ uint8_t *pucRxBuffer;
|
|||
for( ;; )
|
||||
{
|
||||
/* Zero out the receive array so there is NULL at the end of the string
|
||||
when it is printed out. */
|
||||
* when it is printed out. */
|
||||
memset( pucRxBuffer, 0x00, ipconfigTCP_MSS );
|
||||
|
||||
/* Receive data on the socket. */
|
||||
|
@ -253,8 +274,9 @@ uint8_t *pucRxBuffer;
|
|||
FreeRTOS_shutdown( xConnectedSocket, FREERTOS_SHUT_RDWR );
|
||||
|
||||
/* Wait for the shutdown to take effect, indicated by FreeRTOS_recv()
|
||||
returning an error. */
|
||||
* returning an error. */
|
||||
xTimeOnShutdown = xTaskGetTickCount();
|
||||
|
||||
do
|
||||
{
|
||||
if( FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 ) < 0 )
|
||||
|
@ -268,9 +290,8 @@ uint8_t *pucRxBuffer;
|
|||
FreeRTOS_closesocket( xConnectedSocket );
|
||||
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The whole file is excluded if TCP is not compiled in. */
|
||||
#endif /* ipconfigUSE_TCP */
|
||||
|
||||
|
|
|
@ -54,17 +54,17 @@
|
|||
#if ( ipconfigUSE_TCP == 1 )
|
||||
|
||||
/* The echo tasks create a socket, send out a number of echo requests, listen
|
||||
for the echo reply, then close the socket again before starting over. This
|
||||
delay is used between each iteration to ensure the network does not get too
|
||||
congested. */
|
||||
* for the echo reply, then close the socket again before starting over. This
|
||||
* delay is used between each iteration to ensure the network does not get too
|
||||
* congested. */
|
||||
#define echoLOOP_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS )
|
||||
|
||||
/* The echo server is assumed to be on port 7, which is the standard echo
|
||||
protocol port. */
|
||||
* protocol port. */
|
||||
#define echoECHO_PORT ( 7 )
|
||||
|
||||
/* The size of the buffers is a multiple of the MSS - the length of the data
|
||||
sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
|
||||
* sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
|
||||
#define echoBUFFER_SIZE_MULTIPLIER ( 3 )
|
||||
#define echoBUFFER_SIZES ( ipconfigTCP_MSS * echoBUFFER_SIZE_MULTIPLIER )
|
||||
|
||||
|
@ -77,18 +77,18 @@ sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
|
|||
* Uses a socket to send data to, then receive data from, the standard echo
|
||||
* port number 7.
|
||||
*/
|
||||
static void prvEchoClientTask( void *pvParameters );
|
||||
static void prvEchoClientTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* Creates a pseudo random sized buffer of data to send to the echo server.
|
||||
*/
|
||||
static BaseType_t prvCreateTxData( char *ucBuffer,
|
||||
static BaseType_t prvCreateTxData( char * ucBuffer,
|
||||
uint32_t ulBufferLength );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Rx and Tx time outs are used to ensure the sockets do not wait too long for
|
||||
missing data. */
|
||||
* missing data. */
|
||||
static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 4000 );
|
||||
static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 2000 );
|
||||
|
||||
|
@ -101,6 +101,9 @@ missing data. */
|
|||
static char cTxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ],
|
||||
cRxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ];
|
||||
|
||||
static StaticTask_t echoServerTaskBuffer;
|
||||
static StackType_t echoServerTaskStack[ PTHREAD_STACK_MIN ];
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize,
|
||||
|
@ -111,17 +114,18 @@ missing data. */
|
|||
/* Create the echo client tasks. */
|
||||
for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
|
||||
{
|
||||
xTaskCreate( prvEchoClientTask, /* The function that implements the task. */
|
||||
xTaskCreateStatic( prvEchoClientTask, /* The function that implements the task. */
|
||||
"Echo0", /* Just a text name for the task to aid debugging. */
|
||||
usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */
|
||||
( void * ) x, /* The task parameter, not used in this case. */
|
||||
uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */
|
||||
NULL ); /* The task handle is not used. */
|
||||
echoServerTaskStack,
|
||||
&echoServerTaskBuffer ); /* The task handle is not used. */
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvEchoClientTask( void *pvParameters )
|
||||
static void prvEchoClientTask( void * pvParameters )
|
||||
{
|
||||
Socket_t xSocket;
|
||||
struct freertos_sockaddr xEchoServerAddress;
|
||||
|
@ -130,7 +134,7 @@ missing data. */
|
|||
volatile uint32_t ulTxCount = 0UL;
|
||||
BaseType_t xReceivedBytes, xReturned, xInstance;
|
||||
BaseType_t lTransmitted, lStringLength;
|
||||
char *pcTransmittedString, *pcReceivedString;
|
||||
char * pcTransmittedString, * pcReceivedString;
|
||||
WinProperties_t xWinProps;
|
||||
TickType_t xTimeOnEntering;
|
||||
BaseType_t ret;
|
||||
|
@ -142,8 +146,8 @@ missing data. */
|
|||
xWinProps.lRxWinSize = 3;
|
||||
|
||||
/* This task can be created a number of times. Each instance is numbered
|
||||
to enable each instance to use a different Rx and Tx buffer. The number is
|
||||
passed in as the task's parameter. */
|
||||
* to enable each instance to use a different Rx and Tx buffer. The number is
|
||||
* passed in as the task's parameter. */
|
||||
xInstance = ( BaseType_t ) pvParameters;
|
||||
|
||||
/* Point to the buffers to be used by this instance of this task. */
|
||||
|
@ -151,8 +155,8 @@ missing data. */
|
|||
pcReceivedString = &( cRxBuffers[ xInstance ][ 0 ] );
|
||||
|
||||
/* Echo requests are sent to the echo server. The address of the echo
|
||||
server is configured by the constants configECHO_SERVER_ADDR0 to
|
||||
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
|
||||
* server is configured by the constants configECHO_SERVER_ADDR0 to
|
||||
* configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
|
||||
xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
|
||||
xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
|
||||
configECHO_SERVER_ADDR1,
|
||||
|
@ -166,7 +170,7 @@ missing data. */
|
|||
configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
|
||||
|
||||
/* Set a time out so a missing reply does not cause the task to block
|
||||
indefinitely. */
|
||||
* indefinitely. */
|
||||
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
|
||||
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xSendTimeOut ) );
|
||||
|
||||
|
@ -207,7 +211,7 @@ missing data. */
|
|||
}
|
||||
|
||||
/* Clear the buffer into which the echoed string will be
|
||||
placed. */
|
||||
* placed. */
|
||||
memset( ( void * ) pcReceivedString, 0x00, echoBUFFER_SIZES );
|
||||
xReceivedBytes = 0;
|
||||
|
||||
|
@ -222,7 +226,7 @@ missing data. */
|
|||
if( xReturned < 0 )
|
||||
{
|
||||
/* Error occurred. Latch it so it can be detected
|
||||
below. */
|
||||
* below. */
|
||||
xReceivedBytes = xReturned;
|
||||
break;
|
||||
}
|
||||
|
@ -239,8 +243,8 @@ missing data. */
|
|||
}
|
||||
|
||||
/* If an error occurred it will be latched in xReceivedBytes,
|
||||
otherwise xReceived bytes will be just that - the number of
|
||||
bytes received from the echo server. */
|
||||
* otherwise xReceived bytes will be just that - the number of
|
||||
* bytes received from the echo server. */
|
||||
if( xReceivedBytes > 0 )
|
||||
{
|
||||
/* Compare the transmitted string to the received string. */
|
||||
|
@ -254,7 +258,7 @@ missing data. */
|
|||
else
|
||||
{
|
||||
/* The received string did not match the transmitted
|
||||
string. */
|
||||
* string. */
|
||||
ulTxRxFailures[ xInstance ]++;
|
||||
break;
|
||||
}
|
||||
|
@ -272,11 +276,11 @@ missing data. */
|
|||
}
|
||||
|
||||
/* Finished using the connected socket, initiate a graceful close:
|
||||
FIN, FIN+ACK, ACK. */
|
||||
* FIN, FIN+ACK, ACK. */
|
||||
FreeRTOS_shutdown( xSocket, FREERTOS_SHUT_RDWR );
|
||||
|
||||
/* Expect FreeRTOS_recv() to return an error once the shutdown is
|
||||
complete. */
|
||||
* complete. */
|
||||
xTimeOnEntering = xTaskGetTickCount();
|
||||
|
||||
do
|
||||
|
@ -301,13 +305,13 @@ missing data. */
|
|||
FreeRTOS_closesocket( xSocket );
|
||||
|
||||
/* Pause for a short while to ensure the network is not too
|
||||
congested. */
|
||||
* congested. */
|
||||
vTaskDelay( echoLOOP_DELAY );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvCreateTxData( char *cBuffer,
|
||||
static BaseType_t prvCreateTxData( char * cBuffer,
|
||||
uint32_t ulBufferLength )
|
||||
{
|
||||
BaseType_t lCharactersToAdd, lCharacter;
|
||||
|
@ -316,7 +320,7 @@ missing data. */
|
|||
uint32_t ulRandomNumber;
|
||||
|
||||
/* Randomise the number of characters that will be sent in the echo
|
||||
request. */
|
||||
* request. */
|
||||
do
|
||||
{
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumber );
|
||||
|
@ -345,7 +349,7 @@ missing data. */
|
|||
BaseType_t xReturn = pdPASS, x;
|
||||
|
||||
/* Return fail is the number of cycles does not increment between
|
||||
consecutive calls. */
|
||||
* consecutive calls. */
|
||||
for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
|
||||
{
|
||||
if( ulTxRxCycles[ x ] == ulLastEchoSocketCount[ x ] )
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Main configuration parameters for the trace recorder library.
|
||||
* More settings can be found in trcStreamingConfig.h and trcSnapshotConfig.h.
|
||||
*/
|
||||
|
||||
#ifndef TRC_CONFIG_H
|
||||
#define TRC_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Include of processor header file
|
||||
*
|
||||
* Here you may need to include the header file for your processor. This is
|
||||
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
|
||||
* Try that in case of build problems. Otherwise, remove the #error line below.
|
||||
*****************************************************************************/
|
||||
/*#error "Trace Recorder: Please include your processor's header file here and remove this line." */
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_HARDWARE_PORT
|
||||
* @brief Specify what hardware port to use (i.e., the "timestamping driver").
|
||||
*
|
||||
* All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
|
||||
* This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is
|
||||
* available on most such devices. In case your device don't have DWT support,
|
||||
* you will get an error message opening the trace. In that case, you may
|
||||
* force the recorder to use SysTick timestamping instead, using this define:
|
||||
*
|
||||
* #define TRC_CFG_ARM_CM_USE_SYSTICK
|
||||
*
|
||||
* For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.
|
||||
*
|
||||
* See trcHardwarePort.h for available ports and information on how to
|
||||
* define your own port, if not already present.
|
||||
*/
|
||||
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_Win64
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SCHEDULING_ONLY
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* If this setting is enabled (= 1), only scheduling events are recorded.
|
||||
* If disabled (= 0), all events are recorded (unless filtered in other ways).
|
||||
*
|
||||
* Default value is 0 (= include additional events).
|
||||
*/
|
||||
#define TRC_CFG_SCHEDULING_ONLY 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_MEMMANG_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero (0)
|
||||
* to exclude malloc/free calls, or one (1) to include such events in the trace.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_USER_EVENTS
|
||||
* @brief 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
|
||||
* 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
|
||||
* therefore much faster than a console printf and can often be used
|
||||
* in timing critical code without problems.
|
||||
*
|
||||
* Note: In streaming mode, User Events are used to provide error messages
|
||||
* and warnings from the recorder (in case of incorrect configuration) for
|
||||
* display in Tracealyzer. Disabling user events will also disable these
|
||||
* warnings. You can however still catch them by calling xTraceErrorGetLast
|
||||
* or by putting breakpoints in xTraceError and xTraceWarning.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_USER_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_ISR_TRACING
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded, in order to reduce code size. This means that any calls to
|
||||
* vTraceStoreISRBegin/vTraceStoreISREnd will be ignored.
|
||||
* This does not completely disable ISR tracing, in cases where an ISR is
|
||||
* calling a traced kernel service. These events will still be recorded and
|
||||
* show up in anonymous ISR instances in Tracealyzer, with names such as
|
||||
* "ISR sending to <queue name>".
|
||||
* To disable such tracing, please refer to vTraceSetFilterGroup and
|
||||
* vTraceSetFilterMask.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
|
||||
* and vTraceStoreISREnd in your interrupt handlers.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_ISR_TRACING 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_READY_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This allows Tracealyzer to show the initial pending time before tasks enter
|
||||
* the execution state, and present accurate response times.
|
||||
* If zero (0), "ready events" are not created, which allows for recording
|
||||
* longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_READY_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_OSTICK_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is one (1), events will be generated whenever the OS clock is
|
||||
* increased. If zero (0), OS tick events are not generated, which allows for
|
||||
* recording longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_ENABLE_STACK_MONITOR
|
||||
* @brief If enabled (1), the recorder periodically reports the unused stack space of
|
||||
* all active tasks.
|
||||
* The stack monitoring runs in the Tracealyzer Control task, TzCtrl. This task
|
||||
* is always created by the recorder when in streaming mode.
|
||||
* In snapshot mode, the TzCtrl task is only used for stack monitoring and is
|
||||
* not created unless this is enabled.
|
||||
*/
|
||||
#define TRC_CFG_ENABLE_STACK_MONITOR 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_STACK_MONITOR_MAX_TASKS
|
||||
* @brief Macro which should be defined as a non-zero integer value.
|
||||
*
|
||||
* This controls how many tasks that can be monitored by the stack monitor.
|
||||
* If this is too small, some tasks will be excluded and a warning is shown.
|
||||
*
|
||||
* Default value is 10.
|
||||
*/
|
||||
#define TRC_CFG_STACK_MONITOR_MAX_TASKS 10
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_STACK_MONITOR_MAX_REPORTS
|
||||
* @brief Macro which should be defined as a non-zero integer value.
|
||||
*
|
||||
* This defines how many tasks that will be subject to stack usage analysis for
|
||||
* each execution of the Tracealyzer Control task (TzCtrl). Note that the stack
|
||||
* monitoring cycles between the tasks, so this does not affect WHICH tasks that
|
||||
* are monitored, but HOW OFTEN each task stack is analyzed.
|
||||
*
|
||||
* This setting can be combined with TRC_CFG_CTRL_TASK_DELAY to tune the
|
||||
* frequency of the stack monitoring. This is motivated since the stack analysis
|
||||
* can take some time to execute.
|
||||
* However, note that the stack analysis runs in a separate task (TzCtrl) that
|
||||
* can be executed on low priority. This way, you can avoid that the stack
|
||||
* analysis disturbs any time-sensitive tasks.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_STACK_MONITOR_MAX_REPORTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_CTRL_TASK_PRIORITY
|
||||
* @brief The scheduling priority of the Tracealyzer Control (TzCtrl) task.
|
||||
*
|
||||
* In streaming mode, TzCtrl is used to receive start/stop commands from
|
||||
* Tracealyzer and in some cases also to transmit the trace data (for stream
|
||||
* ports that uses the internal buffer, like TCP/IP). For such stream ports,
|
||||
* make sure the TzCtrl priority is high enough to ensure reliable periodic
|
||||
* execution and transfer of the data, but low enough to avoid disturbing any
|
||||
* time-sensitive functions.
|
||||
*
|
||||
* In Snapshot mode, TzCtrl is only used for the stack usage monitoring and is
|
||||
* not created if stack monitoring is disabled. TRC_CFG_CTRL_TASK_PRIORITY should
|
||||
* be low, to avoid disturbing any time-sensitive tasks.
|
||||
*/
|
||||
#define TRC_CFG_CTRL_TASK_PRIORITY 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_CTRL_TASK_DELAY
|
||||
* @brief The delay between loops of the TzCtrl task (see TRC_CFG_CTRL_TASK_PRIORITY),
|
||||
* which affects the frequency of the stack monitoring.
|
||||
*
|
||||
* In streaming mode, this also affects the trace data transfer if you are using
|
||||
* a stream port leveraging the internal buffer (like TCP/IP). A shorter delay
|
||||
* increases the CPU load of TzCtrl somewhat, but may improve the performance of
|
||||
* of the trace streaming, especially if the trace buffer is small.
|
||||
*/
|
||||
#define TRC_CFG_CTRL_TASK_DELAY 2
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_CTRL_TASK_STACK_SIZE
|
||||
* @brief The stack size of the Tracealyzer Control (TzCtrl) task.
|
||||
* See TRC_CFG_CTRL_TASK_PRIORITY for further information about TzCtrl.
|
||||
*/
|
||||
#define TRC_CFG_CTRL_TASK_STACK_SIZE 4096
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_BUFFER_ALLOCATION
|
||||
* @brief Specifies how the recorder buffer is allocated (also in case of streaming, in
|
||||
* port using the recorder's internal temporary buffer)
|
||||
*
|
||||
* Values:
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation (internal)
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer
|
||||
*
|
||||
* Static and dynamic mode does the allocation for you, either in compile time
|
||||
* (static) or in runtime (malloc).
|
||||
* The custom mode allows you to control how and where the allocation is made,
|
||||
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_MAX_ISR_NESTING
|
||||
* @brief Defines how many levels of interrupt nesting the recorder can handle, in
|
||||
* case multiple ISRs are traced and ISR nesting is possible. If this
|
||||
* is exceeded, the particular ISR will not be traced and the recorder then
|
||||
* logs an error message. This setting is used to allocate an internal stack
|
||||
* for keeping track of the previous execution context (4 byte per entry).
|
||||
*
|
||||
* This value must be a non-zero positive constant, at least 1.
|
||||
*
|
||||
* Default value: 8
|
||||
*/
|
||||
#define TRC_CFG_MAX_ISR_NESTING 8
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_ISR_TAILCHAINING_THRESHOLD
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* If tracing multiple ISRs, this setting allows for accurate display of the
|
||||
* context-switching also in cases when the ISRs execute in direct sequence.
|
||||
*
|
||||
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
|
||||
* context, i.e., a task or a preempted ISR. But if another traced ISR
|
||||
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
|
||||
* fragment of the previous context in between the ISRs.
|
||||
*
|
||||
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
|
||||
* however a threshold value that must be measured for your specific setup.
|
||||
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
|
||||
*
|
||||
* The default setting is 0, meaning "disabled" and that you may get an
|
||||
* extra fragments of the previous context in between tail-chained ISRs.
|
||||
*
|
||||
* Note: This setting has separate definitions in trcSnapshotConfig.h and
|
||||
* trcStreamingConfig.h, since it is affected by the recorder mode.
|
||||
*/
|
||||
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_DATA_INIT
|
||||
* @brief Macro which states wether the recorder data should have an initial value.
|
||||
*
|
||||
* In very specific cases where traced objects are created before main(),
|
||||
* the recorder will need to be started even before that. In these cases,
|
||||
* the recorder data would be initialized by vTraceEnable(TRC_INIT) but could
|
||||
* then later be overwritten by the initialization value.
|
||||
* If this is an issue for you, set TRC_CFG_RECORDER_DATA_INIT to 0.
|
||||
* The following code can then be used before any traced objects are created:
|
||||
*
|
||||
* extern uint32_t RecorderEnabled;
|
||||
* RecorderEnabled = 0;
|
||||
* xTraceInitialize();
|
||||
*
|
||||
* After the clocks are properly initialized, use vTraceEnable(...) to start
|
||||
* the tracing.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_DATA_INIT 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_DATA_ATTRIBUTE
|
||||
* @brief When setting TRC_CFG_RECORDER_DATA_INIT to 0, you might also need to make
|
||||
* sure certain recorder data is placed in a specific RAM section to avoid being
|
||||
* zeroed out after initialization. Define TRC_CFG_RECORDER_DATA_ATTRIBUTE as
|
||||
* that attribute.
|
||||
*
|
||||
* Example:
|
||||
* #define TRC_CFG_RECORDER_DATA_ATTRIBUTE __attribute__((section(".bss.trace_recorder_data")))
|
||||
*
|
||||
* Default value is empty.
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_DATA_ATTRIBUTE
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_TRACE_ASSERT
|
||||
* @brief Enable or disable debug asserts. Information regarding any assert that is
|
||||
* triggered will be in trcAssert.c.
|
||||
*/
|
||||
#define TRC_CFG_USE_TRACE_ASSERT 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TRC_CONFIG_H */
|
|
@ -14,7 +14,7 @@
|
|||
#define TRC_KERNEL_PORT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Kernel port configuration parameters for snapshot mode.
|
||||
*/
|
||||
|
||||
#ifndef TRC_KERNEL_PORT_SNAPSHOT_CONFIG_H
|
||||
#define TRC_KERNEL_PORT_SNAPSHOT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...
|
||||
* @brief A group of macros which should be defined as integer values, zero or larger.
|
||||
*
|
||||
* These define the capacity of the Object Property Table, i.e., the maximum
|
||||
* number of objects active at any given point, within each object class (e.g.,
|
||||
* task, queue, semaphore, ...).
|
||||
*
|
||||
* If tasks or other objects are deleted in your system, this
|
||||
* setting does not limit the total amount of objects created, only the number
|
||||
* of objects that have been successfully created but not yet deleted.
|
||||
*
|
||||
* Using too small values will cause vTraceError to be called, which stores an
|
||||
* error message in the trace that is shown when opening the trace file. The
|
||||
* error message can also be retrieved using xTraceGetLastError.
|
||||
*
|
||||
* It can be wise to start with large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage by selecting View menu -> Trace Details ->
|
||||
* Resource Usage -> Object Table.
|
||||
*/
|
||||
#define TRC_CFG_NTASK 150
|
||||
#define TRC_CFG_NISR 90
|
||||
#define TRC_CFG_NQUEUE 90
|
||||
#define TRC_CFG_NSEMAPHORE 90
|
||||
#define TRC_CFG_NMUTEX 90
|
||||
#define TRC_CFG_NTIMER 250
|
||||
#define TRC_CFG_NEVENTGROUP 90
|
||||
#define TRC_CFG_NSTREAMBUFFER 50
|
||||
#define TRC_CFG_NMESSAGEBUFFER 50
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...
|
||||
* @brief Macros that specify the maximum lengths (number of characters) for names of
|
||||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*/
|
||||
#define TRC_CFG_NAME_LEN_TASK 15
|
||||
#define TRC_CFG_NAME_LEN_ISR 15
|
||||
#define TRC_CFG_NAME_LEN_QUEUE 15
|
||||
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
|
||||
#define TRC_CFG_NAME_LEN_MUTEX 15
|
||||
#define TRC_CFG_NAME_LEN_TIMER 15
|
||||
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
|
||||
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_KERNEL_PORT_SNAPSHOT_CONFIG_H */
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Configuration parameters for trace recorder library in snapshot mode.
|
||||
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
|
||||
*/
|
||||
|
||||
#ifndef TRC_SNAPSHOT_CONFIG_H
|
||||
#define TRC_SNAPSHOT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SNAPSHOT_MODE
|
||||
* @brief Macro which should be defined as one of:
|
||||
* - TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL
|
||||
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the
|
||||
* events are stored in a ring buffer, i.e., where the oldest events are
|
||||
* overwritten when the buffer becomes full. This allows you to get the last
|
||||
* events leading up to an interesting state, e.g., an error, without having
|
||||
* to store the whole run since startup.
|
||||
*
|
||||
* When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the
|
||||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*/
|
||||
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_EVENT_BUFFER_SIZE
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the event buffer, i.e., the number of records
|
||||
* it may store. Most events use one record (4 byte), although some events
|
||||
* require multiple 4-byte records. You should adjust this to the amount of RAM
|
||||
* available in the target system.
|
||||
*
|
||||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
*/
|
||||
#define TRC_CFG_EVENT_BUFFER_SIZE 50000
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_FLOAT_SUPPORT
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the support for logging floating point values in
|
||||
* vTracePrintF is stripped out, in case floating point values are not used or
|
||||
* supported by the platform used.
|
||||
*
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* allow for storing float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 0.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SYMBOL_TABLE_SIZE
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* stores User Events labels and names of deleted tasks, queues, or other kernel
|
||||
* objects. If you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value. The minimum recommended value is 4.
|
||||
* A size of zero (0) is not allowed since a zero-sized array may result in a
|
||||
* 32-bit pointer, i.e., using 4 bytes rather than 0.
|
||||
*
|
||||
* Default value is 800.
|
||||
*/
|
||||
#define TRC_CFG_SYMBOL_TABLE_SIZE 8000
|
||||
|
||||
#if ( TRC_CFG_SYMBOL_TABLE_SIZE == 0 )
|
||||
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
******************************************************************************
|
||||
* The remaining settings are not necessary to modify but allows for optimizing
|
||||
* the recorder setup for your specific needs, e.g., to exclude events that you
|
||||
* are not interested in, in order to get longer traces.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_HEAP_SIZE_BELOW_16M
|
||||
* @brief An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with reported addresses showing the
|
||||
* lower 24 bits only. If 0, you get the full 32-bit addresses.
|
||||
*
|
||||
* Default value is 0.
|
||||
*/
|
||||
#define TRC_CFG_HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_IMPLICIT_IFE_RULES
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into "instances" based on Instance Finish
|
||||
* Events (IFEs), produced either by default rules or calls to the recorder
|
||||
* functions xTraceTaskInstanceFinishedNow and xTraceTaskInstanceFinishedNext.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is
|
||||
* used, resulting in a "typical" grouping of events into instances.
|
||||
* If these rules don't give appropriate instances in your case, you can
|
||||
* override the default rules using xTraceTaskInstanceFinishedNow/Next for one
|
||||
* or several tasks. The default IFE rules are then disabled for those tasks.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are
|
||||
* disabled globally. You must then call xTraceTaskInstanceFinishedNow or
|
||||
* xTraceTaskInstanceFinishedNext to manually group the events into instances,
|
||||
* otherwise the tasks will appear a single long instance.
|
||||
*
|
||||
* The default IFE rules count the following events as "instance finished":
|
||||
* - Task delay, delay until
|
||||
* - Task suspend
|
||||
* - Blocking on "input" operations, i.e., when the task is waiting for the
|
||||
* next a message/signal/event. But only if this event is blocking.
|
||||
*/
|
||||
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_16BIT_OBJECT_HANDLES
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (tasks, queues, mutexes,
|
||||
* etc.) Note: 255, not 256, since handle 0 is reserved.
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* Default is 0 (8-bit handles)
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever the object is referenced. Moreover, some internal
|
||||
* tables in the recorder gets slightly larger when using 16-bit handles.
|
||||
*/
|
||||
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the
|
||||
* separate user event buffer (UB).
|
||||
* In this mode, user events are stored separately from other events,
|
||||
* e.g., RTOS events. Thereby you can get a much longer history of
|
||||
* user events as they don't need to share the buffer space with more
|
||||
* frequent events.
|
||||
*
|
||||
* The UB is typically used with the snapshot ring-buffer mode, so the
|
||||
* recording can continue when the main buffer gets full. And since the
|
||||
* main buffer then overwrites the earliest events, Tracealyzer displays
|
||||
* "Unknown Actor" instead of task scheduling for periods with UB data only.
|
||||
*
|
||||
* In UB mode, user events are structured as UB channels, which contains
|
||||
* a channel name and a default format string. Register a UB channel using
|
||||
* xTraceRegisterUBChannel.
|
||||
*
|
||||
* Events and data arguments are written using vTraceUBEvent and
|
||||
* vTraceUBData. They are designed to provide efficient logging of
|
||||
* repeating events, using the same format string within each channel.
|
||||
*
|
||||
* Examples:
|
||||
* TraceStringHandle_t chn1;
|
||||
* TraceStringHandle_t fmt1;
|
||||
* xTraceStringRegister("Channel 1", &chn1);
|
||||
* xTraceStringRegister("Event!", &fmt1);
|
||||
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);
|
||||
*
|
||||
* TraceStringHandle_t chn2;
|
||||
* TraceStringHandle_t fmt2;
|
||||
* xTraceStringRegister("Channel 2", &chn2);
|
||||
* xTraceStringRegister("X: %d, Y: %d", &fmt2);
|
||||
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);
|
||||
*
|
||||
* // Result in "[Channel 1] Event!"
|
||||
* vTraceUBEvent(UBCh1);
|
||||
*
|
||||
* // Result in "[Channel 2] X: 23, Y: 19"
|
||||
* vTraceUBData(UBCh2, 23, 19);
|
||||
*
|
||||
* You can also use the other user event functions, like xTracePrintF.
|
||||
* as they are then rerouted to the UB instead of the main event buffer.
|
||||
* vTracePrintF then looks up the correct UB channel based on the
|
||||
* provided channel name and format string, or creates a new UB channel
|
||||
* if no match is found. The format string should therefore not contain
|
||||
* "random" messages but mainly format specifiers. Random strings should
|
||||
* be stored using %s and with the string as an argument.
|
||||
*
|
||||
* // Creates a new UB channel ("Channel 2", "%Z: %d")
|
||||
* xTracePrintF(chn2, "%Z: %d", value1);
|
||||
*
|
||||
* // Finds the existing UB channel
|
||||
* xTracePrintF(chn2, "%Z: %d", value2);
|
||||
*/
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the user event buffer (UB), in number of slots.
|
||||
* A single user event can use multiple slots, depending on the arguments.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
*/
|
||||
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_UB_CHANNELS
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the number of User Event Buffer Channels (UB channels).
|
||||
* These are used to structure the events when using the separate user
|
||||
* event buffer, and contains both a User Event Channel (the name) and
|
||||
* a default format string for the channel.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
*/
|
||||
#define TRC_CFG_UB_CHANNELS 32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*TRC_SNAPSHOT_CONFIG_H*/
|
|
@ -88,18 +88,18 @@ static BaseType_t prvTimerQuery( void );
|
|||
|
||||
static BaseType_t prvStaticAllocationsWithNullBuffers( void )
|
||||
{
|
||||
uintptr_t ulReturned = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxDummy = 10;
|
||||
uintptr_t ulReturned = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxDummy = 10;
|
||||
|
||||
/* Don't expect to create any of the objects as a NULL parameter is always
|
||||
passed in place of a required buffer. Hence if all passes then none of the
|
||||
* passed in place of a required buffer. Hence if all passes then none of the
|
||||
|= will be against 0, and ulReturned will still be zero at the end of this
|
||||
function. */
|
||||
* function. */
|
||||
ulReturned |= ( uintptr_t ) xEventGroupCreateStatic( NULL );
|
||||
|
||||
/* Try creating a task twice, once with puxStackBuffer NULL, and once with
|
||||
pxTaskBuffer NULL. */
|
||||
* pxTaskBuffer NULL. */
|
||||
ulReturned |= ( uintptr_t ) xTaskCreateStatic( NULL, /* Task to run, not needed as the task is not created. */
|
||||
"Dummy", /* Task name. */
|
||||
configMINIMAL_STACK_SIZE,
|
||||
|
@ -122,7 +122,7 @@ UBaseType_t uxDummy = 10;
|
|||
NULL );
|
||||
|
||||
/* Try creating a stream buffer twice, once with pucStreamBufferStorageArea
|
||||
set to NULL, and once with pxStaticStreamBuffer set to NULL. */
|
||||
* set to NULL, and once with pxStaticStreamBuffer set to NULL. */
|
||||
ulReturned |= ( uintptr_t ) xStreamBufferCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
NULL,
|
||||
|
@ -145,14 +145,14 @@ UBaseType_t uxDummy = 10;
|
|||
|
||||
static BaseType_t prvTraceUtils( void )
|
||||
{
|
||||
EventGroupHandle_t xEventGroup;
|
||||
QueueHandle_t xQueue;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const UBaseType_t xNumber = ( UBaseType_t ) 100, xQueueLength = ( UBaseType_t ) 1;
|
||||
UBaseType_t uxValue;
|
||||
TaskHandle_t xTaskHandle;
|
||||
StreamBufferHandle_t xStreamBuffer;
|
||||
MessageBufferHandle_t xMessageBuffer;
|
||||
EventGroupHandle_t xEventGroup;
|
||||
QueueHandle_t xQueue;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const UBaseType_t xNumber = ( UBaseType_t ) 100, xQueueLength = ( UBaseType_t ) 1;
|
||||
UBaseType_t uxValue;
|
||||
TaskHandle_t xTaskHandle;
|
||||
StreamBufferHandle_t xStreamBuffer;
|
||||
MessageBufferHandle_t xMessageBuffer;
|
||||
|
||||
/* Exercise the event group trace utilities. */
|
||||
xEventGroup = xEventGroupCreate();
|
||||
|
@ -160,10 +160,12 @@ MessageBufferHandle_t xMessageBuffer;
|
|||
if( xEventGroup != NULL )
|
||||
{
|
||||
vEventGroupSetNumber( xEventGroup, xNumber );
|
||||
|
||||
if( uxEventGroupGetNumber( NULL ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( uxEventGroupGetNumber( xEventGroup ) != xNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -178,13 +180,16 @@ MessageBufferHandle_t xMessageBuffer;
|
|||
|
||||
/* Exercise the queue trace utilities. */
|
||||
xQueue = xQueueCreate( xQueueLength, ( UBaseType_t ) sizeof( uxValue ) );
|
||||
|
||||
if( xQueue != NULL )
|
||||
{
|
||||
vQueueSetQueueNumber( xQueue, xNumber );
|
||||
|
||||
if( uxQueueGetQueueNumber( xQueue ) != xNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( ucQueueGetQueueType( xQueue ) != queueQUEUE_TYPE_BASE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -198,14 +203,16 @@ MessageBufferHandle_t xMessageBuffer;
|
|||
}
|
||||
|
||||
/* Exercise the task trace utilities. Value of 100 is arbitrary, just want
|
||||
to check the value that is set is also read back. */
|
||||
* to check the value that is set is also read back. */
|
||||
uxValue = 100;
|
||||
xTaskHandle = xTaskGetCurrentTaskHandle();
|
||||
vTaskSetTaskNumber( xTaskHandle, uxValue );
|
||||
|
||||
if( uxTaskGetTaskNumber( xTaskHandle ) != uxValue )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( uxTaskGetTaskNumber( NULL ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -215,15 +222,18 @@ MessageBufferHandle_t xMessageBuffer;
|
|||
|
||||
|
||||
/* Exercise the stream buffer utilities. Try creating with a trigger level
|
||||
of 0, it should then get capped to 1. */
|
||||
* of 0, it should then get capped to 1. */
|
||||
xStreamBuffer = xStreamBufferCreate( sizeof( uint32_t ), 0 );
|
||||
|
||||
if( xStreamBuffer != NULL )
|
||||
{
|
||||
vStreamBufferSetStreamBufferNumber( xStreamBuffer, uxValue );
|
||||
|
||||
if( uxStreamBufferGetStreamBufferNumber( xStreamBuffer ) != uxValue )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
if( ucStreamBufferGetStreamBufferType( xStreamBuffer ) != 0 )
|
||||
{
|
||||
/* "Is Message Buffer" flag should have been 0. */
|
||||
|
@ -238,6 +248,7 @@ MessageBufferHandle_t xMessageBuffer;
|
|||
}
|
||||
|
||||
xMessageBuffer = xMessageBufferCreate( sizeof( uint32_t ) );
|
||||
|
||||
if( xMessageBuffer != NULL )
|
||||
{
|
||||
if( ucStreamBufferGetStreamBufferType( xMessageBuffer ) == 0 )
|
||||
|
@ -259,11 +270,11 @@ MessageBufferHandle_t xMessageBuffer;
|
|||
|
||||
static BaseType_t prvPeekTimeout( void )
|
||||
{
|
||||
QueueHandle_t xHandle;
|
||||
const UBaseType_t xQueueLength = 1;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
TickType_t xBlockTime = ( TickType_t ) 2;
|
||||
UBaseType_t uxReceived;
|
||||
QueueHandle_t xHandle;
|
||||
const UBaseType_t xQueueLength = 1;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
TickType_t xBlockTime = ( TickType_t ) 2;
|
||||
UBaseType_t uxReceived;
|
||||
|
||||
/* Create the queue just to try peeking it while it is empty. */
|
||||
xHandle = xQueueCreate( xQueueLength, ( UBaseType_t ) sizeof( xQueueLength ) );
|
||||
|
@ -294,16 +305,17 @@ UBaseType_t uxReceived;
|
|||
|
||||
static BaseType_t prvQueueQueryFromISR( void )
|
||||
{
|
||||
BaseType_t xReturn = pdPASS, xValue = 1;
|
||||
const UBaseType_t xISRQueueLength = ( UBaseType_t ) 1;
|
||||
const char *pcISRQueueName = "ISRQueue";
|
||||
QueueHandle_t xISRQueue = NULL;
|
||||
BaseType_t xReturn = pdPASS, xValue = 1;
|
||||
const UBaseType_t xISRQueueLength = ( UBaseType_t ) 1;
|
||||
const char * pcISRQueueName = "ISRQueue";
|
||||
QueueHandle_t xISRQueue = NULL;
|
||||
|
||||
xISRQueue = xQueueCreate( xISRQueueLength, ( UBaseType_t ) sizeof( BaseType_t ) );
|
||||
|
||||
if( xISRQueue != NULL )
|
||||
{
|
||||
vQueueAddToRegistry( xISRQueue, pcISRQueueName );
|
||||
|
||||
if( strcmp( pcQueueGetName( xISRQueue ), pcISRQueueName ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -360,15 +372,15 @@ QueueHandle_t xISRQueue = NULL;
|
|||
|
||||
static BaseType_t prvTaskQueryFunctions( void )
|
||||
{
|
||||
static TaskStatus_t xStatus, *pxStatusArray;
|
||||
TaskHandle_t xTimerTask, xIdleTask;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxNumberOfTasks, uxReturned, ux;
|
||||
uint32_t ulTotalRunTime1, ulTotalRunTime2;
|
||||
const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
||||
static TaskStatus_t xStatus, * pxStatusArray;
|
||||
TaskHandle_t xTimerTask, xIdleTask;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxNumberOfTasks, uxReturned, ux;
|
||||
uint32_t ulTotalRunTime1, ulTotalRunTime2;
|
||||
const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
||||
|
||||
/* Obtain task status with the stack high water mark and without the
|
||||
state. */
|
||||
* state. */
|
||||
vTaskGetInfo( NULL, &xStatus, pdTRUE, eRunning );
|
||||
|
||||
if( uxTaskGetStackHighWaterMark( NULL ) != xStatus.usStackHighWaterMark )
|
||||
|
@ -382,66 +394,76 @@ const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
|||
}
|
||||
|
||||
/* Now obtain a task status without the high water mark but with the state,
|
||||
which in the case of the idle task should be Read. */
|
||||
* which in the case of the idle task should be Read. */
|
||||
xTimerTask = xTimerGetTimerDaemonTaskHandle();
|
||||
vTaskSuspend( xTimerTask ); /* Should never suspend Timer task normally!. */
|
||||
vTaskGetInfo( xTimerTask, &xStatus, pdFALSE, eInvalid );
|
||||
|
||||
if( xStatus.eCurrentState != eSuspended )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xStatus.uxBasePriority != uxTaskPriorityGetFromISR( xTimerTask ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xStatus.uxBasePriority != ( configMAX_PRIORITIES - 1 ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
xTaskResumeFromISR( xTimerTask );
|
||||
vTaskGetInfo( xTimerTask, &xStatus, pdTRUE, eInvalid );
|
||||
|
||||
if( ( xStatus.eCurrentState != eReady ) && ( xStatus.eCurrentState != eBlocked ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( uxTaskGetStackHighWaterMark( xTimerTask ) != xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( uxTaskGetStackHighWaterMark2( xTimerTask ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Attempting to abort a delay in the idle task should be guaranteed to
|
||||
fail as the idle task should never block. */
|
||||
* fail as the idle task should never block. */
|
||||
xIdleTask = xTaskGetIdleTaskHandle();
|
||||
|
||||
if( xTaskAbortDelay( xIdleTask ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Create an array of task status objects large enough to hold information
|
||||
on the number of tasks at this time - note this may change at any time if
|
||||
higher priority tasks are executing and creating tasks. */
|
||||
* on the number of tasks at this time - note this may change at any time if
|
||||
* higher priority tasks are executing and creating tasks. */
|
||||
uxNumberOfTasks = uxTaskGetNumberOfTasks();
|
||||
pxStatusArray = ( TaskStatus_t * ) pvPortMalloc( uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
|
||||
if( pxStatusArray != NULL )
|
||||
{
|
||||
/* Pass part of the array into uxTaskGetSystemState() to ensure it doesn't
|
||||
try using more space than there is available. */
|
||||
* try using more space than there is available. */
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks / ( UBaseType_t ) 2, NULL );
|
||||
|
||||
if( uxReturned != ( UBaseType_t ) 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Now do the same but passing in the complete array size, this is done
|
||||
twice to check for a difference in the total run time. */
|
||||
* twice to check for a difference in the total run time. */
|
||||
uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime1 );
|
||||
memset( ( void * ) pxStatusArray, 0xaa, uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime2 );
|
||||
|
||||
if( ( ulTotalRunTime2 - ulTotalRunTime1 ) > ulRunTimeTollerance )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -454,6 +476,7 @@ const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
|||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( pxStatusArray[ ux ].uxCurrentPriority >= ( UBaseType_t ) configMAX_PRIORITIES )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -471,7 +494,7 @@ const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvDummyTagFunction( void *pvParameter )
|
||||
static BaseType_t prvDummyTagFunction( void * pvParameter )
|
||||
{
|
||||
return ( BaseType_t ) pvParameter;
|
||||
}
|
||||
|
@ -479,14 +502,15 @@ static BaseType_t prvDummyTagFunction( void *pvParameter )
|
|||
|
||||
static BaseType_t prvTaskTags( void )
|
||||
{
|
||||
BaseType_t xReturn = pdPASS, xParameter = ( BaseType_t ) 0xDEADBEEF;
|
||||
TaskHandle_t xTask;
|
||||
BaseType_t xReturn = pdPASS, xParameter = ( BaseType_t ) 0xDEADBEEF;
|
||||
TaskHandle_t xTask;
|
||||
|
||||
/* First try with the handle of a different task. Use the timer task for
|
||||
convenience. */
|
||||
* convenience. */
|
||||
xTask = xTimerGetTimerDaemonTaskHandle();
|
||||
|
||||
vTaskSetApplicationTaskTag( xTask, prvDummyTagFunction );
|
||||
|
||||
if( xTaskGetApplicationTaskTag( xTask ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -497,6 +521,7 @@ TaskHandle_t xTask;
|
|||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xTaskCallApplicationTaskHook( xTask, ( void * ) NULL ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -511,16 +536,19 @@ TaskHandle_t xTask;
|
|||
|
||||
/* Now try with a NULL handle, so using this task. */
|
||||
vTaskSetApplicationTaskTag( NULL, NULL );
|
||||
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xTaskGetApplicationTaskTagFromISR( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vTaskSetApplicationTaskTag( NULL, prvDummyTagFunction );
|
||||
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -531,6 +559,7 @@ TaskHandle_t xTask;
|
|||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xTaskCallApplicationTaskHook( NULL, ( void * ) NULL ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -544,6 +573,7 @@ TaskHandle_t xTask;
|
|||
}
|
||||
|
||||
vTaskSetApplicationTaskTag( NULL, NULL );
|
||||
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -555,11 +585,11 @@ TaskHandle_t xTask;
|
|||
|
||||
static BaseType_t prvTimerQuery( void )
|
||||
{
|
||||
TimerHandle_t xTimer;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const char *pcTimerName = "TestTimer";
|
||||
const TickType_t xTimerPeriod = ( TickType_t ) 100;
|
||||
const UBaseType_t uxTimerNumber = ( UBaseType_t ) 55;
|
||||
TimerHandle_t xTimer;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const char * pcTimerName = "TestTimer";
|
||||
const TickType_t xTimerPeriod = ( TickType_t ) 100;
|
||||
const UBaseType_t uxTimerNumber = ( UBaseType_t ) 55;
|
||||
|
||||
xTimer = xTimerCreate( pcTimerName,
|
||||
xTimerPeriod,
|
||||
|
@ -580,6 +610,7 @@ const UBaseType_t uxTimerNumber = ( UBaseType_t ) 55;
|
|||
}
|
||||
|
||||
vTimerSetTimerNumber( xTimer, uxTimerNumber );
|
||||
|
||||
if( uxTimerGetTimerNumber( xTimer ) != uxTimerNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
|
@ -598,7 +629,7 @@ const UBaseType_t uxTimerNumber = ( UBaseType_t ) 55;
|
|||
|
||||
BaseType_t xRunCodeCoverageTestAdditions( void )
|
||||
{
|
||||
BaseType_t xReturn = pdPASS;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
|
||||
xReturn &= prvStaticAllocationsWithNullBuffers();
|
||||
xReturn &= prvTraceUtils();
|
||||
|
@ -611,4 +642,3 @@ BaseType_t xReturn = pdPASS;
|
|||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
*/
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -37,21 +37,22 @@
|
|||
SemaphoreHandle_t xStdioMutex;
|
||||
StaticSemaphore_t xStdioMutexBuffer;
|
||||
|
||||
void console_init(void)
|
||||
void console_init( void )
|
||||
{
|
||||
xStdioMutex = xSemaphoreCreateMutexStatic(&xStdioMutexBuffer);
|
||||
xStdioMutex = xSemaphoreCreateMutexStatic( &xStdioMutexBuffer );
|
||||
}
|
||||
|
||||
void console_print(const char *fmt, ...)
|
||||
void console_print( const char * fmt,
|
||||
... )
|
||||
{
|
||||
va_list vargs;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
va_start( vargs, fmt );
|
||||
|
||||
xSemaphoreTake(xStdioMutex, portMAX_DELAY);
|
||||
xSemaphoreTake( xStdioMutex, portMAX_DELAY );
|
||||
|
||||
vprintf(fmt, vargs);
|
||||
vprintf( fmt, vargs );
|
||||
|
||||
|
||||
va_end(vargs);
|
||||
va_end( vargs );
|
||||
}
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
@ -59,6 +62,8 @@
|
|||
/* Local includes. */
|
||||
#include "console.h"
|
||||
|
||||
#include <trcRecorder.h>
|
||||
|
||||
#define ECHO_CLIENT_DEMO 0
|
||||
|
||||
#define mainSELECTED_APPLICATION ECHO_CLIENT_DEMO
|
||||
|
@ -67,7 +72,7 @@
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
extern void main_tcp_echo_client_tasks( void );
|
||||
// static void traceOnEnter( void );
|
||||
static void traceOnEnter( void );
|
||||
|
||||
/*
|
||||
* Prototypes for the standard FreeRTOS application hook (callback) functions
|
||||
|
@ -76,41 +81,56 @@ extern void main_tcp_echo_client_tasks( void );
|
|||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char *pcTaskName );
|
||||
char * pcTaskName );
|
||||
void vApplicationTickHook( void );
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize );
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
|
||||
StackType_t **ppxTimerTaskStackBuffer,
|
||||
uint32_t *pulTimerTaskStackSize );
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize );
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize );
|
||||
|
||||
/*
|
||||
* Writes trace data to a disk file when the trace recording is stopped.
|
||||
* This function will simply overwrite any trace files that already exist.
|
||||
*/
|
||||
// static void prvSaveTraceFile( void );
|
||||
static void prvSaveTraceFile( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* When configSUPPORT_STATIC_ALLOCATION is set to 1 the application writer can
|
||||
use a callback function to optionally provide the memory required by the idle
|
||||
and timer tasks. This is the stack that will be used by the timer task. It is
|
||||
declared here, as a global, so it can be checked by a test that is implemented
|
||||
in a different file. */
|
||||
* use a callback function to optionally provide the memory required by the idle
|
||||
* and timer tasks. This is the stack that will be used by the timer task. It is
|
||||
* declared here, as a global, so it can be checked by a test that is implemented
|
||||
* in a different file. */
|
||||
StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Notes if the trace is running or not. */
|
||||
// static BaseType_t xTraceRunning = pdTRUE;
|
||||
static BaseType_t xTraceRunning = pdTRUE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Do not include trace code when performing a code coverage analysis. */
|
||||
#if ( projCOVERAGE_TEST != 1 )
|
||||
{
|
||||
/* Initialise the trace recorder. Use of the trace recorder is optional.
|
||||
* See http://www.FreeRTOS.org/trace for more information. */
|
||||
xTraceEnable( TRC_START );
|
||||
|
||||
/* Start the trace recording - the recording is written to a file if
|
||||
* configASSERT() is called. */
|
||||
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
|
||||
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
|
||||
traceSTART();
|
||||
}
|
||||
#endif
|
||||
|
||||
console_init();
|
||||
#if ( mainSELECTED_APPLICATION == ECHO_CLIENT_DEMO )
|
||||
{
|
||||
console_print("Starting echo client demo\n");
|
||||
console_print( "Starting echo client demo\n" );
|
||||
main_tcp_echo_client_tasks();
|
||||
}
|
||||
#else
|
||||
|
@ -126,17 +146,17 @@ int main( void )
|
|||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
timer or semaphore is created. It is also called by various parts of the
|
||||
demo application. If heap_1.c, heap_2.c or heap_4.c is being used, then the
|
||||
size of the heap available to pvPortMalloc() is defined by
|
||||
configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
|
||||
API function can be used to query the size of free heap space that remains
|
||||
(although it does not provide information on how the remaining heap might be
|
||||
fragmented). See http://www.freertos.org/a00111.html for more
|
||||
information. */
|
||||
* configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
* function that will get called if a call to pvPortMalloc() fails.
|
||||
* pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
* timer or semaphore is created. It is also called by various parts of the
|
||||
* demo application. If heap_1.c, heap_2.c or heap_4.c is being used, then the
|
||||
* size of the heap available to pvPortMalloc() is defined by
|
||||
* configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
|
||||
* API function can be used to query the size of free heap space that remains
|
||||
* (although it does not provide information on how the remaining heap might be
|
||||
* fragmented). See http://www.freertos.org/a00111.html for more
|
||||
* information. */
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -144,32 +164,32 @@ void vApplicationMallocFailedHook( void )
|
|||
void vApplicationIdleHook( void )
|
||||
{
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
task. It is essential that code added to this hook function never attempts
|
||||
to block in any way (for example, call xQueueReceive() with a block time
|
||||
specified, or call vTaskDelay()). If application tasks make use of the
|
||||
vTaskDelete() API function to delete themselves then it is also important
|
||||
that vApplicationIdleHook() is permitted to return to its calling function,
|
||||
because it is the responsibility of the idle task to clean up memory
|
||||
allocated by the kernel to any task that has since deleted itself. */
|
||||
* to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
* task. It is essential that code added to this hook function never attempts
|
||||
* to block in any way (for example, call xQueueReceive() with a block time
|
||||
* specified, or call vTaskDelay()). If application tasks make use of the
|
||||
* vTaskDelete() API function to delete themselves then it is also important
|
||||
* that vApplicationIdleHook() is permitted to return to its calling function,
|
||||
* because it is the responsibility of the idle task to clean up memory
|
||||
* allocated by the kernel to any task that has since deleted itself. */
|
||||
|
||||
|
||||
usleep(15000);
|
||||
// traceOnEnter();
|
||||
usleep( 15000 );
|
||||
traceOnEnter();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char *pcTaskName )
|
||||
char * pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* Run time stack overflow checking is performed if
|
||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
function is called if a stack overflow is detected. This function is
|
||||
provided as an example only as stack overflow checking does not function
|
||||
when running the FreeRTOS POSIX port. */
|
||||
* configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
* function is called if a stack overflow is detected. This function is
|
||||
* provided as an example only as stack overflow checking does not function
|
||||
* when running the FreeRTOS POSIX port. */
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -177,16 +197,44 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
|||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* This function will be called by each tick interrupt if
|
||||
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
||||
added here, but the tick hook is called from an interrupt context, so
|
||||
code must not attempt to block, and only the interrupt safe FreeRTOS API
|
||||
functions can be used (those that end in FromISR()). */
|
||||
* configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
||||
* added here, but the tick hook is called from an interrupt context, so
|
||||
* code must not attempt to block, and only the interrupt safe FreeRTOS API
|
||||
* functions can be used (those that end in FromISR()). */
|
||||
}
|
||||
|
||||
void vLoggingPrintf( const char *pcFormat,
|
||||
void traceOnEnter()
|
||||
{
|
||||
int xReturn;
|
||||
struct timeval tv = { 0L, 0L };
|
||||
fd_set fds;
|
||||
|
||||
FD_ZERO( &fds );
|
||||
FD_SET( STDIN_FILENO, &fds );
|
||||
|
||||
xReturn = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv );
|
||||
|
||||
if( xReturn > 0 )
|
||||
{
|
||||
if( xTraceRunning == pdTRUE )
|
||||
{
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
prvSaveTraceFile();
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
/* clear the buffer */
|
||||
char buffer[ 1 ];
|
||||
read( STDIN_FILENO, &buffer, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void vLoggingPrintf( const char * pcFormat,
|
||||
... )
|
||||
{
|
||||
va_list arg;
|
||||
va_list arg;
|
||||
|
||||
va_start( arg, pcFormat );
|
||||
vprintf( pcFormat, arg );
|
||||
|
@ -197,9 +245,9 @@ va_list arg;
|
|||
void vApplicationDaemonTaskStartupHook( void )
|
||||
{
|
||||
/* This function will be called once only, when the daemon task starts to
|
||||
execute (sometimes called the timer task). This is useful if the
|
||||
application includes initialisation code that would benefit from executing
|
||||
after the scheduler has been started. */
|
||||
* execute (sometimes called the timer task). This is useful if the
|
||||
* application includes initialisation code that would benefit from executing
|
||||
* after the scheduler has been started. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -208,67 +256,132 @@ void vAssertCalled( const char * const pcFileName,
|
|||
{
|
||||
static BaseType_t xPrinted = pdFALSE;
|
||||
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
|
||||
/* Copy the parameters to local volatile variables, just for debugging */
|
||||
volatile char * pcFile = ( volatile char * ) pcFileName;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
/* Called if an assertion passed to configASSERT() fails. See
|
||||
http://www.freertos.org/a00110.html#configASSERT for more information. */
|
||||
* https://www.FreeRTOS.org/a00110.html#configASSERT for more information. */
|
||||
|
||||
printf( "vAssertCalled( %s, %u )\n", pcFileName, ulLine );
|
||||
exit(1);
|
||||
/* Parameters are not used. */
|
||||
( void ) ulLine;
|
||||
( void ) pcFileName;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* Stop the trace recording. */
|
||||
if( xPrinted == pdFALSE )
|
||||
{
|
||||
xPrinted = pdTRUE;
|
||||
|
||||
if( xTraceRunning == pdTRUE )
|
||||
{
|
||||
prvSaveTraceFile();
|
||||
}
|
||||
}
|
||||
|
||||
/* You can step out of this function to debug the assertion by using
|
||||
* the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero
|
||||
* value. */
|
||||
while( ulSetToNonZeroInDebuggerToContinue == 1 )
|
||||
{
|
||||
__asm volatile ( "NOP" );
|
||||
__asm volatile ( "NOP" );
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSaveTraceFile( void )
|
||||
{
|
||||
/* Tracing is not used when code coverage analysis is being performed. */
|
||||
#if ( projCOVERAGE_TEST != 1 )
|
||||
{
|
||||
FILE * pxOutputFile;
|
||||
pxOutputFile = fopen( "Trace.dump", "wb" );
|
||||
|
||||
if( pxOutputFile != NULL )
|
||||
{
|
||||
{
|
||||
xTraceDisable();
|
||||
fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );
|
||||
fclose( pxOutputFile );
|
||||
printf( "\r\nTrace output saved to Trace.dump\r\n" );
|
||||
xTraceEnable( TRC_START );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "\r\nFailed to create trace dump file\r\n" );
|
||||
}
|
||||
}
|
||||
#endif /* if ( projCOVERAGE_TEST != 1 ) */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize )
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
function then they must be declared static - otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
state will be stored. */
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
|
||||
StackType_t **ppxTimerTaskStackBuffer,
|
||||
uint32_t *pulTimerTaskStackSize )
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
function then they must be declared static - otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
task's state will be stored. */
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
static uint32_t ulEntryTime = 0U;
|
||||
|
||||
void vTraceTimerReset( void )
|
||||
{
|
||||
ulEntryTime = xTaskGetTickCount();
|
||||
}
|
||||
|
||||
uint32_t uiTraceTimerGetFrequency( void )
|
||||
{
|
||||
return configTICK_RATE_HZ;
|
||||
}
|
||||
|
||||
uint32_t uiTraceTimerGetValue( void )
|
||||
{
|
||||
return( xTaskGetTickCount() - ulEntryTime );
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
* Also note that it is assumed this demo is going to be used for short periods
|
||||
* of time only, and therefore timer overflows are not handled.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
@ -48,19 +48,19 @@ static unsigned long ulStartTimeNs;
|
|||
|
||||
void vConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
struct timespec xNow;
|
||||
struct timespec xNow;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &xNow);
|
||||
clock_gettime( CLOCK_MONOTONIC, &xNow );
|
||||
ulStartTimeNs = xNow.tv_sec * 1000000000ul + xNow.tv_nsec;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulGetRunTimeCounterValue( void )
|
||||
{
|
||||
struct timespec xNow;
|
||||
struct timespec xNow;
|
||||
|
||||
/* Time at start. */
|
||||
clock_gettime(CLOCK_MONOTONIC, &xNow);
|
||||
clock_gettime( CLOCK_MONOTONIC, &xNow );
|
||||
|
||||
return xNow.tv_sec * 1000000000ul + xNow.tv_nsec - ulStartTimeNs;
|
||||
}
|
||||
|
|
|
@ -1,290 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcConfig.h
|
||||
*
|
||||
* Main configuration parameters for the trace recorder library.
|
||||
* More settings can be found in trcStreamingConfig.h and trcSnapshotConfig.h.
|
||||
*
|
||||
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
|
||||
*
|
||||
* Terms of Use
|
||||
* This file is part of the trace recorder library (RECORDER), which is the
|
||||
* intellectual property of Percepio AB (PERCEPIO) and provided under a
|
||||
* license as follows.
|
||||
* The RECORDER may be used free of charge for the purpose of recording data
|
||||
* intended for analysis in PERCEPIO products. It may not be used or modified
|
||||
* for other purposes without explicit permission from PERCEPIO.
|
||||
* 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
|
||||
* specific processor, processor family or with a specific communication
|
||||
* interface. Any such modifications should be documented directly below
|
||||
* 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
|
||||
* 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.
|
||||
* In no event will PERCEPIO, its technology partners, or distributors be liable
|
||||
* to you for any consequential, incidental or special damages, including any
|
||||
* lost profits or lost savings, even if a representative of PERCEPIO has been
|
||||
* advised of the possibility of such damages, or for any claim by any third
|
||||
* party. Some jurisdictions do not allow the exclusion or limitation of
|
||||
* incidental, consequential or special damages, or the exclusion of implied
|
||||
* warranties or limitations on how long an implied warranty may last, so the
|
||||
* above limitations may not apply to you.
|
||||
*
|
||||
* Tabs are used for indent in this file (1 tab = 4 spaces)
|
||||
*
|
||||
* Copyright Percepio AB, 2016.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRC_CONFIG_H
|
||||
#define TRC_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Include of processor header file
|
||||
*
|
||||
* Here you may need to include the header file for your processor. This is
|
||||
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
|
||||
* Try that in case of build problems. Otherwise, remove the #error line below.
|
||||
*****************************************************************************/
|
||||
//#error "Trace Recorder: Please include your processor's header file here and remove this line."
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_HARDWARE_PORT
|
||||
*
|
||||
* Specify what hardware port to use (i.e., the "timestamping driver").
|
||||
*
|
||||
* All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
|
||||
* This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is
|
||||
* available on most such devices. In case your device don't have DWT support,
|
||||
* you will get an error message opening the trace. In that case, you may
|
||||
* force the recorder to use SysTick timestamping instead, using this define:
|
||||
*
|
||||
* #define TRC_CFG_ARM_CM_USE_SYSTICK
|
||||
*
|
||||
* For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.
|
||||
*
|
||||
* See trcHardwarePort.h for available ports and information on how to
|
||||
* define your own port, if not already present.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_Win32
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RECORDER_MODE
|
||||
*
|
||||
* Specify what recording mode to use. Snapshot means that the data is saved in
|
||||
* an internal RAM buffer, for later upload. Streaming means that the data is
|
||||
* transferred continuously to the host PC.
|
||||
*
|
||||
* For more information, see http://percepio.com/2016/10/05/rtos-tracing/
|
||||
* and the Tracealyzer User Manual.
|
||||
*
|
||||
* Values:
|
||||
* TRC_RECORDER_MODE_SNAPSHOT
|
||||
* TRC_RECORDER_MODE_STREAMING
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SCHEDULING_ONLY
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* If this setting is enabled (= 1), only scheduling events are recorded.
|
||||
* If disabled (= 0), all events are recorded (unless filtered in other ways).
|
||||
*
|
||||
* Default value is 0 (= include additional events).
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SCHEDULING_ONLY 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_INCLUDE_MEMMANG_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero (0)
|
||||
* to exclude malloc/free calls, or one (1) to include such events in the trace.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_INCLUDE_USER_EVENTS
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* therefore much faster than a console printf and can often be used
|
||||
* in timing critical code without problems.
|
||||
*
|
||||
* Note: In streaming mode, User Events are used to provide error messages
|
||||
* and warnings from the recorder (in case of incorrect configuration) for
|
||||
* display in Tracealyzer. Disabling user events will also disable these
|
||||
* warnings. You can however still catch them by calling xTraceGetLastError
|
||||
* or by putting breakpoints in prvTraceError and prvTraceWarning.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded, in order to reduce code size.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
|
||||
* and vTraceStoreISREnd in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_ISR_TRACING 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This allows Tracealyzer to show the initial pending time before tasks enter
|
||||
* the execution state, and present accurate response times.
|
||||
* If zero (0), "ready events" are not created, which allows for recording
|
||||
* longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_OSTICK_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is one (1), events will be generated whenever the OS clock is
|
||||
* increased. If zero (0), OS tick events are not generated, which allows for
|
||||
* recording longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any "event group" events.
|
||||
*
|
||||
* Default value is 0 (excluded) since dependent on event_groups.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_TIMER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any Timer events.
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_TIMER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
|
||||
*
|
||||
* 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"
|
||||
* events, such as xTimerPendFunctionCall().
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any stream buffer or message
|
||||
* buffer events.
|
||||
*
|
||||
* Default value is 0 since dependent on stream_buffer.c (new in FreeRTOS v10)
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
|
||||
*
|
||||
* Specifies how the recorder buffer is allocated (also in case of streaming, in
|
||||
* port using the recorder's internal temporary buffer)
|
||||
*
|
||||
* Values:
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation (internal)
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer
|
||||
*
|
||||
* Static and dynamic mode does the allocation for you, either in compile time
|
||||
* (static) or in runtime (malloc).
|
||||
* The custom mode allows you to control how and where the allocation is made,
|
||||
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_MAX_ISR_NESTING
|
||||
*
|
||||
* Defines how many levels of interrupt nesting the recorder can handle, in
|
||||
* case multiple ISRs are traced and ISR nesting is possible. If this
|
||||
* is exceeded, the particular ISR will not be traced and the recorder then
|
||||
* logs an error message. This setting is used to allocate an internal stack
|
||||
* for keeping track of the previous execution context (4 byte per entry).
|
||||
*
|
||||
* This value must be a non-zero positive constant, at least 1.
|
||||
*
|
||||
* Default value: 8
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_MAX_ISR_NESTING 8
|
||||
|
||||
#define TRC_CFG_CTRL_TASK_STACK_SIZE ( 1024 )
|
||||
|
||||
#define TRC_CFG_CTRL_TASK_PRIORITY 1
|
||||
|
||||
#define TRC_CFG_CTRL_TASK_DELAY 2
|
||||
|
||||
#define TRC_CFG_RECORDER_DATA_ATTRIBUTE
|
||||
|
||||
/* Specific configuration, depending on Streaming/Snapshot mode */
|
||||
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
|
||||
#include "trcSnapshotConfig.h"
|
||||
#elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
|
||||
#include "trcStreamingConfig.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TRC_CONFIG_H */
|
|
@ -1,345 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcSnapshotConfig.h
|
||||
*
|
||||
* Configuration parameters for trace recorder library in snapshot mode.
|
||||
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
|
||||
*
|
||||
* Terms of Use
|
||||
* This file is part of the trace recorder library (RECORDER), which is the
|
||||
* intellectual property of Percepio AB (PERCEPIO) and provided under a
|
||||
* license as follows.
|
||||
* The RECORDER may be used free of charge for the purpose of recording data
|
||||
* intended for analysis in PERCEPIO products. It may not be used or modified
|
||||
* for other purposes without explicit permission from PERCEPIO.
|
||||
* 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
|
||||
* specific processor, processor family or with a specific communication
|
||||
* interface. Any such modifications should be documented directly below
|
||||
* 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
|
||||
* 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.
|
||||
* In no event will PERCEPIO, its technology partners, or distributors be liable
|
||||
* to you for any consequential, incidental or special damages, including any
|
||||
* lost profits or lost savings, even if a representative of PERCEPIO has been
|
||||
* advised of the possibility of such damages, or for any claim by any third
|
||||
* party. Some jurisdictions do not allow the exclusion or limitation of
|
||||
* incidental, consequential or special damages, or the exclusion of implied
|
||||
* warranties or limitations on how long an implied warranty may last, so the
|
||||
* above limitations may not apply to you.
|
||||
*
|
||||
* Tabs are used for indent in this file (1 tab = 4 spaces)
|
||||
*
|
||||
* Copyright Percepio AB, 2017.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRC_SNAPSHOT_CONFIG_H
|
||||
#define TRC_SNAPSHOT_CONFIG_H
|
||||
|
||||
#define TRC_SNAPSHOT_MODE_RING_BUFFER (0x01)
|
||||
#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL (0x02)
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_SNAPSHOT_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL
|
||||
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the
|
||||
* events are stored in a ring buffer, i.e., where the oldest events are
|
||||
* overwritten when the buffer becomes full. This allows you to get the last
|
||||
* events leading up to an interesting state, e.g., an error, without having
|
||||
* to store the whole run since startup.
|
||||
*
|
||||
* When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the
|
||||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_EVENT_BUFFER_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the event buffer, i.e., the number of records
|
||||
* it may store. Most events use one record (4 byte), although some events
|
||||
* require multiple 4-byte records. You should adjust this to the amount of RAM
|
||||
* available in the target system.
|
||||
*
|
||||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_EVENT_BUFFER_SIZE 32000
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the support for logging floating point values in
|
||||
* vTracePrintF is stripped out, in case floating point values are not used or
|
||||
* supported by the platform used.
|
||||
*
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* allow for storing float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 0.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SYMBOL_TABLE_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* stores User Events labels and names of deleted tasks, queues, or other kernel
|
||||
* objects. If you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value. The minimum recommended value is 4.
|
||||
* A size of zero (0) is not allowed since a zero-sized array may result in a
|
||||
* 32-bit pointer, i.e., using 4 bytes rather than 0.
|
||||
*
|
||||
* Default value is 800.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SYMBOL_TABLE_SIZE 32000
|
||||
|
||||
#if (TRC_CFG_SYMBOL_TABLE_SIZE == 0)
|
||||
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...
|
||||
*
|
||||
* Macros that specify the maximum lengths (number of characters) for names of
|
||||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_NAME_LEN_TASK 15
|
||||
#define TRC_CFG_NAME_LEN_ISR 15
|
||||
#define TRC_CFG_NAME_LEN_QUEUE 15
|
||||
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
|
||||
#define TRC_CFG_NAME_LEN_MUTEX 15
|
||||
#define TRC_CFG_NAME_LEN_TIMER 15
|
||||
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
|
||||
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
******************************************************************************
|
||||
* The remaining settings are not necessary to modify but allows for optimizing
|
||||
* the recorder setup for your specific needs, e.g., to exclude events that you
|
||||
* are not interested in, in order to get longer traces.
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_HEAP_SIZE_BELOW_16M
|
||||
*
|
||||
* An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with reported addresses showing the
|
||||
* lower 24 bits only. If 0, you get the full 32-bit addresses.
|
||||
*
|
||||
* Default value is 0.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into "instances" based on Instance Finish
|
||||
* Events (IFEs), produced either by default rules or calls to the recorder
|
||||
* functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is
|
||||
* used, resulting in a "typical" grouping of events into instances.
|
||||
* If these rules don't give appropriate instances in your case, you can
|
||||
* override the default rules using vTraceInstanceFinishedNow/Next for one
|
||||
* or several tasks. The default IFE rules are then disabled for those tasks.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are
|
||||
* disabled globally. You must then call vTraceInstanceFinishedNow or
|
||||
* vTraceInstanceFinishedNext to manually group the events into instances,
|
||||
* otherwise the tasks will appear a single long instance.
|
||||
*
|
||||
* The default IFE rules count the following events as "instance finished":
|
||||
* - Task delay, delay until
|
||||
* - Task suspend
|
||||
* - Blocking on "input" operations, i.e., when the task is waiting for the
|
||||
* next a message/signal/event. But only if this event is blocking.
|
||||
*
|
||||
* For details, see trcSnapshotKernelPort.h and look for references to the
|
||||
* macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_16BIT_OBJECT_HANDLES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (tasks, queues, mutexes,
|
||||
* etc.) Note: 255, not 256, since handle 0 is reserved.
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* Default is 0 (8-bit handles)
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever the object is referenced. Moreover, some internal
|
||||
* tables in the recorder gets slightly larger when using 16-bit handles.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is one (1), the TRACE_ASSERT macro (used at various locations in the
|
||||
* trace recorder) will verify that a relevant condition is true.
|
||||
* If the condition is false, prvTraceError() will be called, which stops the
|
||||
* recording and stores an error message that is displayed when opening the
|
||||
* trace in Tracealyzer.
|
||||
*
|
||||
* This is used on several places in the recorder code for sanity checks on
|
||||
* parameters. Can be switched off to reduce the footprint of the tracing, but
|
||||
* we recommend to have it enabled initially.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_TRACE_ASSERT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the
|
||||
* separate user event buffer (UB).
|
||||
* In this mode, user events are stored separately from other events,
|
||||
* e.g., RTOS events. Thereby you can get a much longer history of
|
||||
* user events as they don't need to share the buffer space with more
|
||||
* frequent events.
|
||||
*
|
||||
* The UB is typically used with the snapshot ring-buffer mode, so the
|
||||
* recording can continue when the main buffer gets full. And since the
|
||||
* main buffer then overwrites the earliest events, Tracealyzer displays
|
||||
* "Unknown Actor" instead of task scheduling for periods with UB data only.
|
||||
*
|
||||
* In UB mode, user events are structured as UB channels, which contains
|
||||
* a channel name and a default format string. Register a UB channel using
|
||||
* xTraceRegisterUBChannel.
|
||||
*
|
||||
* Events and data arguments are written using vTraceUBEvent and
|
||||
* vTraceUBData. They are designed to provide efficient logging of
|
||||
* repeating events, using the same format string within each channel.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* traceString chn1 = xTraceRegisterString("Channel 1");
|
||||
* traceString fmt1 = xTraceRegisterString("Event!");
|
||||
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);
|
||||
*
|
||||
* traceString chn2 = xTraceRegisterString("Channel 2");
|
||||
* traceString fmt2 = xTraceRegisterString("X: %d, Y: %d");
|
||||
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);
|
||||
*
|
||||
* // Result in "[Channel 1] Event!"
|
||||
* vTraceUBEvent(UBCh1);
|
||||
*
|
||||
* // Result in "[Channel 2] X: 23, Y: 19"
|
||||
* vTraceUBData(UBCh2, 23, 19);
|
||||
*
|
||||
* You can also use the other user event functions, like vTracePrintF.
|
||||
* as they are then rerouted to the UB instead of the main event buffer.
|
||||
* vTracePrintF then looks up the correct UB channel based on the
|
||||
* provided channel name and format string, or creates a new UB channel
|
||||
* if no match is found. The format string should therefore not contain
|
||||
* "random" messages but mainly format specifiers. Random strings should
|
||||
* be stored using %s and with the string as an argument.
|
||||
*
|
||||
* // Creates a new UB channel ("Channel 2", "%Z: %d")
|
||||
* vTracePrintF(chn2, "%Z: %d", value1);
|
||||
*
|
||||
* // Finds the existing UB channel
|
||||
* vTracePrintF(chn2, "%Z: %d", value2);
|
||||
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the user event buffer (UB), in number of slots.
|
||||
* A single user event can use multiple slots, depending on the arguments.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_UB_CHANNELS
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the number of User Event Buffer Channels (UB channels).
|
||||
* These are used to structure the events when using the separate user
|
||||
* event buffer, and contains both a User Event Channel (the name) and
|
||||
* a default format string for the channel.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_UB_CHANNELS 32
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* If tracing multiple ISRs, this setting allows for accurate display of the
|
||||
* context-switching also in cases when the ISRs execute in direct sequence.
|
||||
*
|
||||
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
|
||||
* context, i.e., a task or a preempted ISR. But if another traced ISR
|
||||
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
|
||||
* fragment of the previous context in between the ISRs.
|
||||
*
|
||||
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
|
||||
* however a threshold value that must be measured for your specific setup.
|
||||
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
|
||||
*
|
||||
* The default setting is 0, meaning "disabled" and that you may get an
|
||||
* extra fragments of the previous context in between tail-chained ISRs.
|
||||
*
|
||||
* Note: This setting has separate definitions in trcSnapshotConfig.h and
|
||||
* trcStreamingConfig.h, since it is affected by the recorder mode.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
|
||||
|
||||
#endif /*TRC_SNAPSHOT_CONFIG_H*/
|
|
@ -13,6 +13,7 @@ FREERTOS_PLUS_DIR := $(abspath $(FREERTOS_PLUS_DIR_REL))
|
|||
KERNEL_DIR := ${FREERTOS_DIR}/Source
|
||||
|
||||
INCLUDE_DIRS := -I.
|
||||
INCLUDE_DIRS += -I./Trace_Recorder_Configuration
|
||||
INCLUDE_DIRS += -I${KERNEL_DIR}/include
|
||||
INCLUDE_DIRS += -I${KERNEL_DIR}/portable/ThirdParty/GCC/Posix
|
||||
INCLUDE_DIRS += -I${KERNEL_DIR}/portable/ThirdParty/GCC/Posix/utils
|
||||
|
|
320
FreeRTOS/Demo/Posix_GCC/Trace_Recorder_Configuration/trcConfig.h
Normal file
320
FreeRTOS/Demo/Posix_GCC/Trace_Recorder_Configuration/trcConfig.h
Normal file
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Main configuration parameters for the trace recorder library.
|
||||
* More settings can be found in trcStreamingConfig.h and trcSnapshotConfig.h.
|
||||
*/
|
||||
|
||||
#ifndef TRC_CONFIG_H
|
||||
#define TRC_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Include of processor header file
|
||||
*
|
||||
* Here you may need to include the header file for your processor. This is
|
||||
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
|
||||
* Try that in case of build problems. Otherwise, remove the #error line below.
|
||||
*****************************************************************************/
|
||||
/*#error "Trace Recorder: Please include your processor's header file here and remove this line." */
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_HARDWARE_PORT
|
||||
* @brief Specify what hardware port to use (i.e., the "timestamping driver").
|
||||
*
|
||||
* All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
|
||||
* This port uses the DWT cycle counter for Cortex-M3/M4/M7 devices, which is
|
||||
* available on most such devices. In case your device don't have DWT support,
|
||||
* you will get an error message opening the trace. In that case, you may
|
||||
* force the recorder to use SysTick timestamping instead, using this define:
|
||||
*
|
||||
* #define TRC_CFG_ARM_CM_USE_SYSTICK
|
||||
*
|
||||
* For ARM Cortex-M0/M0+ devices, SysTick mode is used automatically.
|
||||
*
|
||||
* See trcHardwarePort.h for available ports and information on how to
|
||||
* define your own port, if not already present.
|
||||
*/
|
||||
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_Win32
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SCHEDULING_ONLY
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* If this setting is enabled (= 1), only scheduling events are recorded.
|
||||
* If disabled (= 0), all events are recorded (unless filtered in other ways).
|
||||
*
|
||||
* Default value is 0 (= include additional events).
|
||||
*/
|
||||
#define TRC_CFG_SCHEDULING_ONLY 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_MEMMANG_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero (0)
|
||||
* to exclude malloc/free calls, or one (1) to include such events in the trace.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_USER_EVENTS
|
||||
* @brief 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
|
||||
* 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
|
||||
* therefore much faster than a console printf and can often be used
|
||||
* in timing critical code without problems.
|
||||
*
|
||||
* Note: In streaming mode, User Events are used to provide error messages
|
||||
* and warnings from the recorder (in case of incorrect configuration) for
|
||||
* display in Tracealyzer. Disabling user events will also disable these
|
||||
* warnings. You can however still catch them by calling xTraceErrorGetLast
|
||||
* or by putting breakpoints in xTraceError and xTraceWarning.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_USER_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_ISR_TRACING
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded, in order to reduce code size. This means that any calls to
|
||||
* vTraceStoreISRBegin/vTraceStoreISREnd will be ignored.
|
||||
* This does not completely disable ISR tracing, in cases where an ISR is
|
||||
* calling a traced kernel service. These events will still be recorded and
|
||||
* show up in anonymous ISR instances in Tracealyzer, with names such as
|
||||
* "ISR sending to <queue name>".
|
||||
* To disable such tracing, please refer to vTraceSetFilterGroup and
|
||||
* vTraceSetFilterMask.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
|
||||
* and vTraceStoreISREnd in your interrupt handlers.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_ISR_TRACING 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_READY_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This allows Tracealyzer to show the initial pending time before tasks enter
|
||||
* the execution state, and present accurate response times.
|
||||
* If zero (0), "ready events" are not created, which allows for recording
|
||||
* longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_READY_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_OSTICK_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is one (1), events will be generated whenever the OS clock is
|
||||
* increased. If zero (0), OS tick events are not generated, which allows for
|
||||
* recording longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_ENABLE_STACK_MONITOR
|
||||
* @brief If enabled (1), the recorder periodically reports the unused stack space of
|
||||
* all active tasks.
|
||||
* The stack monitoring runs in the Tracealyzer Control task, TzCtrl. This task
|
||||
* is always created by the recorder when in streaming mode.
|
||||
* In snapshot mode, the TzCtrl task is only used for stack monitoring and is
|
||||
* not created unless this is enabled.
|
||||
*/
|
||||
#define TRC_CFG_ENABLE_STACK_MONITOR 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_STACK_MONITOR_MAX_TASKS
|
||||
* @brief Macro which should be defined as a non-zero integer value.
|
||||
*
|
||||
* This controls how many tasks that can be monitored by the stack monitor.
|
||||
* If this is too small, some tasks will be excluded and a warning is shown.
|
||||
*
|
||||
* Default value is 10.
|
||||
*/
|
||||
#define TRC_CFG_STACK_MONITOR_MAX_TASKS 10
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_STACK_MONITOR_MAX_REPORTS
|
||||
* @brief Macro which should be defined as a non-zero integer value.
|
||||
*
|
||||
* This defines how many tasks that will be subject to stack usage analysis for
|
||||
* each execution of the Tracealyzer Control task (TzCtrl). Note that the stack
|
||||
* monitoring cycles between the tasks, so this does not affect WHICH tasks that
|
||||
* are monitored, but HOW OFTEN each task stack is analyzed.
|
||||
*
|
||||
* This setting can be combined with TRC_CFG_CTRL_TASK_DELAY to tune the
|
||||
* frequency of the stack monitoring. This is motivated since the stack analysis
|
||||
* can take some time to execute.
|
||||
* However, note that the stack analysis runs in a separate task (TzCtrl) that
|
||||
* can be executed on low priority. This way, you can avoid that the stack
|
||||
* analysis disturbs any time-sensitive tasks.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_STACK_MONITOR_MAX_REPORTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_CTRL_TASK_PRIORITY
|
||||
* @brief The scheduling priority of the Tracealyzer Control (TzCtrl) task.
|
||||
*
|
||||
* In streaming mode, TzCtrl is used to receive start/stop commands from
|
||||
* Tracealyzer and in some cases also to transmit the trace data (for stream
|
||||
* ports that uses the internal buffer, like TCP/IP). For such stream ports,
|
||||
* make sure the TzCtrl priority is high enough to ensure reliable periodic
|
||||
* execution and transfer of the data, but low enough to avoid disturbing any
|
||||
* time-sensitive functions.
|
||||
*
|
||||
* In Snapshot mode, TzCtrl is only used for the stack usage monitoring and is
|
||||
* not created if stack monitoring is disabled. TRC_CFG_CTRL_TASK_PRIORITY should
|
||||
* be low, to avoid disturbing any time-sensitive tasks.
|
||||
*/
|
||||
#define TRC_CFG_CTRL_TASK_PRIORITY 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_CTRL_TASK_DELAY
|
||||
* @brief The delay between loops of the TzCtrl task (see TRC_CFG_CTRL_TASK_PRIORITY),
|
||||
* which affects the frequency of the stack monitoring.
|
||||
*
|
||||
* In streaming mode, this also affects the trace data transfer if you are using
|
||||
* a stream port leveraging the internal buffer (like TCP/IP). A shorter delay
|
||||
* increases the CPU load of TzCtrl somewhat, but may improve the performance of
|
||||
* of the trace streaming, especially if the trace buffer is small.
|
||||
*/
|
||||
#define TRC_CFG_CTRL_TASK_DELAY 2
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_CTRL_TASK_STACK_SIZE
|
||||
* @brief The stack size of the Tracealyzer Control (TzCtrl) task.
|
||||
* See TRC_CFG_CTRL_TASK_PRIORITY for further information about TzCtrl.
|
||||
*/
|
||||
#define TRC_CFG_CTRL_TASK_STACK_SIZE 1024
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_BUFFER_ALLOCATION
|
||||
* @brief Specifies how the recorder buffer is allocated (also in case of streaming, in
|
||||
* port using the recorder's internal temporary buffer)
|
||||
*
|
||||
* Values:
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation (internal)
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Malloc in vTraceEnable
|
||||
* TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer
|
||||
*
|
||||
* Static and dynamic mode does the allocation for you, either in compile time
|
||||
* (static) or in runtime (malloc).
|
||||
* The custom mode allows you to control how and where the allocation is made,
|
||||
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_MAX_ISR_NESTING
|
||||
* @brief Defines how many levels of interrupt nesting the recorder can handle, in
|
||||
* case multiple ISRs are traced and ISR nesting is possible. If this
|
||||
* is exceeded, the particular ISR will not be traced and the recorder then
|
||||
* logs an error message. This setting is used to allocate an internal stack
|
||||
* for keeping track of the previous execution context (4 byte per entry).
|
||||
*
|
||||
* This value must be a non-zero positive constant, at least 1.
|
||||
*
|
||||
* Default value: 8
|
||||
*/
|
||||
#define TRC_CFG_MAX_ISR_NESTING 8
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_ISR_TAILCHAINING_THRESHOLD
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* If tracing multiple ISRs, this setting allows for accurate display of the
|
||||
* context-switching also in cases when the ISRs execute in direct sequence.
|
||||
*
|
||||
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
|
||||
* context, i.e., a task or a preempted ISR. But if another traced ISR
|
||||
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
|
||||
* fragment of the previous context in between the ISRs.
|
||||
*
|
||||
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
|
||||
* however a threshold value that must be measured for your specific setup.
|
||||
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
|
||||
*
|
||||
* The default setting is 0, meaning "disabled" and that you may get an
|
||||
* extra fragments of the previous context in between tail-chained ISRs.
|
||||
*
|
||||
* Note: This setting has separate definitions in trcSnapshotConfig.h and
|
||||
* trcStreamingConfig.h, since it is affected by the recorder mode.
|
||||
*/
|
||||
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_DATA_INIT
|
||||
* @brief Macro which states wether the recorder data should have an initial value.
|
||||
*
|
||||
* In very specific cases where traced objects are created before main(),
|
||||
* the recorder will need to be started even before that. In these cases,
|
||||
* the recorder data would be initialized by vTraceEnable(TRC_INIT) but could
|
||||
* then later be overwritten by the initialization value.
|
||||
* If this is an issue for you, set TRC_CFG_RECORDER_DATA_INIT to 0.
|
||||
* The following code can then be used before any traced objects are created:
|
||||
*
|
||||
* extern uint32_t RecorderEnabled;
|
||||
* RecorderEnabled = 0;
|
||||
* xTraceInitialize();
|
||||
*
|
||||
* After the clocks are properly initialized, use vTraceEnable(...) to start
|
||||
* the tracing.
|
||||
*
|
||||
* Default value is 1.
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_DATA_INIT 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_DATA_ATTRIBUTE
|
||||
* @brief When setting TRC_CFG_RECORDER_DATA_INIT to 0, you might also need to make
|
||||
* sure certain recorder data is placed in a specific RAM section to avoid being
|
||||
* zeroed out after initialization. Define TRC_CFG_RECORDER_DATA_ATTRIBUTE as
|
||||
* that attribute.
|
||||
*
|
||||
* Example:
|
||||
* #define TRC_CFG_RECORDER_DATA_ATTRIBUTE __attribute__((section(".bss.trace_recorder_data")))
|
||||
*
|
||||
* Default value is empty.
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_DATA_ATTRIBUTE
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_TRACE_ASSERT
|
||||
* @brief Enable or disable debug asserts. Information regarding any assert that is
|
||||
* triggered will be in trcAssert.c.
|
||||
*/
|
||||
#define TRC_CFG_USE_TRACE_ASSERT 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TRC_CONFIG_H */
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Configuration parameters for the kernel port.
|
||||
* More settings can be found in trcKernelPortStreamingConfig.h and
|
||||
* trcKernelPortSnapshotConfig.h.
|
||||
*/
|
||||
|
||||
#ifndef TRC_KERNEL_PORT_CONFIG_H
|
||||
#define TRC_KERNEL_PORT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_RECORDER_MODE
|
||||
* @brief Specify what recording mode to use. Snapshot means that the data is saved in
|
||||
* an internal RAM buffer, for later upload. Streaming means that the data is
|
||||
* transferred continuously to the host PC.
|
||||
*
|
||||
* For more information, see http://percepio.com/2016/10/05/rtos-tracing/
|
||||
* and the Tracealyzer User Manual.
|
||||
*
|
||||
* Values:
|
||||
* TRC_RECORDER_MODE_SNAPSHOT
|
||||
* TRC_RECORDER_MODE_STREAMING
|
||||
*/
|
||||
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_FREERTOS_VERSION
|
||||
* @brief Specify what version of FreeRTOS that is used (don't change unless using the
|
||||
* trace recorder library with an older version of FreeRTOS).
|
||||
*
|
||||
* TRC_FREERTOS_VERSION_7_3_X If using FreeRTOS v7.3.X
|
||||
* TRC_FREERTOS_VERSION_7_4_X If using FreeRTOS v7.4.X
|
||||
* TRC_FREERTOS_VERSION_7_5_X If using FreeRTOS v7.5.X
|
||||
* TRC_FREERTOS_VERSION_7_6_X If using FreeRTOS v7.6.X
|
||||
* TRC_FREERTOS_VERSION_8_X_X If using FreeRTOS v8.X.X
|
||||
* TRC_FREERTOS_VERSION_9_0_0 If using FreeRTOS v9.0.0
|
||||
* TRC_FREERTOS_VERSION_9_0_1 If using FreeRTOS v9.0.1
|
||||
* TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2
|
||||
* TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0
|
||||
* TRC_FREERTOS_VERSION_10_0_1 If using FreeRTOS v10.0.1
|
||||
* TRC_FREERTOS_VERSION_10_1_0 If using FreeRTOS v10.1.0
|
||||
* TRC_FREERTOS_VERSION_10_1_1 If using FreeRTOS v10.1.1
|
||||
* TRC_FREERTOS_VERSION_10_2_0 If using FreeRTOS v10.2.0
|
||||
* TRC_FREERTOS_VERSION_10_2_1 If using FreeRTOS v10.2.1
|
||||
* TRC_FREERTOS_VERSION_10_3_0 If using FreeRTOS v10.3.0
|
||||
* TRC_FREERTOS_VERSION_10_3_1 If using FreeRTOS v10.3.1
|
||||
* TRC_FREERTOS_VERSION_10_4_0 If using FreeRTOS v10.4.0
|
||||
* TRC_FREERTOS_VERSION_10_4_1 If using FreeRTOS v10.4.1 or later
|
||||
*/
|
||||
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_4_1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any "event group" events.
|
||||
*
|
||||
* Default value is 0 (excluded) since dependent on event_groups.c
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_TIMER_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any Timer events.
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_TIMER_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
|
||||
* @brief 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"
|
||||
* events, such as xTimerPendFunctionCall().
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any stream buffer or message
|
||||
* buffer events.
|
||||
*
|
||||
* Default value is 0 since dependent on stream_buffer.c (new in FreeRTOS v10)
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_ACKNOWLEDGE_QUEUE_SET_SEND
|
||||
* @brief When using FreeRTOS v10.3.0 or v10.3.1, please make sure that the trace
|
||||
* point in prvNotifyQueueSetContainer() in queue.c is renamed from
|
||||
* traceQUEUE_SEND to traceQUEUE_SET_SEND in order to tell them apart from
|
||||
* other traceQUEUE_SEND trace points. Then set this to TRC_ACKNOWLEDGED.
|
||||
*/
|
||||
#define TRC_CFG_ACKNOWLEDGE_QUEUE_SET_SEND 0 /* TRC_ACKNOWLEDGED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_KERNEL_PORT_CONFIG_H */
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Kernel port configuration parameters for snapshot mode.
|
||||
*/
|
||||
|
||||
#ifndef TRC_KERNEL_PORT_SNAPSHOT_CONFIG_H
|
||||
#define TRC_KERNEL_PORT_SNAPSHOT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...
|
||||
* @brief A group of macros which should be defined as integer values, zero or larger.
|
||||
*
|
||||
* These define the capacity of the Object Property Table, i.e., the maximum
|
||||
* number of objects active at any given point, within each object class (e.g.,
|
||||
* task, queue, semaphore, ...).
|
||||
*
|
||||
* If tasks or other objects are deleted in your system, this
|
||||
* setting does not limit the total amount of objects created, only the number
|
||||
* of objects that have been successfully created but not yet deleted.
|
||||
*
|
||||
* Using too small values will cause vTraceError to be called, which stores an
|
||||
* error message in the trace that is shown when opening the trace file. The
|
||||
* error message can also be retrieved using xTraceGetLastError.
|
||||
*
|
||||
* It can be wise to start with large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage by selecting View menu -> Trace Details ->
|
||||
* Resource Usage -> Object Table.
|
||||
*/
|
||||
#define TRC_CFG_NTASK 150
|
||||
#define TRC_CFG_NISR 90
|
||||
#define TRC_CFG_NQUEUE 90
|
||||
#define TRC_CFG_NSEMAPHORE 90
|
||||
#define TRC_CFG_NMUTEX 90
|
||||
#define TRC_CFG_NTIMER 250
|
||||
#define TRC_CFG_NEVENTGROUP 90
|
||||
#define TRC_CFG_NSTREAMBUFFER 50
|
||||
#define TRC_CFG_NMESSAGEBUFFER 50
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...
|
||||
* @brief Macros that specify the maximum lengths (number of characters) for names of
|
||||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*/
|
||||
#define TRC_CFG_NAME_LEN_TASK 15
|
||||
#define TRC_CFG_NAME_LEN_ISR 15
|
||||
#define TRC_CFG_NAME_LEN_QUEUE 15
|
||||
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
|
||||
#define TRC_CFG_NAME_LEN_MUTEX 15
|
||||
#define TRC_CFG_NAME_LEN_TIMER 15
|
||||
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
|
||||
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_KERNEL_PORT_SNAPSHOT_CONFIG_H */
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* Trace Recorder for Tracealyzer v4.6.0
|
||||
* Copyright 2021 Percepio AB
|
||||
* www.percepio.com
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Configuration parameters for trace recorder library in snapshot mode.
|
||||
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
|
||||
*/
|
||||
|
||||
#ifndef TRC_SNAPSHOT_CONFIG_H
|
||||
#define TRC_SNAPSHOT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SNAPSHOT_MODE
|
||||
* @brief Macro which should be defined as one of:
|
||||
* - TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL
|
||||
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the
|
||||
* events are stored in a ring buffer, i.e., where the oldest events are
|
||||
* overwritten when the buffer becomes full. This allows you to get the last
|
||||
* events leading up to an interesting state, e.g., an error, without having
|
||||
* to store the whole run since startup.
|
||||
*
|
||||
* When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the
|
||||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*/
|
||||
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_EVENT_BUFFER_SIZE
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the event buffer, i.e., the number of records
|
||||
* it may store. Most events use one record (4 byte), although some events
|
||||
* require multiple 4-byte records. You should adjust this to the amount of RAM
|
||||
* available in the target system.
|
||||
*
|
||||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
*/
|
||||
#define TRC_CFG_EVENT_BUFFER_SIZE 50000
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_INCLUDE_FLOAT_SUPPORT
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the support for logging floating point values in
|
||||
* vTracePrintF is stripped out, in case floating point values are not used or
|
||||
* supported by the platform used.
|
||||
*
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* allow for storing float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 0.
|
||||
*/
|
||||
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SYMBOL_TABLE_SIZE
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* stores User Events labels and names of deleted tasks, queues, or other kernel
|
||||
* objects. If you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value. The minimum recommended value is 4.
|
||||
* A size of zero (0) is not allowed since a zero-sized array may result in a
|
||||
* 32-bit pointer, i.e., using 4 bytes rather than 0.
|
||||
*
|
||||
* Default value is 800.
|
||||
*/
|
||||
#define TRC_CFG_SYMBOL_TABLE_SIZE 8000
|
||||
|
||||
#if ( TRC_CFG_SYMBOL_TABLE_SIZE == 0 )
|
||||
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
******************************************************************************
|
||||
* The remaining settings are not necessary to modify but allows for optimizing
|
||||
* the recorder setup for your specific needs, e.g., to exclude events that you
|
||||
* are not interested in, in order to get longer traces.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_HEAP_SIZE_BELOW_16M
|
||||
* @brief An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with reported addresses showing the
|
||||
* lower 24 bits only. If 0, you get the full 32-bit addresses.
|
||||
*
|
||||
* Default value is 0.
|
||||
*/
|
||||
#define TRC_CFG_HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_IMPLICIT_IFE_RULES
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into "instances" based on Instance Finish
|
||||
* Events (IFEs), produced either by default rules or calls to the recorder
|
||||
* functions xTraceTaskInstanceFinishedNow and xTraceTaskInstanceFinishedNext.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is
|
||||
* used, resulting in a "typical" grouping of events into instances.
|
||||
* If these rules don't give appropriate instances in your case, you can
|
||||
* override the default rules using xTraceTaskInstanceFinishedNow/Next for one
|
||||
* or several tasks. The default IFE rules are then disabled for those tasks.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are
|
||||
* disabled globally. You must then call xTraceTaskInstanceFinishedNow or
|
||||
* xTraceTaskInstanceFinishedNext to manually group the events into instances,
|
||||
* otherwise the tasks will appear a single long instance.
|
||||
*
|
||||
* The default IFE rules count the following events as "instance finished":
|
||||
* - Task delay, delay until
|
||||
* - Task suspend
|
||||
* - Blocking on "input" operations, i.e., when the task is waiting for the
|
||||
* next a message/signal/event. But only if this event is blocking.
|
||||
*/
|
||||
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_16BIT_OBJECT_HANDLES
|
||||
* @brief Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (tasks, queues, mutexes,
|
||||
* etc.) Note: 255, not 256, since handle 0 is reserved.
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* Default is 0 (8-bit handles)
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever the object is referenced. Moreover, some internal
|
||||
* tables in the recorder gets slightly larger when using 16-bit handles.
|
||||
*/
|
||||
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the
|
||||
* separate user event buffer (UB).
|
||||
* In this mode, user events are stored separately from other events,
|
||||
* e.g., RTOS events. Thereby you can get a much longer history of
|
||||
* user events as they don't need to share the buffer space with more
|
||||
* frequent events.
|
||||
*
|
||||
* The UB is typically used with the snapshot ring-buffer mode, so the
|
||||
* recording can continue when the main buffer gets full. And since the
|
||||
* main buffer then overwrites the earliest events, Tracealyzer displays
|
||||
* "Unknown Actor" instead of task scheduling for periods with UB data only.
|
||||
*
|
||||
* In UB mode, user events are structured as UB channels, which contains
|
||||
* a channel name and a default format string. Register a UB channel using
|
||||
* xTraceRegisterUBChannel.
|
||||
*
|
||||
* Events and data arguments are written using vTraceUBEvent and
|
||||
* vTraceUBData. They are designed to provide efficient logging of
|
||||
* repeating events, using the same format string within each channel.
|
||||
*
|
||||
* Examples:
|
||||
* TraceStringHandle_t chn1;
|
||||
* TraceStringHandle_t fmt1;
|
||||
* xTraceStringRegister("Channel 1", &chn1);
|
||||
* xTraceStringRegister("Event!", &fmt1);
|
||||
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);
|
||||
*
|
||||
* TraceStringHandle_t chn2;
|
||||
* TraceStringHandle_t fmt2;
|
||||
* xTraceStringRegister("Channel 2", &chn2);
|
||||
* xTraceStringRegister("X: %d, Y: %d", &fmt2);
|
||||
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);
|
||||
*
|
||||
* // Result in "[Channel 1] Event!"
|
||||
* vTraceUBEvent(UBCh1);
|
||||
*
|
||||
* // Result in "[Channel 2] X: 23, Y: 19"
|
||||
* vTraceUBData(UBCh2, 23, 19);
|
||||
*
|
||||
* You can also use the other user event functions, like xTracePrintF.
|
||||
* as they are then rerouted to the UB instead of the main event buffer.
|
||||
* vTracePrintF then looks up the correct UB channel based on the
|
||||
* provided channel name and format string, or creates a new UB channel
|
||||
* if no match is found. The format string should therefore not contain
|
||||
* "random" messages but mainly format specifiers. Random strings should
|
||||
* be stored using %s and with the string as an argument.
|
||||
*
|
||||
* // Creates a new UB channel ("Channel 2", "%Z: %d")
|
||||
* xTracePrintF(chn2, "%Z: %d", value1);
|
||||
*
|
||||
* // Finds the existing UB channel
|
||||
* xTracePrintF(chn2, "%Z: %d", value2);
|
||||
*/
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the user event buffer (UB), in number of slots.
|
||||
* A single user event can use multiple slots, depending on the arguments.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
*/
|
||||
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
|
||||
|
||||
/**
|
||||
* @def TRC_CFG_UB_CHANNELS
|
||||
* @brief Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the number of User Event Buffer Channels (UB channels).
|
||||
* These are used to structure the events when using the separate user
|
||||
* event buffer, and contains both a User Event Channel (the name) and
|
||||
* a default format string for the channel.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
*/
|
||||
#define TRC_CFG_UB_CHANNELS 32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*TRC_SNAPSHOT_CONFIG_H*/
|
|
@ -56,6 +56,7 @@
|
|||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/select.h>
|
||||
#include <time.h>
|
||||
|
@ -84,7 +85,7 @@
|
|||
#ifdef USER_DEMO
|
||||
#define mainSELECTED_APPLICATION USER_DEMO
|
||||
#else /* Default Setting */
|
||||
#define mainSELECTED_APPLICATION BLINKY_DEMO
|
||||
#define mainSELECTED_APPLICATION FULL_DEMO
|
||||
#endif
|
||||
|
||||
/* This demo uses heap_3.c (the libc provided malloc() and free()). */
|
||||
|
@ -146,7 +147,6 @@ StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
|||
#endif
|
||||
|
||||
static clockid_t cid = CLOCK_THREAD_CPUTIME_ID;
|
||||
static uint32_t frequency;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -287,7 +287,7 @@ void traceOnEnter()
|
|||
}
|
||||
|
||||
/* clear the buffer */
|
||||
char buffer[ 0 ];
|
||||
char buffer[ 1 ];
|
||||
read( STDIN_FILENO, &buffer, 1 );
|
||||
}
|
||||
#endif /* if ( TRACE_ON_ENTER == 1 ) */
|
||||
|
@ -359,7 +359,6 @@ static void prvSaveTraceFile( void )
|
|||
#if ( projCOVERAGE_TEST != 1 )
|
||||
{
|
||||
FILE * pxOutputFile;
|
||||
extern RecorderDataType* RecorderDataPtr;
|
||||
|
||||
vTraceStop();
|
||||
|
||||
|
@ -446,57 +445,20 @@ void handle_sigint( int signal )
|
|||
exit( 2 );
|
||||
}
|
||||
|
||||
static uint32_t ulEntryTime = 0;
|
||||
|
||||
void vTraceTimerReset( void )
|
||||
{
|
||||
int xRet;
|
||||
struct timespec ts;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 0;
|
||||
|
||||
xRet = clock_settime( cid, &ts );
|
||||
if( xRet != 0 )
|
||||
{
|
||||
printf( "Could not reset time: %s\n", strerror( errno ) );
|
||||
}
|
||||
ulEntryTime = xTaskGetTickCount();
|
||||
}
|
||||
|
||||
uint32_t uiTraceTimerGetFrequency( void )
|
||||
{
|
||||
struct timespec res;
|
||||
int xRet;
|
||||
|
||||
res.tv_nsec = 0;
|
||||
res.tv_sec = 0;
|
||||
|
||||
xRet = clock_getres( cid, &res );
|
||||
if( xRet == 0 )
|
||||
{
|
||||
// calculate frequency from timer definition
|
||||
frequency = (uint64_t) 1000000000 / res.tv_nsec;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Could not get clock frequency: %s\n", strerror( errno ) );
|
||||
}
|
||||
return frequency;
|
||||
return configTICK_RATE_HZ;
|
||||
}
|
||||
|
||||
uint32_t uiTraceTimerGetValue( void )
|
||||
{
|
||||
int xRet;
|
||||
struct timespec tp;
|
||||
uint32_t result = 0;
|
||||
|
||||
xRet = clock_gettime( cid, &tp );
|
||||
if( xRet == 0 )
|
||||
{
|
||||
result = tp.tv_nsec / frequency;
|
||||
result += (tp.tv_sec * 1000000000) / frequency;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Could not get time: %s\n", strerror( errno ) );
|
||||
}
|
||||
return result;
|
||||
return ( xTaskGetTickCount() - ulEntryTime );
|
||||
}
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ static void prvCheckTask( void * pvParameters )
|
|||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
printf( "%s - tick count %u \r\n",
|
||||
printf( "%s - tick count %lu \r\n",
|
||||
pcStatusMessage,
|
||||
xTaskGetTickCount() );
|
||||
|
||||
|
|
|
@ -1,378 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcSnapshotConfig.h
|
||||
*
|
||||
* Configuration parameters for trace recorder library in snapshot mode.
|
||||
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
|
||||
*
|
||||
* Terms of Use
|
||||
* This file is part of the trace recorder library (RECORDER), which is the
|
||||
* intellectual property of Percepio AB (PERCEPIO) and provided under a
|
||||
* license as follows.
|
||||
* The RECORDER may be used free of charge for the purpose of recording data
|
||||
* intended for analysis in PERCEPIO products. It may not be used or modified
|
||||
* for other purposes without explicit permission from PERCEPIO.
|
||||
* 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
|
||||
* specific processor, processor family or with a specific communication
|
||||
* interface. Any such modifications should be documented directly below
|
||||
* 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
|
||||
* 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.
|
||||
* In no event will PERCEPIO, its technology partners, or distributors be liable
|
||||
* to you for any consequential, incidental or special damages, including any
|
||||
* lost profits or lost savings, even if a representative of PERCEPIO has been
|
||||
* advised of the possibility of such damages, or for any claim by any third
|
||||
* party. Some jurisdictions do not allow the exclusion or limitation of
|
||||
* incidental, consequential or special damages, or the exclusion of implied
|
||||
* warranties or limitations on how long an implied warranty may last, so the
|
||||
* above limitations may not apply to you.
|
||||
*
|
||||
* Tabs are used for indent in this file (1 tab = 4 spaces)
|
||||
*
|
||||
* Copyright Percepio AB, 2017.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRC_SNAPSHOT_CONFIG_H
|
||||
#define TRC_SNAPSHOT_CONFIG_H
|
||||
|
||||
#define TRC_SNAPSHOT_MODE_RING_BUFFER ( 0x01 )
|
||||
#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL ( 0x02 )
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_SNAPSHOT_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
* - TRC_SNAPSHOT_MODE_STOP_WHEN_FULL
|
||||
* Default is TRC_SNAPSHOT_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRC_CFG_SNAPSHOT_MODE set to TRC_SNAPSHOT_MODE_RING_BUFFER, the
|
||||
* events are stored in a ring buffer, i.e., where the oldest events are
|
||||
* overwritten when the buffer becomes full. This allows you to get the last
|
||||
* events leading up to an interesting state, e.g., an error, without having
|
||||
* to store the whole run since startup.
|
||||
*
|
||||
* When TRC_CFG_SNAPSHOT_MODE is TRC_SNAPSHOT_MODE_STOP_WHEN_FULL, the
|
||||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_EVENT_BUFFER_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the event buffer, i.e., the number of records
|
||||
* it may store. Most events use one record (4 byte), although some events
|
||||
* require multiple 4-byte records. You should adjust this to the amount of RAM
|
||||
* available in the target system.
|
||||
*
|
||||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_EVENT_BUFFER_SIZE 32000
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...
|
||||
*
|
||||
* A group of macros which should be defined as integer values, zero or larger.
|
||||
*
|
||||
* These define the capacity of the Object Property Table, i.e., the maximum
|
||||
* number of objects active at any given point, within each object class (e.g.,
|
||||
* task, queue, semaphore, ...).
|
||||
*
|
||||
* If tasks or other objects are deleted in your system, this
|
||||
* setting does not limit the total amount of objects created, only the number
|
||||
* of objects that have been successfully created but not yet deleted.
|
||||
*
|
||||
* Using too small values will cause vTraceError to be called, which stores an
|
||||
* error message in the trace that is shown when opening the trace file. The
|
||||
* error message can also be retrieved using xTraceGetLastError.
|
||||
*
|
||||
* It can be wise to start with large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage by selecting View menu -> Trace Details ->
|
||||
* Resource Usage -> Object Table.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_NTASK 150
|
||||
#define TRC_CFG_NISR 90
|
||||
#define TRC_CFG_NQUEUE 90
|
||||
#define TRC_CFG_NSEMAPHORE 90
|
||||
#define TRC_CFG_NMUTEX 90
|
||||
#define TRC_CFG_NTIMER 250
|
||||
#define TRC_CFG_NEVENTGROUP 90
|
||||
#define TRC_CFG_NSTREAMBUFFER 100
|
||||
#define TRC_CFG_NMESSAGEBUFFER 100
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the support for logging floating point values in
|
||||
* vTracePrintF is stripped out, in case floating point values are not used or
|
||||
* supported by the platform used.
|
||||
*
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* allow for storing float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 0.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SYMBOL_TABLE_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* stores User Events labels and names of deleted tasks, queues, or other kernel
|
||||
* objects. If you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value. The minimum recommended value is 4.
|
||||
* A size of zero (0) is not allowed since a zero-sized array may result in a
|
||||
* 32-bit pointer, i.e., using 4 bytes rather than 0.
|
||||
*
|
||||
* Default value is 800.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SYMBOL_TABLE_SIZE 32000
|
||||
|
||||
#if ( TRC_CFG_SYMBOL_TABLE_SIZE == 0 )
|
||||
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_NAME_LEN_TASK, TRC_CFG_NAME_LEN_QUEUE, ...
|
||||
*
|
||||
* Macros that specify the maximum lengths (number of characters) for names of
|
||||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_NAME_LEN_TASK 15
|
||||
#define TRC_CFG_NAME_LEN_ISR 15
|
||||
#define TRC_CFG_NAME_LEN_QUEUE 15
|
||||
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
|
||||
#define TRC_CFG_NAME_LEN_MUTEX 15
|
||||
#define TRC_CFG_NAME_LEN_TIMER 15
|
||||
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
|
||||
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
******************************************************************************
|
||||
* The remaining settings are not necessary to modify but allows for optimizing
|
||||
* the recorder setup for your specific needs, e.g., to exclude events that you
|
||||
* are not interested in, in order to get longer traces.
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_HEAP_SIZE_BELOW_16M
|
||||
*
|
||||
* An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with reported addresses showing the
|
||||
* lower 24 bits only. If 0, you get the full 32-bit addresses.
|
||||
*
|
||||
* Default value is 0.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into "instances" based on Instance Finish
|
||||
* Events (IFEs), produced either by default rules or calls to the recorder
|
||||
* functions vTraceInstanceFinishedNow and vTraceInstanceFinishedNext.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is one (1), the default IFE rules is
|
||||
* used, resulting in a "typical" grouping of events into instances.
|
||||
* If these rules don't give appropriate instances in your case, you can
|
||||
* override the default rules using vTraceInstanceFinishedNow/Next for one
|
||||
* or several tasks. The default IFE rules are then disabled for those tasks.
|
||||
*
|
||||
* If TRC_CFG_USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFE rules are
|
||||
* disabled globally. You must then call vTraceInstanceFinishedNow or
|
||||
* vTraceInstanceFinishedNext to manually group the events into instances,
|
||||
* otherwise the tasks will appear a single long instance.
|
||||
*
|
||||
* The default IFE rules count the following events as "instance finished":
|
||||
* - Task delay, delay until
|
||||
* - Task suspend
|
||||
* - Blocking on "input" operations, i.e., when the task is waiting for the
|
||||
* next a message/signal/event. But only if this event is blocking.
|
||||
*
|
||||
* For details, see trcSnapshotKernelPort.h and look for references to the
|
||||
* macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_16BIT_OBJECT_HANDLES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (tasks, queues, mutexes,
|
||||
* etc.) Note: 255, not 256, since handle 0 is reserved.
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* Default is 0 (8-bit handles)
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever the object is referenced. Moreover, some internal
|
||||
* tables in the recorder gets slightly larger when using 16-bit handles.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is one (1), the TRACE_ASSERT macro (used at various locations in the
|
||||
* trace recorder) will verify that a relevant condition is true.
|
||||
* If the condition is false, prvTraceError() will be called, which stops the
|
||||
* recording and stores an error message that is displayed when opening the
|
||||
* trace in Tracealyzer.
|
||||
*
|
||||
* This is used on several places in the recorder code for sanity checks on
|
||||
* parameters. Can be switched off to reduce the footprint of the tracing, but
|
||||
* we recommend to have it enabled initially.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_TRACE_ASSERT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* Set TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER to 1 to enable the
|
||||
* separate user event buffer (UB).
|
||||
* In this mode, user events are stored separately from other events,
|
||||
* e.g., RTOS events. Thereby you can get a much longer history of
|
||||
* user events as they don't need to share the buffer space with more
|
||||
* frequent events.
|
||||
*
|
||||
* The UB is typically used with the snapshot ring-buffer mode, so the
|
||||
* recording can continue when the main buffer gets full. And since the
|
||||
* main buffer then overwrites the earliest events, Tracealyzer displays
|
||||
* "Unknown Actor" instead of task scheduling for periods with UB data only.
|
||||
*
|
||||
* In UB mode, user events are structured as UB channels, which contains
|
||||
* a channel name and a default format string. Register a UB channel using
|
||||
* xTraceRegisterUBChannel.
|
||||
*
|
||||
* Events and data arguments are written using vTraceUBEvent and
|
||||
* vTraceUBData. They are designed to provide efficient logging of
|
||||
* repeating events, using the same format string within each channel.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* traceString chn1 = xTraceRegisterString("Channel 1");
|
||||
* traceString fmt1 = xTraceRegisterString("Event!");
|
||||
* traceUBChannel UBCh1 = xTraceRegisterUBChannel(chn1, fmt1);
|
||||
*
|
||||
* traceString chn2 = xTraceRegisterString("Channel 2");
|
||||
* traceString fmt2 = xTraceRegisterString("X: %d, Y: %d");
|
||||
* traceUBChannel UBCh2 = xTraceRegisterUBChannel(chn2, fmt2);
|
||||
*
|
||||
* // Result in "[Channel 1] Event!"
|
||||
* vTraceUBEvent(UBCh1);
|
||||
*
|
||||
* // Result in "[Channel 2] X: 23, Y: 19"
|
||||
* vTraceUBData(UBCh2, 23, 19);
|
||||
*
|
||||
* You can also use the other user event functions, like vTracePrintF.
|
||||
* as they are then rerouted to the UB instead of the main event buffer.
|
||||
* vTracePrintF then looks up the correct UB channel based on the
|
||||
* provided channel name and format string, or creates a new UB channel
|
||||
* if no match is found. The format string should therefore not contain
|
||||
* "random" messages but mainly format specifiers. Random strings should
|
||||
* be stored using %s and with the string as an argument.
|
||||
*
|
||||
* // Creates a new UB channel ("Channel 2", "%Z: %d")
|
||||
* vTracePrintF(chn2, "%Z: %d", value1);
|
||||
*
|
||||
* // Finds the existing UB channel
|
||||
* vTracePrintF(chn2, "%Z: %d", value2);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the user event buffer (UB), in number of slots.
|
||||
* A single user event can use multiple slots, depending on the arguments.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_UB_CHANNELS
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the number of User Event Buffer Channels (UB channels).
|
||||
* These are used to structure the events when using the separate user
|
||||
* event buffer, and contains both a User Event Channel (the name) and
|
||||
* a default format string for the channel.
|
||||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_UB_CHANNELS 32
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* If tracing multiple ISRs, this setting allows for accurate display of the
|
||||
* context-switching also in cases when the ISRs execute in direct sequence.
|
||||
*
|
||||
* vTraceStoreISREnd normally assumes that the ISR returns to the previous
|
||||
* context, i.e., a task or a preempted ISR. But if another traced ISR
|
||||
* executes in direct sequence, Tracealyzer may incorrectly display a minimal
|
||||
* fragment of the previous context in between the ISRs.
|
||||
*
|
||||
* By using TRC_CFG_ISR_TAILCHAINING_THRESHOLD you can avoid this. This is
|
||||
* however a threshold value that must be measured for your specific setup.
|
||||
* See http://percepio.com/2014/03/21/isr_tailchaining_threshold/
|
||||
*
|
||||
* The default setting is 0, meaning "disabled" and that you may get an
|
||||
* extra fragments of the previous context in between tail-chained ISRs.
|
||||
*
|
||||
* Note: This setting has separate definitions in trcSnapshotConfig.h and
|
||||
* trcStreamingConfig.h, since it is affected by the recorder mode.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
|
||||
|
||||
#endif /*TRC_SNAPSHOT_CONFIG_H*/
|
|
@ -631,6 +631,7 @@ ecdhe
|
|||
ecdsa
|
||||
echobuffer
|
||||
echomultitx
|
||||
echoservertaskbuffer
|
||||
ecjpake
|
||||
ecmd
|
||||
ecp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue