mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-08-21 07:18:22 +08:00
Update to the latest trace recorder library.
This commit is contained in:
@@ -1,477 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcConfig.h
|
||||
*
|
||||
* Configuration parameters for the trace recorder library. Before using the
|
||||
* trace recorder library, please check that the default settings are
|
||||
* appropriate for your system, and if necessary adjust these. Most likely, you
|
||||
* will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to
|
||||
* reflect the number of such objects in your system. These may be
|
||||
* over-approximated, although larger values values implies more RAM usage.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcHardwarePort.c/.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB 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 AB, 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 AB 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, 2014.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCCONFIG_H
|
||||
#define TRCCONFIG_H
|
||||
|
||||
/******************************************************************************
|
||||
* SELECTED_PORT
|
||||
*
|
||||
* Macro that specifies what hardware port that should be used.
|
||||
* Available ports are:
|
||||
*
|
||||
* Port Name Code Official OS supported
|
||||
* PORT_APPLICATION_DEFINED -2 - -
|
||||
* PORT_NOT_SET -1 - -
|
||||
* PORT_HWIndependent 0 Yes Any
|
||||
* PORT_Win32 1 Yes FreeRTOS on Win32
|
||||
* PORT_Atmel_AT91SAM7 2 No Any
|
||||
* PORT_Atmel_UC3A0 3 No Any
|
||||
* PORT_ARM_CortexM 4 Yes Any
|
||||
* PORT_Renesas_RX600 5 Yes Any
|
||||
* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any
|
||||
* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any
|
||||
* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any
|
||||
* PORT_MICROCHIP_PIC32MX 9 Yes Any
|
||||
* PORT_XILINX_PPC405 10 No FreeRTOS
|
||||
* PORT_XILINX_PPC440 11 No FreeRTOS
|
||||
* PORT_XILINX_MICROBLAZE 12 No Any
|
||||
* PORT_NXP_LPC210X 13 No Any
|
||||
* PORT_MICROCHIP_PIC32MZ 14 Yes Any
|
||||
* PORT_ARM_CORTEX_A9 15 No Any
|
||||
* PORT_ARM_CORTEX_M0 16 Yes Any
|
||||
*****************************************************************************/
|
||||
|
||||
// Set the port setting here!
|
||||
#define SELECTED_PORT PORT_NOT_SET
|
||||
|
||||
#if (SELECTED_PORT == PORT_ARM_CortexM)
|
||||
/* For ARM Cortex-M: make sure ARM's CMSIS library is included here, which
|
||||
is used for accessing the PRIMASK register. e.g. #include "board.h" */
|
||||
#endif
|
||||
|
||||
|
||||
#if (SELECTED_PORT == PORT_NOT_SET)
|
||||
#error "You need to define SELECTED_PORT here!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* FREERTOS_VERSION
|
||||
*
|
||||
* Specify what version of FreeRTOS that is used. This is necessary compensate
|
||||
* for renamed symbols in the FreeRTOS kernel (does not build if incorrect).
|
||||
*
|
||||
* FREERTOS_VERSION_7_3_OR_7_4 (= 1) If using FreeRTOS v7.3.0 - v7.4.2
|
||||
* FREERTOS_VERSION_7_5_OR_7_6 (= 2) If using FreeRTOS v7.5.0 - v7.6.0
|
||||
* FREERTOS_VERSION_8_0_OR_LATER (= 3) If using FreeRTOS v8.0.0 or later
|
||||
*****************************************************************************/
|
||||
#define FREERTOS_VERSION FREERTOS_VERSION_8_0_OR_LATER
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRACE_STORE_MODE_RING_BUFFER
|
||||
* - TRACE_STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is TRACE_STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_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 TRACE_RECORDER_STORE_MODE is TRACE_STORE_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 TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
|
||||
|
||||
/*******************************************************************************
|
||||
* TRACE_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.
|
||||
*
|
||||
* For users of "Free Edition", that only displays scheduling events, this
|
||||
* option can be used to avoid storing other events.
|
||||
*
|
||||
* Default value is 0 (store all enabled events).
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRACE_SCHEDULING_ONLY 0
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 EVENT_BUFFER_SIZE 1000
|
||||
|
||||
/*******************************************************************************
|
||||
* NTask, NISR, NQueue, NSemaphore, NMutex
|
||||
*
|
||||
* 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 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.
|
||||
*
|
||||
* 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 NTask 15
|
||||
#define NISR 5
|
||||
#define NQueue 10
|
||||
#define NSemaphore 10
|
||||
#define NMutex 10
|
||||
#define NTimer 2
|
||||
#define NEventGroup 2
|
||||
|
||||
/******************************************************************************
|
||||
* 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 to
|
||||
* exclude malloc/free calls, or one (1) to include such events in the trace.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_USER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0) the code for creating User Events is excluded to
|
||||
* reduce code size. User Events are application-generated events, like
|
||||
* "printf" but for the trace log instead of console output. User Events are
|
||||
* much faster than a printf and can therefore be used in timing critical code.
|
||||
* See vTraceUserEvent() and vTracePrintF() in trcUser.h
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note that User Events are only displayed in Professional Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* 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 to reduce code size.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note, if the kernel has no central interrupt dispatcher, recording ISRs
|
||||
* require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
|
||||
* in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_ISR_TRACING 1
|
||||
|
||||
/*****************************************************************************
|
||||
* 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 uses a lot of space in the event buffer, so excluding "ready events"
|
||||
* will allow for longer traces. Including ready events however allows for
|
||||
* showing the initial pending time before tasks enter the execution state, and
|
||||
* for presenting accurate response times.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_NEW_TIME_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (1), events will be generated whenever the OS clock is
|
||||
* increased.
|
||||
*
|
||||
* Default value is 0.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_NEW_TIME_EVENTS 0
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), all references to floating point values are removed,
|
||||
* in case floating point values are not supported by the platform used.
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* store float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_FLOAT_SUPPORT 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_OBJECT_DELETE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime. If no deletes are made, this
|
||||
* can be set to 0 in order to exclude the delete-handling code.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 SYMBOL_TABLE_SIZE 800
|
||||
|
||||
#if (SYMBOL_TABLE_SIZE == 0)
|
||||
#error "SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* NameLenTask, NameLenQueue, ...
|
||||
*
|
||||
* 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 NameLenTask 15
|
||||
#define NameLenISR 15
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
#define NameLenTimer 15
|
||||
#define NameLenEventGroup 15
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DATA_ALLOCATION
|
||||
*
|
||||
* This defines how to allocate the recorder data structure, i.e., using a
|
||||
* static declaration or using a dynamic allocation in runtime (malloc).
|
||||
*
|
||||
* Should be one of these two options:
|
||||
* - TRACE_DATA_ALLOCATION_STATIC (default)
|
||||
* - TRACE_DATA_ALLOCATION_DYNAMIC
|
||||
*
|
||||
* Using static allocation has the benefits of compile-time errors if the buffer
|
||||
* is too large (too large constants in trcConfig.h) and no need to call the
|
||||
* initialization routine (xTraceInitTraceData).
|
||||
*
|
||||
* Using dynamic allocation may give more flexibility in some cases.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*** 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.
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* 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 HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_LINKER_PRAGMA
|
||||
*
|
||||
* Macro which should be defined as an integer value, default is 0.
|
||||
*
|
||||
* If this is 1, the header file "recorderdata_linker_pragma.h" is included just
|
||||
* before the declaration of RecorderData (in trcBase.c), i.e., the trace data
|
||||
* structure. This allows the user to specify a pragma with linker options.
|
||||
*
|
||||
* Example (for IAR Embedded Workbench and NXP LPC17xx):
|
||||
* #pragma location="AHB_RAM_MEMORY"
|
||||
*
|
||||
* This example instructs the IAR linker to place RecorderData in another RAM
|
||||
* bank, the AHB RAM. This can also be used for other compilers with a similar
|
||||
* pragmas for linker options.
|
||||
*
|
||||
* Note that this only applies if using static allocation, see below.
|
||||
******************************************************************************/
|
||||
#define USE_LINKER_PRAGMA 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into actor instances, based on context-switches
|
||||
* and a definition of "Instance Finish Events", or IFEs. These are kernel calls
|
||||
* considered to be the last event in a task instance. Some kernel calls are
|
||||
* considered IFEs by default (e.g., delay functions), but it is also possible
|
||||
* to specify this individually for each task (see vTraceTaskInstanceFinish).
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which
|
||||
* gives a "typical" grouping of events into instances. You can combine this
|
||||
* with calls to vTraceTaskInstanceFinish for specific tasks.
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all
|
||||
* events withing each task is then shown as a single instance, unless you call
|
||||
* vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.
|
||||
*****************************************************************************/
|
||||
#define USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/******************************************************************************
|
||||
* 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 (object class).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever referenced. Moreover, some internal tables in the
|
||||
* recorder gets larger when using 16-bit handles. The additional RAM usage is
|
||||
* 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.
|
||||
*****************************************************************************/
|
||||
#define USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/******************************************************************************
|
||||
* 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 will verify that a condition is
|
||||
* true. If the condition is false, vTraceError() will be called.
|
||||
* This is used on several places in the recorder code for sanity checks on
|
||||
* parameters. Can be switched off to reduce CPU usage of the tracing.
|
||||
*****************************************************************************/
|
||||
#define USE_TRACE_ASSERT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* USE_SEPARATE_USER_EVENT_BUFFER
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
* Default is zero (0).
|
||||
*
|
||||
* This enables and disables the use of the separate user event buffer. Using
|
||||
* this separate buffer has the benefit of not overwriting the user events with
|
||||
* kernel events (usually generated at a much higher rate), i.e., when using
|
||||
* ring-buffer mode.
|
||||
*
|
||||
* Note: When using the separate user event buffer, you may get an artificial
|
||||
* task instance named "Unknown actor". This is added as a placeholder when the
|
||||
* user event history is longer than the task scheduling history.
|
||||
******************************************************************************/
|
||||
#define USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
||||
/*******************************************************************************
|
||||
* USER_EVENT_BUFFER_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the user event buffer, in number of slots.
|
||||
* A single user event can use between 1 and X slots, depending on the data.
|
||||
*
|
||||
* Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
|
||||
******************************************************************************/
|
||||
#define USER_EVENT_BUFFER_SIZE 10
|
||||
|
||||
/*******************************************************************************
|
||||
* USER_EVENT_CHANNELS
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the number of allowed user event channels.
|
||||
*
|
||||
* Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
|
||||
******************************************************************************/
|
||||
#define CHANNEL_FORMAT_PAIRS 32
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,94 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcKernel.h
|
||||
*
|
||||
* Functions used by trcKernelHooks.h.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcHardwarePort.c/.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB 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 AB, 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 AB 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.
|
||||
*
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCKERNEL_H
|
||||
#define TRCKERNEL_H
|
||||
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
/* Internal functions */
|
||||
|
||||
#if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1
|
||||
void vTraceSetReadyEventsEnabled(int status);
|
||||
void vTraceStoreTaskReady(objectHandleType handle);
|
||||
#else
|
||||
#define vTraceSetReadyEventsEnabled(status)
|
||||
#endif
|
||||
|
||||
void vTraceStoreLowPower(uint32_t flag);
|
||||
|
||||
void vTraceStoreTaskswitch(objectHandleType task_handle);
|
||||
|
||||
void vTraceStoreKernelCall(uint32_t eventcode, traceObjectClass objectClass, uint32_t byteParam);
|
||||
|
||||
void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode,
|
||||
uint32_t param);
|
||||
|
||||
void vTraceStoreKernelCallWithParam(uint32_t evtcode, traceObjectClass objectClass,
|
||||
uint32_t objectNumber, uint32_t param);
|
||||
|
||||
void vTraceSetTaskInstanceFinished(objectHandleType handle);
|
||||
|
||||
void vTraceSetPriorityProperty(uint8_t objectclass, objectHandleType id, uint8_t value);
|
||||
|
||||
uint8_t uiTraceGetPriorityProperty(uint8_t objectclass, objectHandleType id);
|
||||
|
||||
void vTraceSetObjectState(uint8_t objectclass, objectHandleType id, uint8_t value);
|
||||
|
||||
uint8_t uiTraceGetObjectState(uint8_t objectclass, objectHandleType id);
|
||||
|
||||
#if (INCLUDE_OBJECT_DELETE == 1)
|
||||
|
||||
void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,
|
||||
traceObjectClass objectclass);
|
||||
|
||||
void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,
|
||||
traceObjectClass objectclass);
|
||||
#endif
|
||||
|
||||
/* Internal constants for task state */
|
||||
#define TASK_STATE_INSTANCE_NOT_ACTIVE 0
|
||||
#define TASK_STATE_INSTANCE_ACTIVE 1
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcKernelHooks.h
|
||||
*
|
||||
* The kernel integration hooks.
|
||||
*
|
||||
* NOTE:
|
||||
* For IAR Embedded Workbench for ARM, you need to have a preprocessor condition
|
||||
* on the include, to except it from the assembler step which otherwise give
|
||||
* compile-time errors.
|
||||
*
|
||||
* #ifdef __ICCARM__
|
||||
* #include "trcKernelPort.h"
|
||||
* #endif
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcPort.c and trcPort.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB 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 AB, 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 AB 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.
|
||||
*
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCKERNELHOOKS_H
|
||||
#define TRCKERNELHOOKS_H
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#undef INCLUDE_xTaskGetSchedulerState
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
#undef INCLUDE_xTaskGetCurrentTaskHandle
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
|
||||
#ifndef INCLUDE_OBJECT_DELETE
|
||||
#define INCLUDE_OBJECT_DELETE 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_READY_EVENTS
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_NEW_TIME_EVENTS
|
||||
#define INCLUDE_NEW_TIME_EVENTS 0
|
||||
#endif
|
||||
|
||||
#if (INCLUDE_OBJECT_DELETE == 1)
|
||||
/* This macro will remove the task and store it in the event buffer */
|
||||
#undef trcKERNEL_HOOKS_TASK_DELETE
|
||||
#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB) \
|
||||
vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \
|
||||
vTraceStoreObjectNameOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \
|
||||
vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TASK_NUMBER(pxTCB), TRACE_CLASS_TASK); \
|
||||
vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \
|
||||
vTraceSetObjectState(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TASK_STATE_INSTANCE_NOT_ACTIVE); \
|
||||
vTraceFreeObjectHandle(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
#else
|
||||
#undef trcKERNEL_HOOKS_TASK_DELETE
|
||||
#define trcKERNEL_HOOKS_TASK_DELETE(SERVICE, pxTCB)
|
||||
#endif
|
||||
|
||||
#if (INCLUDE_OBJECT_DELETE == 1)
|
||||
/* This macro will remove the object and store it in the event buffer */
|
||||
#undef trcKERNEL_HOOKS_OBJECT_DELETE
|
||||
#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject) \
|
||||
vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \
|
||||
vTraceStoreObjectNameOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \
|
||||
vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject)); \
|
||||
vTraceFreeObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));
|
||||
#else
|
||||
#undef trcKERNEL_HOOKS_OBJECT_DELETE
|
||||
#define trcKERNEL_HOOKS_OBJECT_DELETE(SERVICE, CLASS, pxObject)
|
||||
#endif
|
||||
|
||||
/* This macro will create a task in the object table */
|
||||
#undef trcKERNEL_HOOKS_TASK_CREATE
|
||||
#define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, CLASS, pxTCB) \
|
||||
TRACE_SET_TASK_NUMBER(pxTCB) \
|
||||
vTraceSetObjectName(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_NAME(pxTCB)); \
|
||||
vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), TRACE_GET_TASK_PRIORITY(pxTCB)); \
|
||||
vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxTCB), TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
|
||||
/* This macro will create a failed create call to create a task */
|
||||
#undef trcKERNEL_HOOKS_TASK_CREATE_FAILED
|
||||
#define trcKERNEL_HOOKS_TASK_CREATE_FAILED(SERVICE, CLASS) \
|
||||
vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, FAILED, CLASS, 0), TRACE_CLASS_TASK, 0);
|
||||
|
||||
/* This macro will setup a task in the object table */
|
||||
#undef trcKERNEL_HOOKS_OBJECT_CREATE
|
||||
#define trcKERNEL_HOOKS_OBJECT_CREATE(SERVICE, CLASS, pxObject)\
|
||||
TRACE_SET_OBJECT_NUMBER(CLASS, pxObject);\
|
||||
vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, SUCCESS, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject)); \
|
||||
vTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), 0);
|
||||
|
||||
/* This macro will create a failed create call to create an object */
|
||||
#undef trcKERNEL_HOOKS_OBJECT_CREATE_FAILED
|
||||
#define trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(SERVICE, CLASS, kernelClass) \
|
||||
vTraceStoreKernelCall(TRACE_GET_CLASS_EVENT_CODE(SERVICE, FAILED, CLASS, kernelClass), TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass), 0);
|
||||
|
||||
/* This macro will create a call to a kernel service with a certain result, with an object as parameter */
|
||||
#undef trcKERNEL_HOOKS_KERNEL_SERVICE
|
||||
#define trcKERNEL_HOOKS_KERNEL_SERVICE(SERVICE, RESULT, CLASS, pxObject) \
|
||||
vTraceStoreKernelCall(TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject), TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject));
|
||||
|
||||
/* This macro will set the state for an object */
|
||||
#undef trcKERNEL_HOOKS_SET_OBJECT_STATE
|
||||
#define trcKERNEL_HOOKS_SET_OBJECT_STATE(CLASS, pxObject, STATE) \
|
||||
vTraceSetObjectState(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject), TRACE_GET_OBJECT_NUMBER(CLASS, pxObject), STATE);
|
||||
|
||||
/* This macro will flag a certain task as a finished instance */
|
||||
#undef trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED
|
||||
#define trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED() \
|
||||
vTraceSetTaskInstanceFinished(TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()));
|
||||
|
||||
#if INCLUDE_READY_EVENTS == 1
|
||||
/* This macro will create an event to indicate that a task became Ready */
|
||||
#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE
|
||||
#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB) \
|
||||
vTraceStoreTaskReady(TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
#else
|
||||
#undef trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE
|
||||
#define trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB)
|
||||
#endif
|
||||
|
||||
/* This macro will update the internal tick counter and call vTracePortGetTimeStamp(0) to update the internal counters */
|
||||
#undef trcKERNEL_HOOKS_INCREMENT_TICK
|
||||
#define trcKERNEL_HOOKS_INCREMENT_TICK() \
|
||||
{ extern uint32_t uiTraceTickCount; uiTraceTickCount++; vTracePortGetTimeStamp(0); }
|
||||
|
||||
#if INCLUDE_NEW_TIME_EVENTS == 1
|
||||
/* This macro will create an event indicating that the OS tick count has increased */
|
||||
#undef trcKERNEL_HOOKS_NEW_TIME
|
||||
#define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue) \
|
||||
vTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue);
|
||||
#else
|
||||
#undef trcKERNEL_HOOKS_NEW_TIME
|
||||
#define trcKERNEL_HOOKS_NEW_TIME(SERVICE, xValue)
|
||||
#endif
|
||||
|
||||
/* This macro will create a task switch event to the currently executing task */
|
||||
#undef trcKERNEL_HOOKS_TASK_SWITCH
|
||||
#define trcKERNEL_HOOKS_TASK_SWITCH( pxTCB ) \
|
||||
vTraceStoreTaskswitch(TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
|
||||
/* This macro will create an event to indicate that the task has been suspended */
|
||||
#undef trcKERNEL_HOOKS_TASK_SUSPEND
|
||||
#define trcKERNEL_HOOKS_TASK_SUSPEND(SERVICE, pxTCB) \
|
||||
vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)); \
|
||||
vTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
|
||||
/* This macro will create an event to indicate that a task has called a wait/delay function */
|
||||
#undef trcKERNEL_HOOKS_TASK_DELAY
|
||||
#define trcKERNEL_HOOKS_TASK_DELAY(SERVICE, pxTCB, xValue) \
|
||||
vTraceStoreKernelCallWithNumericParamOnly(SERVICE, xValue); \
|
||||
vTraceSetTaskInstanceFinished((uint8_t)TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
|
||||
/* This macro will create an event to indicate that a task has gotten its priority changed */
|
||||
#undef trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE
|
||||
#define trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(SERVICE, pxTCB, uxNewPriority) \
|
||||
vTraceStoreKernelCallWithParam(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), uiTraceGetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB)));\
|
||||
vTraceSetPriorityProperty(TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB), (uint8_t)uxNewPriority);
|
||||
|
||||
/* This macro will create an event to indicate that the task has been resumed */
|
||||
#undef trcKERNEL_HOOKS_TASK_RESUME
|
||||
#define trcKERNEL_HOOKS_TASK_RESUME(SERVICE, pxTCB) \
|
||||
vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxTCB));
|
||||
|
||||
#undef trcKERNEL_HOOKS_TIMER_EVENT
|
||||
#define trcKERNEL_HOOKS_TIMER_EVENT(SERVICE, pxTimer) \
|
||||
vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));
|
||||
|
||||
/* This macro will create a timer in the object table and assign the timer a trace handle (timer number).*/
|
||||
#undef trcKERNEL_HOOKS_TIMER_CREATE
|
||||
#define trcKERNEL_HOOKS_TIMER_CREATE(SERVICE, pxTimer) \
|
||||
TRACE_SET_TIMER_NUMBER(pxTimer); \
|
||||
vTraceSetObjectName(TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_GET_TIMER_NAME(pxTimer)); \
|
||||
vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));
|
||||
#endif
|
||||
|
||||
#undef trcKERNEL_HOOKS_TIMER_DELETE
|
||||
#define trcKERNEL_HOOKS_TIMER_DELETE(SERVICE, pxTimer) \
|
||||
vTraceStoreKernelCall(SERVICE, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer)); \
|
||||
vTraceStoreObjectNameOnCloseEvent(TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_CLASS_TIMER); \
|
||||
vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_TIMER_NUMBER(pxTimer), TRACE_CLASS_TIMER); \
|
||||
vTraceFreeObjectHandle(TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(pxTimer));
|
||||
|
||||
#endif /* TRCKERNELHOOKS_H */
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcPortDefines.h
|
||||
*
|
||||
* Some common defines for the trace recorder.
|
||||
*
|
||||
* 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_PORTDEFINES_H
|
||||
#define TRC_PORTDEFINES_H
|
||||
|
||||
#define TRC_FREE_RUNNING_32BIT_INCR 1
|
||||
#define TRC_FREE_RUNNING_32BIT_DECR 2
|
||||
#define TRC_OS_TIMER_INCR 3
|
||||
#define TRC_OS_TIMER_DECR 4
|
||||
#define TRC_CUSTOM_TIMER_INCR 5
|
||||
#define TRC_CUSTOM_TIMER_DECR 6
|
||||
|
||||
/* Start options for vTraceEnable. */
|
||||
#define TRC_INIT 0
|
||||
#define TRC_START 1
|
||||
#define TRC_START_AWAIT_HOST 2
|
||||
|
||||
/* Command codes for TzCtrl task */
|
||||
#define CMD_SET_ACTIVE 1 /* Start (param1 = 1) or Stop (param1 = 0) */
|
||||
|
||||
/* The final command code, used to validate commands. */
|
||||
#define CMD_LAST_COMMAND 1
|
||||
|
||||
#define TRC_RECORDER_MODE_SNAPSHOT 0
|
||||
#define TRC_RECORDER_MODE_STREAMING 1
|
||||
|
||||
#define TRC_RECORDER_BUFFER_ALLOCATION_STATIC (0x00)
|
||||
#define TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC (0x01)
|
||||
#define TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM (0x02)
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Supported ports
|
||||
*
|
||||
* TRC_HARDWARE_PORT_HWIndependent
|
||||
* A hardware independent fallback option for event timestamping. Provides low
|
||||
* resolution timestamps based on the OS tick.
|
||||
* This may be used on the Win32 port, but may also be used on embedded hardware
|
||||
* platforms. All time durations will be truncated to the OS tick frequency,
|
||||
* typically 1 KHz. This means that a task or ISR that executes in less than
|
||||
* 1 ms get an execution time of zero.
|
||||
*
|
||||
* TRC_HARDWARE_PORT_APPLICATION_DEFINED
|
||||
* Allows for defining the port macros in other source code files.
|
||||
*
|
||||
* TRC_HARDWARE_PORT_Win32
|
||||
* "Accurate" timestamping based on the Windows performance counter for Win32
|
||||
* builds. Note that this gives the host machine time, not the kernel time.
|
||||
*
|
||||
* Hardware specific ports
|
||||
* To get accurate timestamping, a hardware timer is necessary. Below are the
|
||||
* available ports. Some of these are "unofficial", meaning that
|
||||
* they have not yet been verified by Percepio but have been contributed by
|
||||
* external developers. They should work, otherwise let us know by emailing
|
||||
* support@percepio.com. Some work on any OS platform, while other are specific
|
||||
* to a certain operating system.
|
||||
*****************************************************************************/
|
||||
|
||||
/****** Port Name ************************************* Code ** Official ** OS Platform *********/
|
||||
#define TRC_HARDWARE_PORT_APPLICATION_DEFINED 98 /* - - */
|
||||
#define TRC_HARDWARE_PORT_NOT_SET 99 /* - - */
|
||||
#define TRC_HARDWARE_PORT_HWIndependent 0 /* Yes Any */
|
||||
#define TRC_HARDWARE_PORT_Win32 1 /* Yes FreeRTOS on Win32 */
|
||||
#define TRC_HARDWARE_PORT_Atmel_AT91SAM7 2 /* No Any */
|
||||
#define TRC_HARDWARE_PORT_Atmel_UC3A0 3 /* No Any */
|
||||
#define TRC_HARDWARE_PORT_ARM_Cortex_M 4 /* Yes Any */
|
||||
#define TRC_HARDWARE_PORT_Renesas_RX600 6 /* Yes Any */
|
||||
#define TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32 7 /* Yes Any */
|
||||
#define TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48 8 /* Yes Any */
|
||||
#define TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_MSP430 9 /* No Any */
|
||||
#define TRC_HARDWARE_PORT_XILINX_PPC405 11 /* No FreeRTOS */
|
||||
#define TRC_HARDWARE_PORT_XILINX_PPC440 12 /* No FreeRTOS */
|
||||
#define TRC_HARDWARE_PORT_XILINX_MICROBLAZE 13 /* No Any */
|
||||
#define TRC_HARDWARE_PORT_NXP_LPC210X 14 /* No Any */
|
||||
#define TRC_HARDWARE_PORT_ARM_CORTEX_A9 15 /* Yes Any */
|
||||
#define TRC_HARDWARE_PORT_POWERPC_Z4 16 /* No FreeRTOS */
|
||||
|
||||
#endif /*TRC_PORTDEFINES_H*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcTypes.h
|
||||
*
|
||||
* Data types used by the trace recorder library.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcHardwarePort.c/.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB 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 AB, 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 AB 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, 2014.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCTYPES_H
|
||||
#define TRCTYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <trcConfig.h>
|
||||
|
||||
typedef uint16_t traceLabel;
|
||||
|
||||
typedef uint8_t UserEventChannel;
|
||||
|
||||
#if (USE_16BIT_OBJECT_HANDLES == 1)
|
||||
typedef uint16_t objectHandleType;
|
||||
#else
|
||||
typedef uint8_t objectHandleType;
|
||||
#endif
|
||||
|
||||
typedef uint8_t traceObjectClass;
|
||||
|
||||
#endif
|
||||
@@ -1,465 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcUser.h
|
||||
* The public API of the trace recorder library.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcHardwarePort.c/.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB 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 AB, 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 AB 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, 2014.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCUSER_H
|
||||
#define TRCUSER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#ifndef USE_SEPARATE_USER_EVENT_BUFFER
|
||||
#define USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* TRACE_STOP_HOOK - Hook Pointer Data Type
|
||||
*
|
||||
* Declares a data type for a call back function that will be invoked whenever
|
||||
* the recorder is stopped.
|
||||
******************************************************************************/
|
||||
typedef void (*TRACE_STOP_HOOK)(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStopHookPtr
|
||||
*
|
||||
* Points to a call back function that is called from vTraceStop().
|
||||
******************************************************************************/
|
||||
extern TRACE_STOP_HOOK vTraceStopHookPtr;
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceInitTraceData
|
||||
*
|
||||
* Allocates, if necessary, and initializes the recorder data structure, based
|
||||
* on the constants in trcConfig.h.
|
||||
******************************************************************************/
|
||||
void vTraceInitTraceData(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceSetRecorderData
|
||||
*
|
||||
* If custom allocation is used, this function must be called so the recorder
|
||||
* library knows where to save the trace data.
|
||||
******************************************************************************/
|
||||
#if (TRACE_DATA_ALLOCATION == TRACE_DATA_ALLOCATION_CUSTOM)
|
||||
void vTraceSetRecorderData(void* pRecorderData);
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceSetStopHook
|
||||
*
|
||||
* Sets a function to be called when the recorder is stopped.
|
||||
******************************************************************************/
|
||||
void vTraceSetStopHook(TRACE_STOP_HOOK stopHookFunction);
|
||||
|
||||
/*******************************************************************************
|
||||
* uiTraceStart
|
||||
*
|
||||
* Starts the recorder. The recorder will not be started if an error has been
|
||||
* indicated using vTraceError, e.g. if any of the Nx constants in trcConfig.h
|
||||
* has a too small value (NTASK, NQUEUE, etc).
|
||||
*
|
||||
* Returns 1 if the recorder was started successfully.
|
||||
* Returns 0 if the recorder start was prevented due to a previous internal
|
||||
* error. In that case, check vTraceGetLastError to get the error message.
|
||||
* Any error message is also presented when opening a trace file.
|
||||
*
|
||||
******************************************************************************/
|
||||
uint32_t uiTraceStart(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStart
|
||||
*
|
||||
* Starts the recorder. The recorder will not be started if an error has been
|
||||
* indicated using vTraceError, e.g. if any of the Nx constants in trcConfig.h
|
||||
* has a too small value (NTASK, NQUEUE, etc).
|
||||
*
|
||||
* This function is obsolete, but has been saved for backwards compatibility.
|
||||
* We recommend using uiTraceStart instead.
|
||||
******************************************************************************/
|
||||
void vTraceStart(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStop
|
||||
*
|
||||
* Stops the recorder. The recording can be resumed by calling vTraceStart.
|
||||
* This does not reset the recorder. Use vTraceClear is that is desired.
|
||||
******************************************************************************/
|
||||
void vTraceStop(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* xTraceGetLastError
|
||||
*
|
||||
* Gives the last error message, if any. NULL if no error message is stored.
|
||||
* Any error message is also presented when opening a trace file.
|
||||
******************************************************************************/
|
||||
char* xTraceGetLastError(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceClear
|
||||
*
|
||||
* Resets the recorder. Only necessary if a restart is desired - this is not
|
||||
* needed in the startup initialization.
|
||||
******************************************************************************/
|
||||
void vTraceClear(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceClearError
|
||||
*
|
||||
* Removes any previous error message generated by recorder calling vTraceError.
|
||||
* By calling this function, it may be possible to start/restart the trace
|
||||
* despite errors in the recorder, but there is no guarantee that the trace
|
||||
* recorder will work correctly in that case, depending on the type of error.
|
||||
******************************************************************************/
|
||||
void vTraceClearError(int resetErrorMessage);
|
||||
|
||||
#if (INCLUDE_ISR_TRACING == 1)
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceSetISRProperties
|
||||
*
|
||||
* Registers an Interrupt Service Routine in the recorder library, This must be
|
||||
* called before using vTraceStoreISRBegin to store ISR events. This is
|
||||
* typically called in the startup of the system, before the scheduler is
|
||||
* started.
|
||||
*
|
||||
* Example:
|
||||
* #define ID_ISR_TIMER1 1 // lowest valid ID is 1
|
||||
* #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt
|
||||
* ...
|
||||
* vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);
|
||||
* ...
|
||||
* void ISR_handler()
|
||||
* {
|
||||
* vTraceStoreISRBegin(ID_OF_ISR_TIMER1);
|
||||
* ...
|
||||
* vTraceStoreISREnd(0);
|
||||
* }
|
||||
******************************************************************************/
|
||||
void vTraceSetISRProperties(objectHandleType handle, const char* name, char priority);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStoreISRBegin
|
||||
*
|
||||
* Registers the beginning of an Interrupt Service Routine.
|
||||
* If allowing nested ISRs, this must be called with interrupts disabled.
|
||||
*
|
||||
* Example:
|
||||
* #define ID_ISR_TIMER1 1 // lowest valid ID is 1
|
||||
* #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt
|
||||
* ...
|
||||
* vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);
|
||||
* ...
|
||||
* void ISR_handler()
|
||||
* {
|
||||
* vTraceStoreISRBegin(ID_OF_ISR_TIMER1);
|
||||
* ...
|
||||
* vTraceStoreISREnd(0);
|
||||
* }
|
||||
*
|
||||
******************************************************************************/
|
||||
void vTraceStoreISRBegin(objectHandleType id);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStoreISREnd
|
||||
*
|
||||
* Registers the end of an Interrupt Service Routine.
|
||||
*
|
||||
* The parameter pendingISR indicates if the interrupt has requested a
|
||||
* task-switch (= 1) or if the interrupt returns to the earlier context (= 0)
|
||||
*
|
||||
* Example:
|
||||
* #define ID_ISR_TIMER1 1 // lowest valid ID is 1
|
||||
* #define PRIO_OF_ISR_TIMER1 3 // the hardware priority of the interrupt
|
||||
* ...
|
||||
* vTraceSetISRProperties(ID_ISR_TIMER1, "ISRTimer1", PRIO_OF_ISR_TIMER1);
|
||||
* ...
|
||||
* void ISR_handler()
|
||||
* {
|
||||
* vTraceStoreISRBegin(ID_OF_ISR_TIMER1);
|
||||
* ...
|
||||
* vTraceStoreISREnd(0);
|
||||
* }
|
||||
*
|
||||
******************************************************************************/
|
||||
void vTraceStoreISREnd(int pendingISR);
|
||||
|
||||
#else
|
||||
/* If not including the ISR recording */
|
||||
|
||||
void vTraceIncreaseISRActive(void);
|
||||
|
||||
void vTraceDecreaseISRActive(void);
|
||||
|
||||
#define vTraceSetISRProperties(handle, name, priority)
|
||||
#define vTraceStoreISRBegin(id) vTraceIncreaseISRActive()
|
||||
#define vTraceStoreISREnd() vTraceDecreaseISRActive()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* vTraceTaskInstanceFinish(void)
|
||||
*
|
||||
* Marks the current task instance as finished on the next kernel call.
|
||||
*
|
||||
* If that kernel call is blocking, the instance ends after the blocking event
|
||||
* and the corresponding return event is then the start of the next instance.
|
||||
* If the kernel call is not blocking, the viewer instead splits the current
|
||||
* fragment right before the kernel call, which makes this call the first event
|
||||
* of the next instance.
|
||||
*
|
||||
* See also USE_IMPLICIT_IFE_RULES in trcConfig.h
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* while(1)
|
||||
* {
|
||||
* xQueueReceive(CommandQueue, &command, timeoutDuration);
|
||||
* processCommand(command);
|
||||
* vTraceInstanceFinish();
|
||||
* }
|
||||
*
|
||||
*****************************************************************************/
|
||||
void vTraceTaskInstanceFinish(void);
|
||||
|
||||
/******************************************************************************
|
||||
* vTraceTaskInstanceFinishDirect(void)
|
||||
*
|
||||
* Marks the current task instance as finished at this very instant.
|
||||
* This makes the viewer to splits the current fragment at this point and begin
|
||||
* a new actor instance.
|
||||
*
|
||||
* See also USE_IMPLICIT_IFE_RULES in trcConfig.h
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* This example will generate two instances for each loop iteration.
|
||||
* The first instance ends at vTraceInstanceFinishDirect(), while the second
|
||||
* instance ends at the next xQueueReceive call.
|
||||
*
|
||||
* while (1)
|
||||
* {
|
||||
* xQueueReceive(CommandQueue, &command, timeoutDuration);
|
||||
* ProcessCommand(command);
|
||||
* vTraceInstanceFinishDirect();
|
||||
* DoSometingElse();
|
||||
* vTraceInstanceFinish();
|
||||
* }
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
void vTraceTaskInstanceFinishDirect(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceGetTraceBuffer
|
||||
*
|
||||
* Returns a pointer to the recorder data structure. Use this together with
|
||||
* uiTraceGetTraceBufferSize if you wish to implement an own store/upload
|
||||
* solution, e.g., in case a debugger connection is not available for uploading
|
||||
* the data.
|
||||
******************************************************************************/
|
||||
void* vTraceGetTraceBuffer(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* uiTraceGetTraceBufferSize
|
||||
*
|
||||
* Gets the size of the recorder data structure. For use together with
|
||||
* vTraceGetTraceBuffer if you wish to implement an own store/upload solution,
|
||||
* e.g., in case a debugger connection is not available for uploading the data.
|
||||
******************************************************************************/
|
||||
uint32_t uiTraceGetTraceBufferSize(void);
|
||||
|
||||
#if (INCLUDE_USER_EVENTS == 1)
|
||||
|
||||
/*******************************************************************************
|
||||
* xTraceOpenLabel
|
||||
*
|
||||
* Creates user event labels for user event channels or for individual events.
|
||||
* User events can be used to log application events and data for display in
|
||||
* the visualization tool. A user event is identified by a label, i.e., a string,
|
||||
* which is stored in the recorder's symbol table.
|
||||
* When logging a user event, a numeric handle (reference) to this string is
|
||||
* used to identify the event. This is obtained by calling
|
||||
*
|
||||
* xTraceOpenLabel()
|
||||
*
|
||||
* whihc adds the string to the symbol table (if not already present)
|
||||
* and returns the corresponding handle.
|
||||
*
|
||||
* This can be used in two ways:
|
||||
*
|
||||
* 1. The handle is looked up every time, when storing the user event.
|
||||
*
|
||||
* Example:
|
||||
* vTraceUserEvent(xTraceOpenLabel("MyUserEvent"));
|
||||
*
|
||||
* 2. The label is registered just once, with the handle stored in an
|
||||
* application variable - much like using a file handle.
|
||||
*
|
||||
* Example:
|
||||
* myEventHandle = xTraceOpenLabel("MyUserEvent");
|
||||
* ...
|
||||
* vTraceUserEvent(myEventHandle);
|
||||
*
|
||||
* The second option is faster since no lookup is required on each event, and
|
||||
* therefore recommended for user events that are frequently
|
||||
* executed and/or located in time-critical code. The lookup operation is
|
||||
* however fairly fast due to the design of the symbol table.
|
||||
******************************************************************************/
|
||||
traceLabel xTraceOpenLabel(const char* label);
|
||||
|
||||
/******************************************************************************
|
||||
* vTraceUserEvent
|
||||
*
|
||||
* Basic user event (Standard and Professional Edition only)
|
||||
*
|
||||
* Generates a User Event with a text label. The label is created/looked up
|
||||
* in the symbol table using xTraceOpenLabel.
|
||||
******************************************************************************/
|
||||
void vTraceUserEvent(traceLabel eventLabel);
|
||||
|
||||
/******************************************************************************
|
||||
* vTracePrintF
|
||||
*
|
||||
* Advanced user events (Professional Edition only)
|
||||
*
|
||||
* Generates User Event with formatted text and data, similar to a "printf".
|
||||
* It is very fast compared to a normal "printf" since this function only
|
||||
* stores the arguments. The actual formatting is done
|
||||
* on the host PC when the trace is displayed in the viewer tool.
|
||||
*
|
||||
* User Event labels are created using xTraceOpenLabel.
|
||||
* Example:
|
||||
*
|
||||
* traceLabel adc_uechannel = xTraceOpenLabel("ADC User Events");
|
||||
* ...
|
||||
* vTracePrint(adc_uechannel,
|
||||
* "ADC channel %d: %lf volts",
|
||||
* ch, (double)adc_reading/(double)scale);
|
||||
*
|
||||
* This can be combined into one line, if desired, but this is slower:
|
||||
*
|
||||
* vTracePrint(xTraceOpenLabel("ADC User Events"),
|
||||
* "ADC channel %d: %lf volts",
|
||||
* ch, (double)adc_reading/(double)scale);
|
||||
*
|
||||
* Calling xTraceOpenLabel multiple times will not create duplicate entries, but
|
||||
* it is of course faster to just do it once, and then keep the handle for later
|
||||
* use. If you don�t have any data arguments, only a text label/string, it is
|
||||
* better to use vTraceUserEvent - it is faster.
|
||||
*
|
||||
* Format specifiers supported:
|
||||
* %d - 32 bit signed integer
|
||||
* %u - 32 bit unsigned integer
|
||||
* %f - 32 bit float
|
||||
* %s - string (is copied to the recorder symbol table)
|
||||
* %hd - 16 bit signed integer
|
||||
* %hu - 16 bit unsigned integer
|
||||
* %bd - 8 bit signed integer
|
||||
* %bu - 8 bit unsigned integer
|
||||
* %lf - double-precision float (Note! See below...)
|
||||
*
|
||||
* Up to 15 data arguments are allowed, with a total size of maximum 32 byte.
|
||||
* In case this is exceeded, the user event is changed into an error message.
|
||||
*
|
||||
* The data is stored in trace buffer, and is packed to allow storing multiple
|
||||
* smaller data entries in the same 4-byte record, e.g., four 8-bit values.
|
||||
* A string requires two bytes, as the symbol table is limited to 64K. Storing
|
||||
* a double (%lf) uses two records, so this is quite costly. Use float (%f)
|
||||
* unless the higher precision is really necessary.
|
||||
*
|
||||
* Note that the double-precision float (%lf) assumes a 64 bit double
|
||||
* representation. This does not seem to be the case on e.g. PIC24 and PIC32.
|
||||
* Before using a %lf argument on a 16-bit MCU, please verify that
|
||||
* "sizeof(double)" actually gives 8 as expected. If not, use %f instead.
|
||||
******************************************************************************/
|
||||
void vTracePrintF(traceLabel eventLabel, const char* formatStr, ...);
|
||||
|
||||
#if (USE_SEPARATE_USER_EVENT_BUFFER == 1)
|
||||
UserEventChannel xTraceRegisterChannelFormat(traceLabel channel, traceLabel formatStr);
|
||||
void vTraceChannelPrintF(UserEventChannel channel, ...);
|
||||
void vTraceChannelUserEvent(UserEventChannel channel);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define vTracePrintF(eventLabel, formatStr, ...);
|
||||
#define xTraceOpenLabel(label) 0
|
||||
#define vTraceUserEvent(eventLabel)
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* Empty defines for user functions to avoid compiler errors if trace is not to be used */
|
||||
|
||||
#define vTraceInitTraceData()
|
||||
#define uiTraceStart() (1) // Fake "success", if used when recorder is excluded from build
|
||||
#define vTraceStart()
|
||||
#define vTraceStop()
|
||||
#define vTraceClear()
|
||||
#define vTraceStartStatusMonitor()
|
||||
#define vTraceGetTraceBuffer() ((void*)0)
|
||||
#define uiTraceGetTraceBufferSize() 0
|
||||
#define xTraceOpenLabel(label) 0
|
||||
#define vTraceUserEvent(eventLabel)
|
||||
#define vTracePrintF(eventLabel,formatStr,...)
|
||||
#define vTraceExcludeTaskFromSchedulingTrace(name)
|
||||
|
||||
#define vTraceSetISRProperties(handle, name, priority)
|
||||
#define vTraceStoreISRBegin(id)
|
||||
#define vTraceStoreISREnd(flag)
|
||||
#define vTraceExcludeTaskFromTrace(handle)
|
||||
#define vTraceSetQueueName(a, b)
|
||||
#define vTraceSetMutexName(a, b)
|
||||
#define vTraceSetSemaphoreName(a, b)
|
||||
#define vTraceSetEventGroupName(a, b)
|
||||
|
||||
#define vTraceSetStopHook(a)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,159 @@
|
||||
/*******************************************************************************
|
||||
* 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 "trcPortDefines.h"
|
||||
|
||||
/******************************************************************************
|
||||
* 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_NOT_SET
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
|
||||
/*******************************************************************************
|
||||
* 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_FREERTOS_VERSION
|
||||
*
|
||||
* 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_OR_7_4 If using FreeRTOS v7.3.0 - v7.4.2
|
||||
* TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0
|
||||
* TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X
|
||||
* TRC_FREERTOS_VERSION_9_X If using FreeRTOS v9.X.X
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_9_X
|
||||
|
||||
/******************************************************************************
|
||||
* 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
|
||||
|
||||
/* 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 */
|
||||
@@ -0,0 +1,472 @@
|
||||
/*******************************************************************************
|
||||
* 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_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.
|
||||
*
|
||||
* For users of Tracealyzer Free Edition, that only displays scheduling events, this
|
||||
* option can be used to avoid storing other events.
|
||||
*
|
||||
* Default value is 0 (store all enabled events).
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SCHEDULING_ONLY 0
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 1000
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 10
|
||||
#define TRC_CFG_NISR 5
|
||||
#define TRC_CFG_NQUEUE 10
|
||||
#define TRC_CFG_NSEMAPHORE 10
|
||||
#define TRC_CFG_NMUTEX 10
|
||||
#define TRC_CFG_NTIMER 5
|
||||
#define TRC_CFG_NEVENTGROUP 5
|
||||
|
||||
/******************************************************************************
|
||||
* 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) the code for creating User Events is excluded to
|
||||
* reduce code size. User Events are application-generated events, like
|
||||
* "printf" but for the trace log and the formatting is done offline, by the
|
||||
* Tracealyzer visualization tool. User Events are much faster than a printf
|
||||
* and can therefore be used in timing critical code.
|
||||
*
|
||||
* 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 0.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 0
|
||||
|
||||
/******************************************************************************
|
||||
* 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_INCLUDE_OBJECT_DELETE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime. If no deletes are made, this
|
||||
* can be set to 0 in order to exclude the delete-handling code.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 800
|
||||
|
||||
#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
|
||||
|
||||
/******************************************************************************
|
||||
*** 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*/
|
||||
@@ -0,0 +1,170 @@
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcStreamingConfig.h
|
||||
*
|
||||
* Configuration parameters for the trace recorder library in streaming 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_STREAMING_CONFIG_H
|
||||
#define TRC_STREAMING_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_SYMBOL_TABLE_SLOTS
|
||||
*
|
||||
* The maximum number of symbols names that can be stored. This includes:
|
||||
* - Task names
|
||||
* - Named ISRs (vTraceSetISRProperties)
|
||||
* - Named kernel objects (vTraceStoreKernelObjectName)
|
||||
* - User event channels (vTraceStoreUserEventChannelName)
|
||||
*
|
||||
* If this value is too small, not all symbol names will be stored and the
|
||||
* trace display will be affected. In that case, there will be warnings
|
||||
* (as User Events) from TzCtrl task, that monitors this.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SYMBOL_TABLE_SLOTS 40
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_SYMBOL_MAX_LENGTH
|
||||
*
|
||||
* The maximum length of symbol names, including:
|
||||
* - Task names
|
||||
* - Named ISRs (vTraceSetISRProperties)
|
||||
* - Named kernel objects (vTraceStoreKernelObjectName)
|
||||
* - User event channel names (vTraceStoreUserEventChannelName)
|
||||
*
|
||||
* If longer symbol names are used, they will be truncated by the recorder,
|
||||
* which will affect the trace display. In that case, there will be warnings
|
||||
* (as User Events) from TzCtrl task, that monitors this.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SYMBOL_MAX_LENGTH 25
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_OBJECT_DATA_SLOTS
|
||||
*
|
||||
* The maximum number of object data entries (used for task priorities) that can
|
||||
* be stored at the same time. Must be sufficient for all tasks, otherwise there
|
||||
* will be warnings (as User Events) from TzCtrl task, that monitors this.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_OBJECT_DATA_SLOTS 40
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_CTRL_TASK_STACK_SIZE
|
||||
*
|
||||
* The stack size of the TzCtrl task, that receive commands.
|
||||
* We are aiming to remove this extra task in future versions.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_CTRL_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE * 2)
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_CTRL_TASK_PRIORITY
|
||||
*
|
||||
* The priority of the TzCtrl task, that receive commands from Tracealyzer.
|
||||
* Most stream ports also rely on the TzCtrl task to transmit the data from the
|
||||
* internal buffer to the stream interface (all except for the J-Link port).
|
||||
* For such ports, make sure the TzCtrl priority is high enough to ensure
|
||||
* reliable periodic execution and transfer of the data.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_CTRL_TASK_PRIORITY 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_CTRL_TASK_DELAY
|
||||
*
|
||||
* The delay between every loop of the TzCtrl task. A high delay will reduce the
|
||||
* CPU load, but may cause missed events if the TzCtrl task is performing the
|
||||
* trace transfer.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_CTRL_TASK_DELAY ((10 * configTICK_RATE_HZ) / 1000)
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT
|
||||
*
|
||||
* Specifies the number of pages used by the paged event buffer.
|
||||
* This may need to be increased if there are a lot of missed events.
|
||||
*
|
||||
* Note: not used by the J-Link RTT stream port (see SEGGER_RTT_Conf.h instead)
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT 2
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE
|
||||
*
|
||||
* Specifies the size of each page in the paged event buffer. This can be tuned
|
||||
* to match any internal low-level buffers used by the streaming interface, like
|
||||
* the Ethernet MTU (Maximum Transmission Unit).
|
||||
*
|
||||
* Note: not used by the J-Link RTT stream port (see SEGGER_RTT_Conf.h instead)
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE 2500
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_STREAMING_CONFIG_H */
|
||||
@@ -1,114 +0,0 @@
|
||||
|
||||
Tracealyzer - Uploading the trace data
|
||||
-----------------------------------------
|
||||
Percepio AB, Jan. 23, 2014
|
||||
|
||||
This document decribes how to upload the trace data from the target system to
|
||||
Tracealyzer.
|
||||
|
||||
Tracealyzer uses your existing debugger to upload the trace data from the
|
||||
chip RAM. This is a plain RAM dump, that is done whenever you want to look at
|
||||
the trace buffer contents. This means it works with essentially with any debug
|
||||
probe on the market.
|
||||
|
||||
Built-in support for Segger J-Link/J-Trace and Atmel SAM-ICE
|
||||
------------------------------------------------------------
|
||||
Tracealyzer v2.3 supports Segger J-Link and J-Link compatible debuggers
|
||||
directly, without any debugger IDE involved. Using other debug probes is
|
||||
also possible, but requires some extra steps, described below.
|
||||
|
||||
If you have a Segger J-Link/J-Trace debug probe or another J-Link compatible
|
||||
debug probe, just select "Read Trace" in the "J-Link" menu. Note that this
|
||||
menu is only available if a compatible debug probe is found.
|
||||
|
||||
This opens a dialog where you get to enter the memory region where
|
||||
the recorder data structure is located. Normally you select the entire
|
||||
internal RAM according to the datasheet of your MCU, but the exact address
|
||||
can be found can by inspecting the "RecorderData" struct or the
|
||||
"RecorderDataPtr" pointer with your debugger.
|
||||
|
||||
J-Link compatible debug probes also include Atmel SAM-ICE and many built-in
|
||||
debug interfaces on demonstration/evaluation boards (where there is a USB
|
||||
connection directly to the board). Look for a Segger J-Link label on the board.
|
||||
|
||||
MemoryLogger extension in Atmel Studio 6
|
||||
----------------------------------------
|
||||
Atmel's MemoryLogger extension provides a superb integration with FreeRTOS+Trace.
|
||||
Look for "MemoryLogger" in Atmel Gallery, available in Atmel Studio and at the
|
||||
Atmel website (http://gallery.atmel.com).
|
||||
|
||||
This extension automatically detects the path to FreeRTOS+Trace, if
|
||||
installed, and gives you a single-click upload/refresh. You can use it
|
||||
while debugging and optionally get an automatic refresh eash time the
|
||||
MCU is halted, e.g., on each breakpoint.
|
||||
|
||||
Using other development environments and debug probes
|
||||
-----------------------------------------------------
|
||||
Most debuggers are able to save the RAM contents to a file. Tracealyzer
|
||||
supports the following common formats:
|
||||
- Binary (.bin), supporting gdb, J-Link and Renesas HEW.
|
||||
- Intel Hex (.hex), supporting IAR Embedded Workbench and Atmel Studio (atprogram.exe)
|
||||
- MCH (.mch), supporting Microchip MPLAB.
|
||||
|
||||
When you store the RAM dump, you must also make sure to select the right region,
|
||||
i.e., start address and size. The recorder data is stored in a single data
|
||||
block, identified by the pointer RecorderDataPtr.
|
||||
It is not necessary to match the begin and end of the recorder data, as long as
|
||||
it is fully included by the dumped memory region. Tracealyzer automatically
|
||||
finds the trace data in the RAM dump, thanks to special signatures. For chips
|
||||
with on-chip RAM only, we therefore recommend to dump the entire RAM. This is
|
||||
usually very fast.
|
||||
For chips with larger amounts of (external) RAM, it is typically possible to
|
||||
dump a limited region where the data is typically found.
|
||||
|
||||
Using IAR Embedded Workbench for ARM, version 6.3
|
||||
-------------------------------------------------
|
||||
In the debugger view, when stopped on a breakpoint:
|
||||
- Select "Debug" menu, "Memory" submenu, "Save..." (keyboard shortcut: ALT,d,y,s)
|
||||
- In the Save dialog
|
||||
- Zone: Memory
|
||||
- Start Adress: 10000000 (for NXP LPC1766 in the demo project)
|
||||
- End Adress: 1000FFFF (for NXP LPC1766 in the demo project)
|
||||
- File format: Intel Extended
|
||||
- Filename: <name>.hex
|
||||
- Press "Save" button
|
||||
You can now open <name>.hex in Tracealyzer.
|
||||
|
||||
To find the right Start and End addresses, check the address of the symbol
|
||||
"RecorderData". The addresses does not need to match this symbol exactly, as
|
||||
long as the whole data is included.
|
||||
|
||||
Using Renesas High-performance Embedded Workshop v4.09
|
||||
------------------------------------------------------
|
||||
In the debugger view, when stopped on a breakpoint:
|
||||
- Select "Debug" menu, "Save Memory..." (keyboard shortcut: ALT,d,a)
|
||||
- In the Save dialog
|
||||
- Format: Binary
|
||||
- Filename: <name>.bin
|
||||
- Start Address: 00000000 (For RX62N in the demo project)
|
||||
- End Address: 0000FFFF (For RX62N in the demo project)
|
||||
- Access size: 1
|
||||
- Press "Save" button and open <name>.bin in Tracealyzer.
|
||||
|
||||
Using Microchip MPLAB v8.86
|
||||
------------------------------------------------------
|
||||
- Select "View" -> "File Registers". This shows you the memory contents.
|
||||
- Make sure "Hex" is selected in the bottom left (instead of "Symbolic"). Hex mode seems to be default.
|
||||
- Right click in the view and select "Export Table...".
|
||||
- In the dialog ("Export As"), make sure "Single Column Output" is selected (seems to be default).
|
||||
- Select start address 0x0000 and make sure the end address is beyond the RecorderData structure.
|
||||
The default values seems to be the whole RAM, so you probably don't need to change this.
|
||||
- Save as a .mch file and open this file in Tracealyzer v2.2.4 or later (support for the .mch format was added in v2.2.4).
|
||||
|
||||
Using STM32 ST-Link
|
||||
------------------------------------------------------
|
||||
- Start "ST-Link Utility"
|
||||
- Connect to the device and view the device memory.
|
||||
- Set the view to display the entire RAM, or at least the section containing the RecorderData structure.
|
||||
- Select "Save as" and choose binary (.bin) or Intel Hex (.hex) format.
|
||||
- Open the resulting file in Tracealyzer.
|
||||
|
||||
In case you have any question, contact support@percepio.com
|
||||
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
@@ -1,57 +1,152 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Tracealyzer for FreeRTOS - Trace Recorder Library v3.1.1
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Tracealyzer Trace Recorder Library
|
||||
-------------------------------------
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
Tracealyzer for FreeRTOS is a sophisticated tool for tracing and visualization
|
||||
of FreeRTOS-based systems. Tracealyzer gives an unprecedented insight into the
|
||||
runtime behavior, which speeds up debugging, validation and optimization.
|
||||
|
||||
This directory contains the a generic trace recorder library for Tracealyzer v3.0.2.
|
||||
To learn more about this, see
|
||||
|
||||
For information on how to upload the trace data from your target system RAM to
|
||||
Tracealyzer, see the User Manual.
|
||||
- Getting Started (videos etc): http://percepio.com/gettingstarted/tz-freertos/
|
||||
|
||||
Files included
|
||||
--------------
|
||||
- trcConfig.h - The recorder's configuration file, set your recorder configuration here!
|
||||
- trcUser.c/.h - The main API towards the application (trcUser.h in the only include necessary).
|
||||
- trcKernel.c/.h - Internal routines for storing kernel events.
|
||||
- trcBase.c/.h - Internal routines for manipulating the data structures and calculating timestamps.
|
||||
- trcHardwarePort.c/.h - The hardware interface, especially for timestamping.
|
||||
- trcKernelPort.h - Wrapper for trcKernelPortFreeRTOS.h (for portability).
|
||||
- trcKernelPortFreeRTOS.c/.h - FreeRTOS-specific trace macros and helper functions.
|
||||
- trcKernelHooks.h - Generic trace macros (OS independent), used by trcKernelPortFreeRTOS.
|
||||
- trcTypes.h - Type definitions used.
|
||||
- User Manual (incl. Recorder API): http://percepio.com/docs/FreeRTOS/manual
|
||||
|
||||
Hardware Timer Ports
|
||||
--------------------
|
||||
This release contains hardware timer ports for the following hardware architectures:
|
||||
- FAQ: http://percepio.com/category/faq/
|
||||
|
||||
- ARM Cortex M3/M4/M0/M0+ (all brands, such as Atmel SAM3x/SAM4x/SAM D20, NXP 17xx, 18xx, 43xx, STM32, Freescale Kinetis, ...)
|
||||
- Atmel AT91SAM7x
|
||||
- Atmel AT32UC3 (AVR32)
|
||||
- Renesas RX600 (e.g., RX62N)
|
||||
- Microchip dsPIC/PIC24
|
||||
- Microchip PIC32MX
|
||||
- Microchip PIC32MZ
|
||||
- NXP LPC2106
|
||||
- Texas Instruments TMS570 (Cortex-R4)
|
||||
- Texas Instruments MSP430
|
||||
- Xilinx PowerPC 405
|
||||
- Xilinx PowerPC 440
|
||||
- Xilinx Microblaze
|
||||
- ARM Cortex-A9
|
||||
In case you have any questions, don't hesitate to contact support@percepio.com
|
||||
|
||||
These are defined in trcHardwarePort.h. Some of these are "unofficial" ports, provided by external contributors.
|
||||
By unofficial, it means that they are not yet verified by Percepio AB. Please refer to trcHardwarePort.h for detailed information.
|
||||
If you use an unofficial port and believe it is incorrect, please let us know! (support@percepio.com)
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
In case your MCU is not yet supported directly, developing a new port is quite easy, just a matter of defining a few macros
|
||||
according to your specific MCU. See trcHardwarePort.h for further information.
|
||||
Changes, v3.1.1 -> v3.1.2
|
||||
|
||||
In case you have any questions, do not hesitate to contact support@percepio.com
|
||||
- Fixed two bugs related to User Events, one in vTracePrintF and other in vTracePrint.
|
||||
|
||||
Percepio AB
|
||||
Köpmangatan 1A
|
||||
72215 Västerås
|
||||
Sweden
|
||||
- Fixed a build problem related to a single reference of the old FreeRTOS type "xTaskHandle", in trcKernelPort.c.
|
||||
Changed to "TaskHandle_t", unless if using an older FreeRTOS kernel or the "compatibility mode".
|
||||
|
||||
www.percepio.com
|
||||
- Removed traceCREATE_MUTEX hook for FreeRTOS v9 or later (no longer required)
|
||||
|
||||
- Updated the User Manual regarding snapshot trace via IAR Embedded Workbench.
|
||||
|
||||
- Renamed vTraceGetTraceBuffer to xTraceGetTraceBuffer, since returning a pointer.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Changes, v3.1.0 -> v3.1.1
|
||||
|
||||
After the major changes in the v3.1.0 trace recorder library, this update
|
||||
corrects a number of minor issues. Only minor functional improvements.
|
||||
|
||||
- You can now use TRC_ALLOC_CUSTOM_BUFFER to declare a trace buffer on a custom
|
||||
location (using linker directives).
|
||||
The related function vTraceSetRecorderDataBuffer has been promoted to the
|
||||
Common API (previously only supported in snapshot mode, but custom allocation
|
||||
is now generally supported also in streaming mode).
|
||||
|
||||
- Removed TRC_CFG_USE_LINKER_PRAGMA. No longer necessary thanks to the custom
|
||||
allocation mode.
|
||||
|
||||
- Added support for timestamping from custom periodic timers, required for
|
||||
accurate timestamping on Cortex-M0/M0+ devices when using tickless idle.
|
||||
Only for streaming mode so far. See TRC_CUSTOM_TIMER_INCR / DECR.
|
||||
|
||||
- ARM Cortex-M port: Made sure the DWT unit is initialized properly, in case
|
||||
the debugger doesn't handle this.
|
||||
|
||||
- ARM Cortex-M port: Added possibility to use Systick timestamping also on
|
||||
Cortex-M3/M4/M7 devices (that otherwise use DWT timestamping by default).
|
||||
To use this option, define the macro TRC_CFG_ARM_CM_USE_SYSTICK.
|
||||
|
||||
- J-Link streaming: The default RTT buffer has been changed from 0 to 1.
|
||||
|
||||
- J-Link streaming: The RTT buffer settings for buffer 1 and higher, are now
|
||||
found in trcStreamingPort.h. Note: These settings don't apply to buffer 0.
|
||||
|
||||
- vTracePrint has been optimized for better performance in string logging.
|
||||
|
||||
- Minor performance improvement related to symbol table transfer in streaming mode.
|
||||
|
||||
- Timer names now registered also in streaming mode.
|
||||
|
||||
- Timer start and stop event are now traced.
|
||||
|
||||
- Implemented support for queue registry (traceQUEUE_REGISTRY_ADD) also for streaming.
|
||||
|
||||
- Fixed a bug related to repeated calls of vTraceEnable.
|
||||
|
||||
- Fixed a bug where task-switches seemed to occur even though the scheduler was disabled.
|
||||
|
||||
- Renamed HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48, added prefix TRC.
|
||||
|
||||
- Fixed several language issues in the comments and documentation.
|
||||
|
||||
- Fixed several minor issues and warnings from different compilers
|
||||
(including PowerPC/gcc) and configurations.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Changes, v3.0.9 -> v3.1.0
|
||||
|
||||
- Merge of previously separated snapshot and streaming recorders into a single
|
||||
recorder supporting both streaming and snapshot as different modes.
|
||||
|
||||
- New common API for supporting both streaming and snapshot modes.
|
||||
|
||||
- New integration guide, see the User Manual.
|
||||
|
||||
- Major improvement of API documentation in source files and User Manual.
|
||||
|
||||
- New concept of "stream ports", giving a better structure defining streaming
|
||||
interfaces, and restructured the J-Link and TCP/IP streaming as stream ports.
|
||||
|
||||
- Added a stream port for USB CDC connections, with STM32 as example.
|
||||
Since Tracealyzer now can receive serial data on Windows COM ports, this is
|
||||
really easy to use.
|
||||
|
||||
- Added a warning (#error) for cases where FreeRTOS tickless idle mode is used
|
||||
together with timestamping using SysTick or other periodic interrupt timers,
|
||||
Tracing with tickless idle requires an independent time source to correctly
|
||||
capture the length of the idle periods.
|
||||
|
||||
- Major changes in the recorder API. Important examples are:
|
||||
|
||||
* Some configuration macros have changed names, e.g. for "hardware port".
|
||||
Make sure to remove any old "trcConfig.h" files if upgrading from an
|
||||
earlier version!
|
||||
|
||||
* Recorder configuration in trcConfig.h has been minimized and now only
|
||||
includes the important settings that are independent of recorder mode.
|
||||
Advanced settings for each mode are found in trcSnapshotConfig.h and
|
||||
trcStreamingConfig.h.
|
||||
|
||||
* vTraceEnable replaces Trace_Init and vTraceInitTraceData, as well as
|
||||
vTraceStart and uiTraceStart.
|
||||
|
||||
* vTraceStop now part of the common API and thereby available also in
|
||||
streaming. And since vTraceEnable can start the streaming directly
|
||||
you have the option control the tracing from target, e.g., for
|
||||
streaming to a device file system.
|
||||
|
||||
* vTraceStoreKernelObjectName from old streaming recorder has been replaced
|
||||
by vTraceSetQueueName, vTraceSetSemaphoreName, etc.
|
||||
|
||||
* vTraceSetISRProperties now returns a "traceHandle" that should be passed as
|
||||
parameter to vTraceStoreISRBegin and vTraceStoreISREnd.
|
||||
|
||||
* xTraceRegisterString has replaced the old functions xTraceOpenLabel and
|
||||
vTraceStoreUserEventChannelName. This now returns a "traceString" for use
|
||||
as "channel" parameter in vTracePrintF, and in other places where strings
|
||||
are stored.
|
||||
|
||||
* Removed vTraceStoreISREndManual and vTraceStoreISREndAuto, use
|
||||
vTraceStoreISREnd instead.
|
||||
|
||||
* Renamed the functions for saving User Events in a separate buffer:
|
||||
- xTraceRegisterChannelFormat -> xTraceRegisterUBChannel
|
||||
- vTraceChannelPrintF -> vTraceUBData
|
||||
- vTraceChannelUserEvent -> vTraceUBEvent
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright Percepio AB, 2017.
|
||||
@@ -0,0 +1,22 @@
|
||||
Tracealyzer Stream Port for SEGGER J-Link
|
||||
-----------------------------------------
|
||||
|
||||
This directory contains a "stream port" for the Tracealyzer recorder library,
|
||||
i.e., the specific code needed to use a particular interface for streaming a
|
||||
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
|
||||
trcStreamingPort.h, found in the "include" directory.
|
||||
|
||||
This particular stream port targets SEGGER J-Link debug probes, using the RTT
|
||||
interface provided by SEGGER.
|
||||
|
||||
To use this stream port, make sure that include/trcStreamingPort.h is found
|
||||
by the compiler (i.e., add this folder to your project's include paths) and
|
||||
add all included source files to your build. Make sure no other versions of
|
||||
trcStreamingPort.h are included by mistake!
|
||||
|
||||
Note that this stream port also contains SEGGER's RTT driver.
|
||||
|
||||
See also http://percepio.com/2016/10/05/rtos-tracing.
|
||||
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,238 @@
|
||||
/*********************************************************************
|
||||
* SEGGER MICROCONTROLLER GmbH & Co. KG *
|
||||
* Solutions for real time microcontroller applications *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 2014 - 2016 SEGGER Microcontroller GmbH & Co. KG *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SEGGER RTT * Real Time Transfer for embedded targets *
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* * This software may in its unmodified form be freely redistributed *
|
||||
* in source, linkable, or executable form. *
|
||||
* * The source code may be modified, provided the source code *
|
||||
* retains the above copyright notice, this list of conditions and *
|
||||
* the following disclaimer. *
|
||||
* * Modified versions of this software in source, executable, or *
|
||||
* linkable form may not be distributed without prior consent of *
|
||||
* SEGGER. *
|
||||
* * This software may only be used for communication with SEGGER *
|
||||
* J-Link debug probes. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
||||
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
|
||||
* DAMAGE. *
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* RTT version: 6.00e *
|
||||
* *
|
||||
**********************************************************************
|
||||
---------------------------END-OF-HEADER------------------------------
|
||||
File : SEGGER_RTT.h
|
||||
Purpose : Implementation of SEGGER real-time transfer which allows
|
||||
real-time communication on targets which support debugger
|
||||
memory accesses while the CPU is running.
|
||||
Revision: $Rev: 4079 $
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SEGGER_RTT_H
|
||||
#define SEGGER_RTT_H
|
||||
|
||||
#include "SEGGER_RTT_Conf.h"
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Defines, fixed
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Types
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
//
|
||||
// Description for a circular buffer (also called "ring buffer")
|
||||
// which is used as up-buffer (T->H)
|
||||
//
|
||||
typedef struct {
|
||||
const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
|
||||
char* pBuffer; // Pointer to start of buffer
|
||||
unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
|
||||
unsigned WrOff; // Position of next item to be written by either target.
|
||||
volatile unsigned RdOff; // Position of next item to be read by host. Must be volatile since it may be modified by host.
|
||||
unsigned Flags; // Contains configuration flags
|
||||
} SEGGER_RTT_BUFFER_UP;
|
||||
|
||||
//
|
||||
// Description for a circular buffer (also called "ring buffer")
|
||||
// which is used as down-buffer (H->T)
|
||||
//
|
||||
typedef struct {
|
||||
const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
|
||||
char* pBuffer; // Pointer to start of buffer
|
||||
unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
|
||||
volatile unsigned WrOff; // Position of next item to be written by host. Must be volatile since it may be modified by host.
|
||||
unsigned RdOff; // Position of next item to be read by target (down-buffer).
|
||||
unsigned Flags; // Contains configuration flags
|
||||
} SEGGER_RTT_BUFFER_DOWN;
|
||||
|
||||
//
|
||||
// RTT control block which describes the number of buffers available
|
||||
// as well as the configuration for each buffer
|
||||
//
|
||||
//
|
||||
typedef struct {
|
||||
char acID[16]; // Initialized to "SEGGER RTT"
|
||||
int MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2)
|
||||
int MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2)
|
||||
SEGGER_RTT_BUFFER_UP aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS]; // Up buffers, transferring information up from target via debug probe to host
|
||||
SEGGER_RTT_BUFFER_DOWN aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS]; // Down buffers, transferring information down from host via debug probe to target
|
||||
} SEGGER_RTT_CB;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Global data
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
extern SEGGER_RTT_CB _SEGGER_RTT;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT API functions
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int SEGGER_RTT_AllocDownBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
|
||||
int SEGGER_RTT_AllocUpBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
|
||||
int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
|
||||
int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
|
||||
int SEGGER_RTT_GetKey (void);
|
||||
unsigned SEGGER_RTT_HasData (unsigned BufferIndex);
|
||||
int SEGGER_RTT_HasKey (void);
|
||||
void SEGGER_RTT_Init (void);
|
||||
unsigned SEGGER_RTT_Read (unsigned BufferIndex, void* pBuffer, unsigned BufferSize);
|
||||
unsigned SEGGER_RTT_ReadNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize);
|
||||
int SEGGER_RTT_SetNameDownBuffer (unsigned BufferIndex, const char* sName);
|
||||
int SEGGER_RTT_SetNameUpBuffer (unsigned BufferIndex, const char* sName);
|
||||
int SEGGER_RTT_SetFlagsDownBuffer (unsigned BufferIndex, unsigned Flags);
|
||||
int SEGGER_RTT_SetFlagsUpBuffer (unsigned BufferIndex, unsigned Flags);
|
||||
int SEGGER_RTT_WaitKey (void);
|
||||
unsigned SEGGER_RTT_Write (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
|
||||
unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
|
||||
unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
|
||||
unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s);
|
||||
void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
|
||||
//
|
||||
// Function macro for performance optimization
|
||||
//
|
||||
#define SEGGER_RTT_HASDATA(n) (_SEGGER_RTT.aDown[n].WrOff - _SEGGER_RTT.aDown[n].RdOff)
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT "Terminal" API functions
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
int SEGGER_RTT_SetTerminal (char TerminalId);
|
||||
int SEGGER_RTT_TerminalOut (char TerminalId, const char* s);
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT printf functions (require SEGGER_RTT_printf.c)
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Defines
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
//
|
||||
// Operating modes. Define behavior if buffer is full (not enough space for entire message)
|
||||
//
|
||||
#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0U) // Skip. Do not block, output nothing. (Default)
|
||||
#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1U) // Trim: Do not block, output as much as fits.
|
||||
#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (2U) // Block: Wait until there is space in the buffer.
|
||||
#define SEGGER_RTT_MODE_MASK (3U)
|
||||
|
||||
//
|
||||
// Control sequences, based on ANSI.
|
||||
// Can be used to control color, and clear the screen
|
||||
//
|
||||
#define RTT_CTRL_RESET "[0m" // Reset to default colors
|
||||
#define RTT_CTRL_CLEAR "[2J" // Clear screen, reposition cursor to top left
|
||||
|
||||
#define RTT_CTRL_TEXT_BLACK "[2;30m"
|
||||
#define RTT_CTRL_TEXT_RED "[2;31m"
|
||||
#define RTT_CTRL_TEXT_GREEN "[2;32m"
|
||||
#define RTT_CTRL_TEXT_YELLOW "[2;33m"
|
||||
#define RTT_CTRL_TEXT_BLUE "[2;34m"
|
||||
#define RTT_CTRL_TEXT_MAGENTA "[2;35m"
|
||||
#define RTT_CTRL_TEXT_CYAN "[2;36m"
|
||||
#define RTT_CTRL_TEXT_WHITE "[2;37m"
|
||||
|
||||
#define RTT_CTRL_TEXT_BRIGHT_BLACK "[1;30m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_RED "[1;31m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_GREEN "[1;32m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_YELLOW "[1;33m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_BLUE "[1;34m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "[1;35m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_CYAN "[1;36m"
|
||||
#define RTT_CTRL_TEXT_BRIGHT_WHITE "[1;37m"
|
||||
|
||||
#define RTT_CTRL_BG_BLACK "[24;40m"
|
||||
#define RTT_CTRL_BG_RED "[24;41m"
|
||||
#define RTT_CTRL_BG_GREEN "[24;42m"
|
||||
#define RTT_CTRL_BG_YELLOW "[24;43m"
|
||||
#define RTT_CTRL_BG_BLUE "[24;44m"
|
||||
#define RTT_CTRL_BG_MAGENTA "[24;45m"
|
||||
#define RTT_CTRL_BG_CYAN "[24;46m"
|
||||
#define RTT_CTRL_BG_WHITE "[24;47m"
|
||||
|
||||
#define RTT_CTRL_BG_BRIGHT_BLACK "[4;40m"
|
||||
#define RTT_CTRL_BG_BRIGHT_RED "[4;41m"
|
||||
#define RTT_CTRL_BG_BRIGHT_GREEN "[4;42m"
|
||||
#define RTT_CTRL_BG_BRIGHT_YELLOW "[4;43m"
|
||||
#define RTT_CTRL_BG_BRIGHT_BLUE "[4;44m"
|
||||
#define RTT_CTRL_BG_BRIGHT_MAGENTA "[4;45m"
|
||||
#define RTT_CTRL_BG_BRIGHT_CYAN "[4;46m"
|
||||
#define RTT_CTRL_BG_BRIGHT_WHITE "[4;47m"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*************************** End of file ****************************/
|
||||
+259
@@ -0,0 +1,259 @@
|
||||
/*********************************************************************
|
||||
* SEGGER MICROCONTROLLER GmbH & Co. KG *
|
||||
* Solutions for real time microcontroller applications *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 2014 - 2016 SEGGER Microcontroller GmbH & Co. KG *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SEGGER RTT * Real Time Transfer for embedded targets *
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* * This software may in its unmodified form be freely redistributed *
|
||||
* in source, linkable, or executable form. *
|
||||
* * The source code may be modified, provided the source code *
|
||||
* retains the above copyright notice, this list of conditions and *
|
||||
* the following disclaimer. *
|
||||
* * Modified versions of this software in source, executable, or *
|
||||
* linkable form may not be distributed without prior consent of *
|
||||
* SEGGER. *
|
||||
* * This software may only be used for communication with SEGGER *
|
||||
* J-Link debug probes. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
||||
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
|
||||
* DAMAGE. *
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* RTT version: 6.00e *
|
||||
* *
|
||||
**********************************************************************
|
||||
----------------------------------------------------------------------
|
||||
File : SEGGER_RTT_Conf.h
|
||||
Purpose : Implementation of SEGGER real-time transfer (RTT) which
|
||||
allows real-time communication on targets which support
|
||||
debugger memory accesses while the CPU is running.
|
||||
Revision: $Rev: 3892 $
|
||||
---------------------------END-OF-HEADER------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SEGGER_RTT_CONF_H
|
||||
#define SEGGER_RTT_CONF_H
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <intrinsics.h>
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Defines, configurable
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (3) // Max. number of up-buffers (T->H) available on this target (Default: 3)
|
||||
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (3) // Max. number of down-buffers (H->T) available on this target (Default: 3)
|
||||
|
||||
#define BUFFER_SIZE_UP (64) // Size of the buffer for terminal output of target, up to host (Default: 1k)
|
||||
#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
|
||||
|
||||
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
|
||||
|
||||
#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
|
||||
|
||||
//
|
||||
// Target is not allowed to perform other RTT operations while string still has not been stored completely.
|
||||
// Otherwise we would probably end up with a mixed string in the buffer.
|
||||
// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
|
||||
//
|
||||
// SEGGER_RTT_MAX_INTERRUPT_PRIORITY can be used in the sample lock routines on Cortex-M3/4.
|
||||
// Make sure to mask all interrupts which can send RTT data, i.e. generate SystemView events, or cause task switches.
|
||||
// When high-priority interrupts must not be masked while sending RTT data, SEGGER_RTT_MAX_INTERRUPT_PRIORITY needs to be adjusted accordingly.
|
||||
// (Higher priority = lower priority number)
|
||||
// Default value for embOS: 128u
|
||||
// Default configuration in FreeRTOS: configMAX_SYSCALL_INTERRUPT_PRIORITY: ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
// In case of doubt mask all interrupts: 1 << (8 - BASEPRI_PRIO_BITS) i.e. 1 << 5 when 3 bits are implemented in NVIC
|
||||
// or define SEGGER_RTT_LOCK() to completely disable interrupts.
|
||||
//
|
||||
|
||||
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20)
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT lock configuration for SEGGER Embedded Studio,
|
||||
* Rowley CrossStudio and GCC
|
||||
*/
|
||||
#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__)
|
||||
#ifdef __ARM_ARCH_6M__
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
__asm volatile ("mrs %0, primask \n\t" \
|
||||
"mov r1, $1 \n\t" \
|
||||
"msr primask, r1 \n\t" \
|
||||
: "=r" (LockState) \
|
||||
: \
|
||||
: "r1" \
|
||||
);
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() __asm volatile ("msr primask, %0 \n\t" \
|
||||
: \
|
||||
: "r" (LockState) \
|
||||
: \
|
||||
); \
|
||||
}
|
||||
|
||||
#elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__))
|
||||
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
|
||||
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
|
||||
#endif
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
__asm volatile ("mrs %0, basepri \n\t" \
|
||||
"mov r1, %1 \n\t" \
|
||||
"msr basepri, r1 \n\t" \
|
||||
: "=r" (LockState) \
|
||||
: "i"(SEGGER_RTT_MAX_INTERRUPT_PRIORITY) \
|
||||
: "r1" \
|
||||
);
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() __asm volatile ("msr basepri, %0 \n\t" \
|
||||
: \
|
||||
: "r" (LockState) \
|
||||
: \
|
||||
); \
|
||||
}
|
||||
|
||||
#elif defined(__ARM_ARCH_7A__)
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
__asm volatile ("mrs r1, CPSR \n\t" \
|
||||
"mov %0, r1 \n\t" \
|
||||
"orr r1, r1, #0xC0 \n\t" \
|
||||
"msr CPSR_c, r1 \n\t" \
|
||||
: "=r" (LockState) \
|
||||
: \
|
||||
: "r1" \
|
||||
);
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t" \
|
||||
"mrs r1, CPSR \n\t" \
|
||||
"bic r1, r1, #0xC0 \n\t" \
|
||||
"and r0, r0, #0xC0 \n\t" \
|
||||
"orr r1, r1, r0 \n\t" \
|
||||
"msr CPSR_c, r1 \n\t" \
|
||||
: \
|
||||
: "r" (LockState) \
|
||||
: "r0", "r1" \
|
||||
); \
|
||||
}
|
||||
#else
|
||||
#define SEGGER_RTT_LOCK()
|
||||
#define SEGGER_RTT_UNLOCK()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT lock configuration for IAR EWARM
|
||||
*/
|
||||
#ifdef __ICCARM__
|
||||
#if (defined (__ARM6M__) && (__CORE__ == __ARM6M__))
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
LockState = __get_PRIMASK(); \
|
||||
__set_PRIMASK(1);
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() __set_PRIMASK(LockState); \
|
||||
}
|
||||
#elif ((defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) || (defined (__ARM7M__) && (__CORE__ == __ARM7M__)))
|
||||
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
|
||||
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
|
||||
#endif
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
LockState = __get_BASEPRI(); \
|
||||
__set_BASEPRI(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() __set_BASEPRI(LockState); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT lock configuration for IAR RX
|
||||
*/
|
||||
#ifdef __ICCRX__
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned long LockState; \
|
||||
LockState = __get_interrupt_state(); \
|
||||
__disable_interrupt();
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() __set_interrupt_state(LockState); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT lock configuration for KEIL ARM
|
||||
*/
|
||||
#ifdef __CC_ARM
|
||||
#if (defined __TARGET_ARCH_6S_M)
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
register unsigned char PRIMASK __asm( "primask"); \
|
||||
LockState = PRIMASK; \
|
||||
PRIMASK = 1u; \
|
||||
__schedule_barrier();
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() PRIMASK = LockState; \
|
||||
__schedule_barrier(); \
|
||||
}
|
||||
#elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
|
||||
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
|
||||
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
|
||||
#endif
|
||||
#define SEGGER_RTT_LOCK() { \
|
||||
unsigned int LockState; \
|
||||
register unsigned char BASEPRI __asm( "basepri"); \
|
||||
LockState = BASEPRI; \
|
||||
BASEPRI = SEGGER_RTT_MAX_INTERRUPT_PRIORITY; \
|
||||
__schedule_barrier();
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() BASEPRI = LockState; \
|
||||
__schedule_barrier(); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* RTT lock configuration fallback
|
||||
*/
|
||||
#ifndef SEGGER_RTT_LOCK
|
||||
#define SEGGER_RTT_LOCK() // Lock RTT (nestable) (i.e. disable interrupts)
|
||||
#endif
|
||||
|
||||
#ifndef SEGGER_RTT_UNLOCK
|
||||
#define SEGGER_RTT_UNLOCK() // Unlock RTT (nestable) (i.e. enable previous interrupt lock state)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*************************** End of file ****************************/
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcStreamingPort.h
|
||||
*
|
||||
* The interface definitions for trace streaming ("stream ports").
|
||||
* This "stream port" sets up the recorder to use SEGGER RTT as streaming channel.
|
||||
*
|
||||
* 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_STREAMING_PORT_H
|
||||
#define TRC_STREAMING_PORT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RTT_BUFFER_SIZE_UP
|
||||
*
|
||||
* Defines the size of the "up" RTT buffer (target -> host) to use for writing
|
||||
* the trace data, for RTT buffer 1 or higher.
|
||||
*
|
||||
* This setting is ignored for RTT buffer 0, which can't be reconfigured
|
||||
* in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
|
||||
*
|
||||
* Default buffer size for Tracealyzer is 5000 bytes.
|
||||
*
|
||||
* If you have a stand-alone J-Link probe, the can be decreased to around 1 KB.
|
||||
* But integrated J-Link OB interfaces are slower and needs about 5-10 KB,
|
||||
* depending on the amount of data produced.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RTT_BUFFER_SIZE_UP 5000
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RTT_BUFFER_SIZE_DOWN
|
||||
*
|
||||
* Defines the size of the "down" RTT buffer (host -> target) to use for reading
|
||||
* commands from Tracealyzer, for RTT buffer 1 or higher.
|
||||
*
|
||||
* Default buffer size for Tracealyzer is 32 bytes.
|
||||
*
|
||||
* This setting is ignored for RTT buffer 0, which can't be reconfigured
|
||||
* in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RTT_BUFFER_SIZE_DOWN 32
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RTT_UP_BUFFER_INDEX
|
||||
*
|
||||
* Defines the RTT buffer to use for writing the trace data. Make sure that
|
||||
* the PC application has the same setting (File->Settings).
|
||||
*
|
||||
* Default: 1
|
||||
*
|
||||
* We don't recommend using RTT buffer 0, since mainly intended for terminals.
|
||||
* If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RTT_UP_BUFFER_INDEX 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RTT_DOWN_BUFFER_INDEX
|
||||
*
|
||||
* Defines the RTT buffer to use for reading the trace data. Make sure that
|
||||
* the PC application has the same setting (File->Settings).
|
||||
*
|
||||
* Default: 1
|
||||
*
|
||||
* We don't recommend using RTT buffer 0, since mainly intended for terminals.
|
||||
* If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RTT_DOWN_BUFFER_INDEX 1
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_RTT_MODE
|
||||
* This stream port for J-Link streaming relies on SEGGER RTT, that contains an
|
||||
* internal RAM buffer read by the J-Link probes during execution.
|
||||
*
|
||||
* Possible values:
|
||||
* - SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (default)
|
||||
* - SEGGER_RTT_MODE_NO_BLOCK_SKIP
|
||||
*
|
||||
* We recommend using SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL, to ensure you get a
|
||||
* complete and valid trace. This may however cause blocking if your streaming
|
||||
* interface isn't fast enough, which may disturb the real-time behavior.
|
||||
* We therefore recommend to try SEGGER_RTT_MODE_NO_BLOCK_SKIP as well.
|
||||
* In this mode, Tracealyzer will report lost events if the transfer is not
|
||||
* fast enough. In that case, try increasing the size of the "up buffer".
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RTT_MODE SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
#include "SEGGER_RTT_Conf.h"
|
||||
#include "SEGGER_RTT.h"
|
||||
|
||||
#if (TRC_CFG_RTT_UP_BUFFER_INDEX >= SEGGER_RTT_MAX_NUM_UP_BUFFERS)
|
||||
#error "TRC_CFG_RTT_UP_BUFFER_INDEX must be smaller than SEGGER_RTT_MAX_NUM_UP_BUFFERS"
|
||||
#endif
|
||||
|
||||
#if (TRC_CFG_RTT_DOWN_BUFFER_INDEX >= SEGGER_RTT_MAX_NUM_DOWN_BUFFERS)
|
||||
#error "TRC_CFG_RTT_DOWN_BUFFER_INDEX must be smaller than SEGGER_RTT_MAX_NUM_DOWN_BUFFERS"
|
||||
#endif
|
||||
|
||||
/* If index is defined as 0, the internal RTT buffers will be used instead of this. */
|
||||
#if TRC_CFG_RTT_UP_BUFFER_INDEX == 0
|
||||
#define TRC_RTT_ALLOC_UP() static char* _TzTraceData = NULL; /* Not actually used. Ignore allocation method. */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */
|
||||
#else
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
#define TRC_RTT_ALLOC_UP() char _TzTraceData[TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Static allocation */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */
|
||||
#endif
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC
|
||||
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Dynamic allocation */
|
||||
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_RTT_BUFFER_SIZE_UP);
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) /* Only for custom allocation */
|
||||
#endif
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM
|
||||
#define TRC_RTT_ALLOC_UP() char* _TzTraceData = NULL; /* Custom allocation, user needs to call vTraceSetRecorderDataBuffer before vTraceEnable, to assign this */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Not used in custom mode */
|
||||
#define TRC_ALLOC_CUSTOM_BUFFER(bufname) char bufname [TRC_CFG_RTT_BUFFER_SIZE_UP]; /* Not static in this case, since declared in user code */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Down-buffer. If index is defined as 0, the internal RTT buffers will be used instead of this. */ \
|
||||
#if TRC_CFG_RTT_DOWN_BUFFER_INDEX == 0
|
||||
#define TRC_RTT_ALLOC_DOWN() static char* _TzCtrlData = NULL; /* Not actually used. Ignore allocation method. */
|
||||
#else
|
||||
#define TRC_RTT_ALLOC_DOWN() static char _TzCtrlData[TRC_CFG_RTT_BUFFER_SIZE_DOWN]; /* Always static allocation, since usually small. */
|
||||
#endif
|
||||
|
||||
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() \
|
||||
TRC_RTT_ALLOC_UP() /* Macro that will result in proper UP buffer allocation */ \
|
||||
TRC_RTT_ALLOC_DOWN() /* Macro that will result in proper DOWN buffer allocation */
|
||||
|
||||
#define TRC_STREAM_PORT_INIT() \
|
||||
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
|
||||
SEGGER_RTT_ConfigUpBuffer(TRC_CFG_RTT_UP_BUFFER_INDEX, "TzData", _TzTraceData, TRC_CFG_RTT_BUFFER_SIZE_UP, TRC_CFG_RTT_MODE ); \
|
||||
SEGGER_RTT_ConfigDownBuffer(TRC_CFG_RTT_DOWN_BUFFER_INDEX, "TzCtrl", _TzCtrlData, TRC_CFG_RTT_BUFFER_SIZE_DOWN, TRC_CFG_RTT_MODE);
|
||||
|
||||
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type _tmpArray[_size / sizeof(_type)]; _type* _ptrData = _tmpArray;
|
||||
#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) _type _tmpArray[sizeof(largestEventType) / sizeof(_type)]; _type* _ptrData = _tmpArray;
|
||||
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) SEGGER_RTT_Write(TRC_CFG_RTT_UP_BUFFER_INDEX, (const char*)_ptrData, _size);
|
||||
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) if (SEGGER_RTT_HASDATA(TRC_CFG_RTT_DOWN_BUFFER_INDEX)) *_ptrBytesRead = (int)SEGGER_RTT_Read(TRC_CFG_RTT_DOWN_BUFFER_INDEX, (char*)_ptrData, _size);
|
||||
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent)
|
||||
|
||||
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() /* Do nothing */
|
||||
#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_STREAMING_PORT_H */
|
||||
@@ -0,0 +1,22 @@
|
||||
Tracealyzer Stream Port for TCP/IP (lwIP example)
|
||||
-------------------------------------------------
|
||||
|
||||
This directory contains a "stream port" for the Tracealyzer recorder library,
|
||||
i.e., the specific code needed to use a particular interface for streaming a
|
||||
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
|
||||
trcStreamingPort.h, found in the "include" directory.
|
||||
|
||||
This particular stream port targets TCP/IP. This example assumes lwIP but is
|
||||
easy to modify for other TCP/IP stacks.
|
||||
|
||||
To use this stream port, make sure that include/trcStreamingPort.h is found
|
||||
by the compiler (i.e., add this folder to your project's include paths) and
|
||||
add all included source files to your build. Make sure no other versions of
|
||||
trcStreamingPort.h are included by mistake!
|
||||
|
||||
Note that lwIP is not included, but assumed to exist in the project already.
|
||||
|
||||
See also http://percepio.com/2016/10/05/rtos-tracing.
|
||||
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
@@ -0,0 +1,90 @@
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcStreamingPort.h
|
||||
*
|
||||
* The interface definitions for trace streaming ("stream ports").
|
||||
* This "stream port" sets up the recorder to use TCP/IP as streaming channel.
|
||||
* The example is for lwIP.
|
||||
*
|
||||
* 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_STREAMING_PORT_H
|
||||
#define TRC_STREAMING_PORT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_RECORDER_TRANSFER_METHOD_TCPIP
|
||||
*
|
||||
* This stream port for TCP/IP uses a temporary buffer consisting of multiple
|
||||
* pages, that are transmitted periodically by the TzCtrl task. You can modify
|
||||
* the supporting functions to match your system. See trcStreamingPort.c
|
||||
******************************************************************************/
|
||||
|
||||
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);
|
||||
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead);
|
||||
|
||||
#if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char _TzTraceData[TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE]; /* Static allocation. */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
|
||||
#else
|
||||
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char* _TzTraceData = NULL; /* Dynamic allocation. */
|
||||
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);
|
||||
#endif
|
||||
|
||||
#define TRC_STREAM_PORT_INIT() \
|
||||
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \
|
||||
prvPagedEventBufferInit(_TzTraceData);
|
||||
|
||||
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)prvPagedEventBufferGetWritePointer(_size);
|
||||
#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) /* We do the same thing as for non-dynamic event sizes */
|
||||
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not needed since we write immediately into the buffer received above by TRC_STREAM_PORT_ALLOCATE_EVENT, and the TRC_STREAM_PORT_PERIODIC_SEND_DATA defined below will take care of the actual trace transfer. */
|
||||
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead);
|
||||
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) prvPagedEventBufferTransfer(trcTcpWrite, _ptrBytesSent);
|
||||
|
||||
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() prvPagedEventBufferInit(_TzTraceData);
|
||||
#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_STREAMING_PORT_H */
|
||||
@@ -0,0 +1,183 @@
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcStreamingPort.c
|
||||
*
|
||||
* Supporting functions for trace streaming, used by the "stream ports"
|
||||
* for reading and writing data to the interface.
|
||||
* Existing ports can easily be modified to fit another setup, e.g., a
|
||||
* different TCP/IP stack, or to define your own stream port.
|
||||
*
|
||||
* 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
|
||||
******************************************************************************/
|
||||
|
||||
#include "trcRecorder.h"
|
||||
|
||||
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
|
||||
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
/* TCP/IP includes */
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/sockets.h"
|
||||
|
||||
int errno;
|
||||
|
||||
#define TRC_TCPIP_PORT 12000
|
||||
|
||||
int sock = -1, new_sd = -1;
|
||||
int flags = 0;
|
||||
int remoteSize;
|
||||
struct sockaddr_in address, remote;
|
||||
|
||||
int32_t trcSocketSend( void* data, int32_t size, int32_t* bytesWritten )
|
||||
{
|
||||
if (new_sd < 0)
|
||||
return -1;
|
||||
|
||||
*bytesWritten = send( new_sd, data, size, 0 );
|
||||
if (*bytesWritten < 0)
|
||||
{
|
||||
/* EWOULDBLOCK may be expected when buffers are full */
|
||||
if (errno != EWOULDBLOCK)
|
||||
{
|
||||
closesocket(new_sd);
|
||||
new_sd = -1;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
*bytesWritten = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t trcSocketReceive( void* data, int32_t size, int32_t* bytesRead )
|
||||
{
|
||||
if (new_sd < 0)
|
||||
return -1;
|
||||
|
||||
*bytesRead = recv( new_sd, data, size, 0 );
|
||||
if ( *bytesRead < 0 )
|
||||
{
|
||||
/* EWOULDBLOCK may be expected when there is no data to receive */
|
||||
if (errno != EWOULDBLOCK)
|
||||
{
|
||||
closesocket(new_sd);
|
||||
new_sd = -1;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
*bytesRead = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t trcSocketInitializeListener()
|
||||
{
|
||||
if (sock >= 0)
|
||||
return 0;
|
||||
|
||||
sock = lwip_socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (sock < 0)
|
||||
return -1;
|
||||
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_port = htons( TRC_TCPIP_PORT );
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
if (bind(sock, (struct sockaddr *)&address, sizeof (address)) < 0)
|
||||
{
|
||||
closesocket(sock);
|
||||
sock = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lwip_listen(sock, 5) < 0)
|
||||
{
|
||||
closesocket(sock);
|
||||
sock = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t trcSocketAccept()
|
||||
{
|
||||
if (sock < 0)
|
||||
return -1;
|
||||
|
||||
if (new_sd >= 0)
|
||||
return 0;
|
||||
|
||||
remoteSize = sizeof( remote );
|
||||
new_sd = accept( sock, (struct sockaddr *)&remote, (socklen_t*)&remoteSize );
|
||||
|
||||
flags = fcntl( new_sd, F_GETFL, 0 );
|
||||
fcntl( new_sd, F_SETFL, flags | O_NONBLOCK );
|
||||
|
||||
if( new_sd < 0 )
|
||||
{
|
||||
closesocket(new_sd);
|
||||
new_sd = -1;
|
||||
closesocket(sock);
|
||||
sock = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/************** MODIFY THE ABOVE PART TO USE YOUR TPC/IP STACK ****************/
|
||||
|
||||
int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten)
|
||||
{
|
||||
return trcSocketSend(data, size, ptrBytesWritten);
|
||||
}
|
||||
|
||||
int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead)
|
||||
{
|
||||
trcSocketInitializeListener();
|
||||
|
||||
trcSocketAccept();
|
||||
|
||||
return trcSocketReceive(data, size, ptrBytesRead);
|
||||
}
|
||||
|
||||
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
|
||||
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
|
||||
@@ -0,0 +1,27 @@
|
||||
Tracealyzer Stream Port for USB CDC (STM32 example)
|
||||
---------------------------------------------------
|
||||
|
||||
This directory contains a "stream port" for the Tracealyzer recorder library,
|
||||
i.e., the specific code needed to use a particular interface for streaming a
|
||||
Tracealyzer RTOS trace. The stream port is defined by a set of macros in
|
||||
trcStreamingPort.h, found in the "include" directory.
|
||||
|
||||
This particular stream port targets USB CDC. This is an example for the STM32 USB
|
||||
stack (from the STM32CubeMX code generation tool, v1.4.1) and has been tested on
|
||||
a STM32F767ZI device on a Nucleo board. See this blog post:
|
||||
|
||||
http://percepio.com/2017/02/03/usb-trace-streaming-st-nucleo-f767zi-board/
|
||||
|
||||
However, it should be straight-forward to modify this for other USB stacks.
|
||||
|
||||
To use this stream port, make sure that include/trcStreamingPort.h is found
|
||||
by the compiler (i.e., add this folder to your project's include paths) and
|
||||
add all included source files to your build. Make sure no other versions of
|
||||
trcStreamingPort.h are included by mistake!
|
||||
|
||||
Note that the USB stack not included, but assumed to exist in the project already.
|
||||
|
||||
See also http://percepio.com/2016/10/05/rtos-tracing.
|
||||
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v3.1.2
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcStreamingPort.h
|
||||
*
|
||||
* The interface definitions for trace streaming ("stream ports").
|
||||
* This "stream port" sets up the recorder to use USB CDC as streaming channel.
|
||||
* The example is for STM32 using STM32Cube.
|
||||
*
|
||||
* 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_STREAMING_PORT_H
|
||||
#define TRC_STREAMING_PORT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Implement the below macros to define your own stream port. If your transfer
|
||||
* method uses RTOS functions, you should not send the data directly but use
|
||||
* the recorder's internal buffer to store the trace data, for later transfer by
|
||||
* the TzCtrl task. Check the predefined stream ports for examples on how to use
|
||||
* the internal buffer (e.g., TCP/IP, UART or USB CDC).
|
||||
*
|
||||
* Read more at http://percepio.com/2016/10/05/rtos-tracing/
|
||||
******************************************************************************/
|
||||
|
||||
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
|
||||
#include "usb_device.h"
|
||||
#include "usbd_cdc.h"
|
||||
#include "usbd_CDC_if.h"
|
||||
#include "usb_device.h"
|
||||
|
||||
/* Tested on STM32 devices using Keil/CMSIS USB stack */
|
||||
|
||||
extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
|
||||
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
|
||||
|
||||
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes);
|
||||
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent );
|
||||
|
||||
#if TRC_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char _TzTraceData[TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE]; /* Static allocation. */
|
||||
#define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */
|
||||
#else
|
||||
#define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char* _TzTraceData = NULL; /* Dynamic allocation. */
|
||||
#define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_PAGED_EVENT_BUFFER_PAGE_SIZE);
|
||||
#endif
|
||||
|
||||
#define TRC_STREAM_PORT_INIT() \
|
||||
MX_USB_DEVICE_Init(); \
|
||||
TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */
|
||||
|
||||
#define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)prvPagedEventBufferGetWritePointer(_size);
|
||||
|
||||
#define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) /* We do the same thing as for non-dynamic event sizes */
|
||||
#define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not needed since we write immediately into the buffer received above by TRC_STREAM_PORT_ALLOCATE_EVENT, and the TRC_STREAM_PORT_PERIODIC_SEND_DATA defined below will take care of the actual trace transfer. */
|
||||
#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcCDCReceive(_ptrData, _size, _ptrBytesRead);
|
||||
#define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) prvPagedEventBufferTransfer(trcCDCTransmit, _ptrBytesSent);
|
||||
|
||||
#define TRC_STREAM_PORT_ON_TRACE_BEGIN() { prvPagedEventBufferInit(_TzTraceData); }
|
||||
#define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRC_STREAMING_PORT_H */
|
||||
@@ -0,0 +1,239 @@
|
||||
#include "trcRecorder.h"
|
||||
|
||||
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
|
||||
#if(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
|
||||
#include "usb_device.h"
|
||||
#include "usbd_cdc.h"
|
||||
#include "usbd_CDC_if.h"
|
||||
#include "usb_device.h"
|
||||
|
||||
#define BUFSIZE 64
|
||||
|
||||
typedef struct{
|
||||
uint32_t idx;
|
||||
uint8_t data[BUFSIZE];
|
||||
}recBuf;
|
||||
|
||||
/* Define size for the receive and transmit buffer over CDC */
|
||||
#define APP_RX_DATA_SIZE 8
|
||||
#define APP_TX_DATA_SIZE 64
|
||||
|
||||
/* Received Data over USB are stored in this buffer */
|
||||
uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
|
||||
|
||||
/* Send Data over USB CDC are stored in this buffer */
|
||||
uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
|
||||
|
||||
extern USBD_HandleTypeDef hUsbDeviceFS;
|
||||
extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||
|
||||
|
||||
recBuf commandBuffer;
|
||||
|
||||
static int8_t CDC_Init_FS (void);
|
||||
static int8_t CDC_DeInit_FS (void);
|
||||
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length);
|
||||
static int8_t CDC_Receive_FS (uint8_t* pbuf, uint32_t *Len);
|
||||
|
||||
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
|
||||
{
|
||||
CDC_Init_FS,
|
||||
CDC_DeInit_FS,
|
||||
CDC_Control_FS,
|
||||
CDC_Receive_FS
|
||||
};
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/**
|
||||
* @brief CDC_Init_FS
|
||||
* Initializes the CDC media low layer over the FS USB IP
|
||||
* @param None
|
||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
|
||||
*/
|
||||
static int8_t CDC_Init_FS(void)
|
||||
{
|
||||
/* Set Application Buffers */
|
||||
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
|
||||
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
|
||||
return (USBD_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CDC_DeInit_FS
|
||||
* DeInitializes the CDC media low layer
|
||||
* @param None
|
||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
|
||||
*/
|
||||
static int8_t CDC_DeInit_FS(void)
|
||||
{
|
||||
return (USBD_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CDC_Control_FS
|
||||
* Manage the CDC class requests
|
||||
* @param cmd: Command code
|
||||
* @param pbuf: Buffer containing command data (request parameters)
|
||||
* @param length: Number of data to be sent (in bytes)
|
||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
|
||||
*/
|
||||
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case CDC_SEND_ENCAPSULATED_COMMAND:
|
||||
break;
|
||||
|
||||
case CDC_GET_ENCAPSULATED_RESPONSE:
|
||||
break;
|
||||
|
||||
case CDC_SET_COMM_FEATURE:
|
||||
break;
|
||||
|
||||
case CDC_GET_COMM_FEATURE:
|
||||
break;
|
||||
|
||||
case CDC_CLEAR_COMM_FEATURE:
|
||||
break;
|
||||
|
||||
/*******************************************************************************/
|
||||
/* Line Coding Structure */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Offset | Field | Size | Value | Description */
|
||||
/* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/
|
||||
/* 4 | bCharFormat | 1 | Number | Stop bits */
|
||||
/* 0 - 1 Stop bit */
|
||||
/* 1 - 1.5 Stop bits */
|
||||
/* 2 - 2 Stop bits */
|
||||
/* 5 | bParityType | 1 | Number | Parity */
|
||||
/* 0 - None */
|
||||
/* 1 - Odd */
|
||||
/* 2 - Even */
|
||||
/* 3 - Mark */
|
||||
/* 4 - Space */
|
||||
/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
|
||||
/*******************************************************************************/
|
||||
case CDC_SET_LINE_CODING:
|
||||
break;
|
||||
|
||||
case CDC_GET_LINE_CODING:
|
||||
break;
|
||||
|
||||
case CDC_SET_CONTROL_LINE_STATE:
|
||||
break;
|
||||
|
||||
case CDC_SEND_BREAK:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (USBD_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CDC_Receive_FS
|
||||
* Data received over USB OUT endpoint are sent over CDC interface
|
||||
* through this function.
|
||||
*
|
||||
* @note
|
||||
* This function will block any OUT packet reception on USB endpoint
|
||||
* until exiting this function. If you exit this function before transfer
|
||||
* is complete on CDC interface (i.e. using DMA controller) it will result
|
||||
* in receiving more data while previous ones are still not sent.
|
||||
*
|
||||
* @param Buf: Buffer of data to be received
|
||||
* @param Len: Number of data received (in bytes)
|
||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
|
||||
*/
|
||||
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
|
||||
{
|
||||
for( uint32_t i=0;i<* Len;i++)
|
||||
{
|
||||
commandBuffer.data[commandBuffer.idx]=Buf[i];
|
||||
commandBuffer.idx++;
|
||||
}
|
||||
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
|
||||
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
|
||||
|
||||
return (USBD_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CDC_Transmit_FS
|
||||
* Data send over USB IN endpoint are sent over CDC interface
|
||||
* through this function.
|
||||
* @note
|
||||
*
|
||||
*
|
||||
* @param Buf: Buffer of data to be send
|
||||
* @param Len: Number of data to be send (in bytes)
|
||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
|
||||
*/
|
||||
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
|
||||
{
|
||||
uint8_t result = USBD_OK;
|
||||
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
|
||||
if (hcdc->TxState != 0){
|
||||
return USBD_BUSY;
|
||||
}
|
||||
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
|
||||
result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes)
|
||||
{
|
||||
uint32_t i,diff;
|
||||
|
||||
if(commandBuffer.idx>0)
|
||||
{
|
||||
if (size >= commandBuffer.idx) // more than what is stored, number of bytes will be .idx
|
||||
{
|
||||
memcpy(data,commandBuffer.data, commandBuffer.idx);
|
||||
*NumBytes=commandBuffer.idx;
|
||||
commandBuffer.idx=0; // Make the buffer ready for a new command
|
||||
}
|
||||
else //If some data in the buffer is not read
|
||||
{
|
||||
diff = commandBuffer.idx-size;
|
||||
memcpy(data,commandBuffer.data, size);
|
||||
for(i=0;i<diff;i++)
|
||||
{
|
||||
commandBuffer.data[i]=commandBuffer.data[i+size];
|
||||
}
|
||||
*NumBytes=size;
|
||||
commandBuffer.idx=diff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*NumBytes=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent )
|
||||
{
|
||||
int32_t result;
|
||||
result=CDC_Transmit_FS(data,size);
|
||||
*noOfBytesSent=size;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles USB On The Go FS global interrupt.
|
||||
*/
|
||||
void OTG_FS_IRQHandler(void)
|
||||
{
|
||||
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
|
||||
}
|
||||
|
||||
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
|
||||
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,186 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v3.0.2 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcHardwarePort.c
|
||||
*
|
||||
* Contains together with trcHardwarePort.h all hardware portability issues of
|
||||
* the trace recorder library.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcPort.c and trcPort.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB 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 AB, 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 AB 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, 2014.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#include "trcHardwarePort.h"
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t trace_disable_timestamp = 0;
|
||||
uint32_t last_timestamp = 0;
|
||||
|
||||
/*******************************************************************************
|
||||
* uiTraceTickCount
|
||||
*
|
||||
* This variable is should be updated by the Kernel tick interrupt. This does
|
||||
* not need to be modified when developing a new timer port. It is preferred to
|
||||
* keep any timer port changes in the HWTC macro definitions, which typically
|
||||
* give sufficient flexibility.
|
||||
******************************************************************************/
|
||||
uint32_t uiTraceTickCount = 0;
|
||||
|
||||
uint32_t DWT_CYCLES_ADDED = 0; /* Used on ARM Cortex-M only */
|
||||
|
||||
#if (SELECTED_PORT == PORT_ARM_CortexM)
|
||||
|
||||
void prvTraceInitCortexM()
|
||||
{
|
||||
/* Make sure DWT is enabled is enabled, if supported */
|
||||
REG_DEMCR |= DEMCR_TRCENA;
|
||||
|
||||
do{
|
||||
/* Verify that DWT is supported */
|
||||
if (REG_DEMCR == 0)
|
||||
{
|
||||
vTraceError("DWT not supported by this chip!");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Verify that DWT_CYCCNT is supported */
|
||||
if (REG_DWT_CTRL & DWT_CTRL_NOCYCCNT)
|
||||
{
|
||||
vTraceError("DWT_CYCCNT not supported by this chip!");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Reset the cycle counter */
|
||||
REG_DWT_CYCCNT = 0;
|
||||
|
||||
/* Enable the cycle counter */
|
||||
REG_DWT_CTRL |= DWT_CTRL_CYCCNTENA;
|
||||
|
||||
}while(0); /* breaks above jump here */
|
||||
|
||||
if (RecorderDataPtr->frequency == 0)
|
||||
{
|
||||
RecorderDataPtr->frequency = TRACE_CPU_CLOCK_HZ / HWTC_DIVISOR;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* vTracePortGetTimeStamp
|
||||
*
|
||||
* Returns the current time based on the HWTC macros which provide a hardware
|
||||
* isolation layer towards the hardware timer/counter.
|
||||
*
|
||||
* The HWTC macros and vTracePortGetTimeStamp is the main porting issue
|
||||
* or the trace recorder library. Typically you should not need to change
|
||||
* the code of vTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
******************************************************************************/
|
||||
void vTracePortGetTimeStamp(uint32_t *pTimestamp)
|
||||
{
|
||||
static uint32_t last_traceTickCount = 0;
|
||||
static uint32_t last_hwtc_count = 0;
|
||||
uint32_t traceTickCount = 0;
|
||||
uint32_t hwtc_count = 0;
|
||||
|
||||
if (trace_disable_timestamp == 1)
|
||||
{
|
||||
if (pTimestamp)
|
||||
*pTimestamp = last_timestamp;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Retrieve HWTC_COUNT only once since the same value should be used all throughout this function. */
|
||||
#if (HWTC_COUNT_DIRECTION == DIRECTION_INCREMENTING)
|
||||
hwtc_count = HWTC_COUNT;
|
||||
#elif (HWTC_COUNT_DIRECTION == DIRECTION_DECREMENTING)
|
||||
hwtc_count = HWTC_PERIOD - HWTC_COUNT;
|
||||
#else
|
||||
Junk text to cause compiler error - HWTC_COUNT_DIRECTION is not set correctly!
|
||||
Should be DIRECTION_INCREMENTING or DIRECTION_DECREMENTING
|
||||
#endif
|
||||
|
||||
#if (SELECTED_PORT == PORT_Win32)
|
||||
/* The Win32 port uses ulGetRunTimeCounterValue for timestamping, which in turn
|
||||
uses QueryPerformanceCounter. That function is not always reliable when used over
|
||||
multiple threads. We must therefore handle rare cases where the timestamp is less
|
||||
than the previous. In practice, the Win32 should "never" roll over since the
|
||||
performance counter is 64 bit wide. */
|
||||
|
||||
if (last_hwtc_count > hwtc_count)
|
||||
{
|
||||
hwtc_count = last_hwtc_count;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (last_traceTickCount - uiTraceTickCount - 1 < 0x80000000)
|
||||
{
|
||||
/* This means last_traceTickCount is higher than uiTraceTickCount,
|
||||
so we have previously compensated for a missed tick.
|
||||
Therefore we use the last stored value because that is more accurate. */
|
||||
traceTickCount = last_traceTickCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Business as usual */
|
||||
traceTickCount = uiTraceTickCount;
|
||||
}
|
||||
|
||||
/* Check for overflow. May occur if the update of uiTraceTickCount has been
|
||||
delayed due to disabled interrupts. */
|
||||
if (traceTickCount == last_traceTickCount && hwtc_count < last_hwtc_count)
|
||||
{
|
||||
/* A trace tick has occurred but not been executed by the kernel, so we compensate manually. */
|
||||
traceTickCount++;
|
||||
}
|
||||
|
||||
/* Check if the return address is OK, then we perform the calculation. */
|
||||
if (pTimestamp)
|
||||
{
|
||||
/* Get timestamp from trace ticks. Scale down the period to avoid unwanted overflows. */
|
||||
*pTimestamp = traceTickCount * (HWTC_PERIOD / HWTC_DIVISOR);
|
||||
/* Increase timestamp by (hwtc_count + "lost hardware ticks from scaling down period") / HWTC_DIVISOR. */
|
||||
*pTimestamp += (hwtc_count + traceTickCount * (HWTC_PERIOD % HWTC_DIVISOR)) / HWTC_DIVISOR;
|
||||
|
||||
last_timestamp = *pTimestamp;
|
||||
}
|
||||
|
||||
/* Store the previous values. */
|
||||
last_traceTickCount = traceTickCount;
|
||||
last_hwtc_count = hwtc_count;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user