mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-09-21 18:54:30 +08:00
Update to latest FreeRTOS+Trace recorder code.
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
FreeRTOS+Trace v2.3.0
|
||||
---------------------
|
||||
|
||||
This directory contains the recorder files that the typical FreeRTOS+Trace user needs to be aware of.
|
||||
|
||||
- trcPort.h - contains the hardware ports and the setting of what port to use.
|
||||
- trcConfig.h - contains the recorder configuration.
|
||||
|
||||
The files in this directory are however not referenced by any of the demo projects.
|
||||
Copies of these files are instead found in each Demo project directory.
|
||||
|
||||
These copies are included here to make the TraceRecorderSrc directory complete.
|
||||
|
||||
If you use this template, you will need to update the following macro definitions in trcPort.h:
|
||||
- SELECTED_PORT
|
||||
- IRQ_PRIORITY_ORDER
|
||||
- vTraceConsoleMessage (optional, if console prints are desired)
|
||||
|
||||
Always remember to check the settings used in trcConfig.h.
|
||||
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
+113
-70
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Tracealyzer v2.4.1 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcConfig.h
|
||||
@@ -9,12 +9,12 @@
|
||||
* 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
|
||||
* overapproximated, although larger values values implies more RAM usage.
|
||||
* 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 trcPort.c and trcPort.h
|
||||
* 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
|
||||
@@ -36,11 +36,7 @@
|
||||
* damages, or the exclusion of implied warranties or limitations on how long an
|
||||
* implied warranty may last, so the above limitations may not apply to you.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
@@ -61,7 +57,7 @@
|
||||
* vTracePrintF may use multiple records depending on the number of data args.
|
||||
******************************************************************************/
|
||||
|
||||
#define EVENT_BUFFER_SIZE 1000 /* Adjust wrt. to available RAM */
|
||||
#define EVENT_BUFFER_SIZE 4000 /* Adjust wrt. to available RAM */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -99,6 +95,43 @@
|
||||
******************************************************************************/
|
||||
#define SYMBOL_TABLE_SIZE 1000
|
||||
|
||||
/*******************************************************************************
|
||||
* 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.
|
||||
*
|
||||
* 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 500
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
|
||||
/*******************************************************************************
|
||||
* NTask, NISR, NQueue, NSemaphore, NMutex
|
||||
*
|
||||
@@ -114,35 +147,33 @@
|
||||
*
|
||||
* Using too small values will give an error message through the vTraceError
|
||||
* routine, which makes the error message appear when opening the trace data
|
||||
* in FreeRTOS+Trace. If you are using the recorder status monitor task,
|
||||
* in Tracealyzer. If you are using the recorder status monitor task,
|
||||
* any error messages are displayed in console prints, assuming that the
|
||||
* print macro has been defined properly (vConsolePrintMessage).
|
||||
*
|
||||
* It can be wise to start with very large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage in FreeRTOS+Trace. This is shown by selecting
|
||||
* check the actual usage in Tracealyzer. This is shown by selecting
|
||||
* View -> Trace Details -> Resource Usage -> Object Table
|
||||
*
|
||||
* NOTE 2: Remember to account for all tasks created by FreeRTOS, such as the
|
||||
* IDLE task, the FreeRTOS timer task, and any tasks created by other 3rd party
|
||||
* NOTE 2: Remember to account for all tasks created by the kernel, such as the
|
||||
* IDLE task, timer task, and any tasks created by other 3rd party
|
||||
* software components, such as communication stacks. The recorder also has an
|
||||
* optional monitor task to account for, if this is used.
|
||||
* Moreover, one task slot is used to indicate "(startup)", i.e., a fictive
|
||||
* task that represent the time before the FreeRTOS scheduler starts.
|
||||
* task that represent the time before the scheduler starts.
|
||||
* NTask should thus be at least 2-3 slots larger than your application task count.
|
||||
*
|
||||
* NOTE 3: The FreeRTOS timer task creates a Queue, that should be accounted
|
||||
* for in NQueue.
|
||||
******************************************************************************/
|
||||
#define NTask 15
|
||||
#define NISR 4
|
||||
#define NQueue 3
|
||||
#define NSemaphore 4
|
||||
#define NMutex 2
|
||||
#define NISR 5
|
||||
#define NQueue 5
|
||||
#define NSemaphore 5
|
||||
#define NMutex 5
|
||||
|
||||
/* Maximum object name length for each class (includes zero termination) */
|
||||
#define NameLenTask configMAX_TASK_NAME_LEN
|
||||
#define NameLenISR 10
|
||||
#define NameLenTask 15
|
||||
#define NameLenISR 15
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
@@ -152,12 +183,12 @@
|
||||
*
|
||||
* Macro which should be defined as a string.
|
||||
*
|
||||
* This string is stored in the trace and displayed in FreeRTOS+Trace. Can be
|
||||
* This string is stored in the trace and displayed in Tracealyzer. Can be
|
||||
* used to store, e.g., system version or build date. This is also used to store
|
||||
* internal error messages from the recorder, which if occurs overwrites the
|
||||
* value defined here. This may be maximum 256 chars.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DESCRIPTION "FreeRTOS+Trace Demo"
|
||||
#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DESCRIPTION_MAX_LENGTH
|
||||
@@ -195,6 +226,17 @@
|
||||
* CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
#define USE_TRACE_ASSERT 0
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
@@ -223,8 +265,8 @@
|
||||
* much faster than a printf and can therefore be used in timing critical code.
|
||||
* See vTraceUserEvent() and vTracePrintF() in trcUser.h
|
||||
*
|
||||
* Note that FreeRTOS+Trace Standard Edition or Professional Edition is required
|
||||
* for User Events, they are not displayed in FreeRTOS+Trace Free Edition.
|
||||
* Note that Tracealyzer Standard Edition or Professional Edition is required
|
||||
* for User Events, they are not displayed in Tracealyzer Free Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
@@ -240,6 +282,17 @@
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_NEW_TIME_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If this is zero (1), events will be generated whenever the os clock is
|
||||
* increased.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_NEW_TIME_EVENTS 0
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_ISR_TRACING
|
||||
*
|
||||
@@ -247,10 +300,11 @@
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded to reduce code size. Note, recording ISRs require that you insert
|
||||
* calls to vTraceStoreISRBegin and vTraceStoreISREnd in your interrupt handlers.
|
||||
* There is no automatic recording of ISRs like for task scheduling, since
|
||||
* FreeRTOS does not have a central interrupt dispatcher.
|
||||
* excluded to reduce code size.
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -261,9 +315,8 @@
|
||||
* Default is 1.
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime, e.g., using vTaskDelete or
|
||||
* vQueueDelete. If no deletes are made, this can be set to 0 in order to
|
||||
* exclude the delete-handling code.
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
@@ -272,32 +325,32 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* RECORDER_STORE_MODE
|
||||
* TRACE_RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - STORE_MODE_RING_BUFFER
|
||||
* - STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is STORE_MODE_RING_BUFFER.
|
||||
* - TRACE_STORE_MODE_RING_BUFFER
|
||||
* - TRACE_STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is TRACE_STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With RECORDER_STORE_MODE set to 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 a large trace buffer for
|
||||
* string the whole run since startup. In this mode, the recorder can run
|
||||
* 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 a large trace buffer
|
||||
* for string the whole run since startup. In this mode, the recorder can run
|
||||
* "forever" as the buffer never gets full, i.e., in the sense that it always
|
||||
* has room for more events.
|
||||
*
|
||||
* To fetch the trace in mode STORE_MODE_RING_BUFFER, you need to first halt the
|
||||
* To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the
|
||||
* system using your debugger and then do a RAM dump, or to explicitly stop the
|
||||
* recorder using vTraceStop() and then store/upload the trace data using a
|
||||
* FreeRTOS task that you need to provide yourself. The trace data is found in
|
||||
* the struct RecorderData, initialized in trcBase.c.
|
||||
* task that you need to provide yourself. The trace data is found in the struct
|
||||
* RecorderData, initialized in trcBase.c.
|
||||
*
|
||||
* Note that, if you upload the trace using a RAM dump, i.e., when the system is
|
||||
* halted on a breakpoint or by a debugger command, there is no need to stop the
|
||||
* recorder first.
|
||||
*
|
||||
* When RECORDER_STORE_MODE is STORE_MODE_STOP_WHEN_FULL, the recording is
|
||||
* When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is
|
||||
* stopped when the buffer becomes full. When the recorder stops itself this way
|
||||
* vTracePortEnd() is called which allows for custom actions, such as triggering
|
||||
* a task that stores the trace buffer, i.e., in case taking a RAM dump
|
||||
@@ -305,12 +358,8 @@
|
||||
* saves the trace to file directly, but this is not recommended in a real-time
|
||||
* system since the scheduler is blocked during the processing of vTracePortEnd.
|
||||
*****************************************************************************/
|
||||
#ifndef WIN32
|
||||
#define RECORDER_STORE_MODE STORE_MODE_RING_BUFFER
|
||||
#else
|
||||
/* Default in the Win32 demo */
|
||||
#define RECORDER_STORE_MODE STORE_MODE_STOP_WHEN_FULL
|
||||
#endif
|
||||
|
||||
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
|
||||
|
||||
/******************************************************************************
|
||||
* STOP_AFTER_N_EVENTS
|
||||
@@ -337,27 +386,21 @@
|
||||
*
|
||||
* For tasks with "infinite" main loops (non-terminating tasks), the concept
|
||||
* of a task instance has no clear definition, it is an application-specific
|
||||
* thing. FreeRTOS+Trace allows you to define Instance Finish Events (IFEs),
|
||||
* thing. Tracealyzer allows you to define Instance Finish Events (IFEs),
|
||||
* which marks the point in a cyclic task when the "task instance" ends.
|
||||
* The IFE is a blocking kernel call, typically in the main loop of a task
|
||||
* which typically reads a message queue, waits for a semaphore or performs
|
||||
* an explicit delay.
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the following FreeRTOS kernel calls
|
||||
* are considered by default to be IFEs (Implicit IFEs):
|
||||
* - vTaskDelay
|
||||
* - vTaskDelayUntil
|
||||
* - vTaskSuspend
|
||||
* - xQueueReceive (blocking cases only)
|
||||
* - xSemaphoreTake (blocking cases only)
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)
|
||||
* will define what kernel calls are considered by default to be IFEs.
|
||||
*
|
||||
* However, Implicit IFEs only applies to blocking kernel calls. If an
|
||||
* xQueueReceive reads a message without blocking, it does not create a new
|
||||
* However, Implicit IFEs only applies to blocking kernel calls. If a
|
||||
* service reads a message without blocking, it does not create a new
|
||||
* instance since no blocking occurred.
|
||||
*
|
||||
* Moreover, the actual IFE might sometimes be another blocking call such as
|
||||
* xQueueSend or xSemaphoreGive. We therefore allow for user-defined
|
||||
* Explicit IFEs by calling
|
||||
* Moreover, the actual IFE might sometimes be another blocking call. We
|
||||
* therefore allow for user-defined Explicit IFEs by calling
|
||||
*
|
||||
* vTraceTaskInstanceIsFinished()
|
||||
*
|
||||
@@ -365,8 +408,8 @@
|
||||
* additional event but instead stores the service code and object handle
|
||||
* of the IFE call as properties of the task.
|
||||
*
|
||||
* If using Explicit IFEs and the task also calls an Implicit IFE like
|
||||
* vTaskDelay, this may result in additional incorrect task instances.
|
||||
* If using Explicit IFEs and the task also calls an Implicit IFE, this may
|
||||
* result in additional incorrect task instances.
|
||||
* This is solved by disabling the Implicit IFEs for the task, by adding
|
||||
* a call to
|
||||
*
|
||||
@@ -440,9 +483,9 @@
|
||||
* be mapped to your console "printf" routine. The task is named TraceMon but
|
||||
* is intentionally excluded from the demo trace.
|
||||
*
|
||||
* Default is 1000 FreeRTOS ticks (typically 1 second). On the Windows port, a
|
||||
* lower value is suggested since the Windows port runs very slowly, often 20-40
|
||||
* times slower than the simulated FreeRTOS time.
|
||||
* Default is 1000 ticks (typically 1 second). On the Windows port, a lower
|
||||
* value is suggested since the Windows port runs very slowly, often 20-40
|
||||
* times slower than the simulated time.
|
||||
*
|
||||
* See vTraceMonitorTask in trcUser.c
|
||||
*****************************************************************************/
|
||||
+65
-81
@@ -1,11 +1,11 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Tracealyzer v2.4.1 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcPort.h
|
||||
* trcHardwarePort.h
|
||||
*
|
||||
* Contains together with trcPort.c all portability issues of the trace recorder
|
||||
* library.
|
||||
* Contains together with trcHardwarePort.c all hardware portability issues of
|
||||
* the trace recorder library.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
@@ -32,18 +32,16 @@
|
||||
* 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.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCPORT_H
|
||||
#define TRCPORT_H
|
||||
|
||||
/* If FreeRTOS Win32 port */
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
/* If Win32 port */
|
||||
#ifdef WIN32
|
||||
|
||||
#undef _WIN32_WINNT
|
||||
@@ -74,16 +72,13 @@
|
||||
* 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. Note that this gives suboptimal display in FreeRTOS+Trace. 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 exection
|
||||
* time of zero. They are however still visible in FreeRTOS+Trace.
|
||||
* 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.
|
||||
*
|
||||
* PORT_Win32
|
||||
* "Accurate" timestamping based on the Windows permance counter. Note that
|
||||
* this gives the host machine time, not the simulated FreeRTOS time (tick
|
||||
* count). The timing of the Win32 FreeRTOS build is not real-time, since it
|
||||
* depends on the scheduling and tick rate of Windows, which is very slow.
|
||||
* "Accurate" timestamping based on the Windows performance counter. Note that
|
||||
* this gives the host machine time.
|
||||
*
|
||||
* Officially supported hardware timer ports:
|
||||
* - PORT_Atmel_AT91SAM7
|
||||
@@ -96,7 +91,7 @@
|
||||
* been developed by external contributors, and have not yet been verified
|
||||
* by Percepio AB. Let us know if you have problems getting these to work.
|
||||
*
|
||||
* Unoffical hardware specific ports provided are:
|
||||
* Unofficial hardware specific ports provided are:
|
||||
* - PORT_TEXAS_INSTRUMENTS_TMS570
|
||||
* - PORT_TEXAS_INSTRUMENTS_MSP430
|
||||
* - PORT_MICROCHIP_PIC32
|
||||
@@ -140,29 +135,29 @@
|
||||
*
|
||||
* Macro which should be defined as an integer of 0 or 1.
|
||||
*
|
||||
* This should be 0 if lower irq priority values implies higher priority
|
||||
* This should be 0 if lower IRQ priority values implies higher priority
|
||||
* levels, such as on ARM Cortex M. If the opposite scheme is used, i.e.,
|
||||
* if higher irq priority values means higher priority, this should be 1.
|
||||
* if higher IRQ priority values means higher priority, this should be 1.
|
||||
*
|
||||
* This setting is not critical. It is used only to sort and colorize the
|
||||
* interrupts in priority order, in case you record interrupts using
|
||||
* the vTraceStoreISRBegin and vTraceStoreISREnd routines.
|
||||
*
|
||||
* We provide this setting for some hardware architectures below:
|
||||
* - ARM Cortex M: 0 (lower irq priority values are more significant)
|
||||
* - Atmel AT91SAM7x: 1 (higher irq priority values are more significant)
|
||||
* - Atmel AVR32: 1 (higher irq priority values are more significant)
|
||||
* - Renesas RX600: 1 (higher irq priority values are more significant)
|
||||
* - Microchip PIC24: 0 (lower irq priority values are more significant)
|
||||
* - Microchip dsPIC: 0 (lower irq priority values are more significant)
|
||||
* - TI TMS570: 0 (lower irq priority values are more significant)
|
||||
* - Freescale HCS08: 0 (lower irq priority values are more significant)
|
||||
* - Freescale HCS12: 0 (lower irq priority values are more significant)
|
||||
* - PowerPC 405: 0 (lower irq priority values are more significant)
|
||||
* - PowerPC 440: 0 (lower irq priority values are more significant)
|
||||
* - Freescale ColdFire: 1 (higher irq priority values are more significant)
|
||||
* - NXP LPC210x: 0 (lower irq priority values are more significant)
|
||||
* - MicroBlaze: 0 (lower irq priority values are more significant)
|
||||
* - ARM Cortex M: 0 (lower IRQ priority values are more significant)
|
||||
* - Atmel AT91SAM7x: 1 (higher IRQ priority values are more significant)
|
||||
* - Atmel AVR32: 1 (higher IRQ priority values are more significant)
|
||||
* - Renesas RX600: 1 (higher IRQ priority values are more significant)
|
||||
* - Microchip PIC24: 0 (lower IRQ priority values are more significant)
|
||||
* - Microchip dsPIC: 0 (lower IRQ priority values are more significant)
|
||||
* - TI TMS570: 0 (lower IRQ priority values are more significant)
|
||||
* - Freescale HCS08: 0 (lower IRQ priority values are more significant)
|
||||
* - Freescale HCS12: 0 (lower IRQ priority values are more significant)
|
||||
* - PowerPC 405: 0 (lower IRQ priority values are more significant)
|
||||
* - PowerPC 440: 0 (lower IRQ priority values are more significant)
|
||||
* - Freescale ColdFire: 1 (higher IRQ priority values are more significant)
|
||||
* - NXP LPC210x: 0 (lower IRQ priority values are more significant)
|
||||
* - MicroBlaze: 0 (lower IRQ priority values are more significant)
|
||||
*
|
||||
* If your chip is not on the above list, and you perhaps know this detail by
|
||||
* heart, please inform us by e-mail to support@percepio.com.
|
||||
@@ -206,17 +201,9 @@
|
||||
* Cortex M chip running at 72 MHZ should use a HWTC_DIVISOR of 2, while a
|
||||
* faster chip require a higher HWTC_DIVISOR value.
|
||||
*
|
||||
* The HWTC macros and uiTracePortGetTimeStamp is the main porting issue
|
||||
* 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 uiTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
* FREE LICENSE OFFER FROM PERCEPIO
|
||||
*
|
||||
* For silicon companies and non-corporate FreeRTOS users (researchers, students,
|
||||
* hobbyists or early-phase startups) we have the following offer:
|
||||
* Provide a hardware port for our FreeRTOS recorder and get a FREE single-user
|
||||
* license for FreeRTOS+Trace Professional Edition. Read more about this offer
|
||||
* at www.percepio.com or contact us directly at support@percepio.com.
|
||||
* the code of vTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@@ -248,7 +235,7 @@
|
||||
#define HWTC_PERIOD 2995
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_Atmel_UC3A0)
|
||||
|
||||
@@ -256,10 +243,10 @@
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT sysreg_read(AVR32_COUNT)
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_ARM_CortexM)
|
||||
|
||||
@@ -270,7 +257,7 @@
|
||||
#define HWTC_PERIOD ((*(uint32_t*)0xE000E014) + 1)
|
||||
#define HWTC_DIVISOR 2
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_Renesas_RX600)
|
||||
|
||||
@@ -278,19 +265,19 @@
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (CMT0.CMCNT)
|
||||
#define HWTC_PERIOD ((((configPERIPHERAL_CLOCK_HZ/configTICK_RATE_HZ)-1)/8))
|
||||
#define HWTC_PERIOD ((((TRACE_PERIPHERAL_CLOCK_HZ/TRACE_TICK_RATE_HZ)-1)/8))
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_MICROCHIP_dsPIC_AND_PIC24)
|
||||
#elif (SELECTED_PORT == PORT_Microchip_dsPIC_AND_PIC24)
|
||||
|
||||
/* For Microchip PIC24 and dsPIC (16 bit) */
|
||||
|
||||
/* Note: The trace library was originally designed for 32-bit MCUs, and is slower
|
||||
than intended on 16-bit MCUs. Storing an event on a PIC24 takes about 70 µs.
|
||||
In comparison, 32-bit MCUs are often 10-20 times faster. If recording overhead
|
||||
becomes a problem on PIC24, use the filters to exclude less interresting tasks
|
||||
becomes a problem on PIC24, use the filters to exclude less interesting tasks
|
||||
or system calls. */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
@@ -298,21 +285,19 @@
|
||||
#define HWTC_PERIOD (PR1+1)
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_NXP_LPC210X)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
/* Tested with LPC2106, but should work with most LPC21XX chips.
|
||||
Assumption: prescaler is 1:1 (this setting is hardcoded in
|
||||
FreeRTOS port for LPC21XX) */
|
||||
/* Tested with LPC2106, but should work with most LPC21XX chips. */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT *((uint32_t *)0xE0004008 )
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_TMS570)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
@@ -325,17 +310,17 @@
|
||||
#define HWTC_PERIOD (RTIUDCP0)
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_MSP430)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (TA0R)
|
||||
#define HWTC_PERIOD configCPU_CLOCKS_PER_TICK
|
||||
#define HWTC_PERIOD TRACE_CPU_CLOCKS_PER_TICK
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_MICROCHIP_PIC32)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
@@ -345,17 +330,17 @@
|
||||
#define HWTC_PERIOD (ReadPeriod1()+1) /* Should be available in BSP */
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_XILINX_PPC405)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
|
||||
#define HWTC_COUNT mfspr( 0x3db)
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_XILINX_PPC440)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
@@ -364,16 +349,15 @@
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
|
||||
#define HWTC_COUNT mfspr( 0x016 )
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT == PORT_XILINX_MICROBLAZE)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
/* This should work with most Microblaze configurations
|
||||
* This port is based on the official FreeRTOS Microlaze port and example application.
|
||||
/* This should work with most Microblaze configurations.
|
||||
* It uses the AXI Timer 0 - the tick interrupt source.
|
||||
* If an AXI Timer 0 peripheral is available on your hardware platform, no modifications are required.
|
||||
*/
|
||||
@@ -381,10 +365,10 @@
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
|
||||
#define HWTC_COUNT XTmrCtr_GetTimerCounterReg( XPAR_TMRCTR_0_BASEADDR, 0 )
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_PERIOD ( TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 16
|
||||
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower irq priority values are more significant
|
||||
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
|
||||
|
||||
#elif (SELECTED_PORT != PORT_NOT_SET)
|
||||
|
||||
@@ -437,23 +421,17 @@
|
||||
#define vTraceConsoleMessage(x)
|
||||
|
||||
/*******************************************************************************
|
||||
* uiTracePortGetTimeStamp
|
||||
* 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 uiTracePortGetTimeStamp is the main porting issue
|
||||
* 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 uiTracePortGetTimeStamp if using the HWTC macros.
|
||||
* the code of vTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
* OFFER FROM PERCEPIO:
|
||||
* For silicon companies and non-corporate FreeRTOS users (researchers,
|
||||
* students, hobbyists or early-phase startups) we have an attractive offer:
|
||||
* Provide a hardware timer port and get a FREE single-user licence for
|
||||
* FreeRTOS+Trace Professional Edition. Read more about this offer at
|
||||
* www.percepio.com or contact us directly at support@percepio.com.
|
||||
******************************************************************************/
|
||||
void uiTracePortGetTimeStamp(uint32_t *puiTimestamp);
|
||||
void vTracePortGetTimeStamp(uint32_t *puiTimestamp);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTracePortEnd
|
||||
@@ -485,6 +463,12 @@ void vTracePortSetOutFile(char* path);
|
||||
******************************************************************************/
|
||||
void vTracePortSave(void);
|
||||
|
||||
#else
|
||||
|
||||
#define vTraceConsoleMessage(x)
|
||||
#define vTracePortSetOutFile(path)
|
||||
#define vTracePortSave(void)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,308 +1,193 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcHooks.h
|
||||
*
|
||||
* The kernel integration hooks for FreeRTOS (v7.1.0 or later). This file should
|
||||
* be included in the end of FreeRTOSConfig.h, together with:
|
||||
*
|
||||
* #define configUSE_TRACE_FACILITY 1
|
||||
*
|
||||
* 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 "percepio/Include/trcHooks.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.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
* Tracealyzer v2.4.1 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 "percepio/Include/trcKernelHooks.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 TRCHOOKS_H
|
||||
#define TRCHOOKS_H
|
||||
#ifndef TRCKERNELHOOKS_H
|
||||
#define TRCKERNELHOOKS_H
|
||||
|
||||
#if (configUSE_TRACE_FACILITY == 1)
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#include "trcUser.h"
|
||||
|
||||
#undef INCLUDE_xTaskGetSchedulerState
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
#undef INCLUDE_xTaskGetCurrentTaskHandle
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
|
||||
#if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1
|
||||
/* Called for each task that becomes ready */
|
||||
#undef traceMOVED_TASK_TO_READY_STATE
|
||||
#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
|
||||
vTraceStoreTaskReady((unsigned char)pxTCB->uxTaskNumber);
|
||||
#endif
|
||||
|
||||
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */
|
||||
#undef traceTASK_INCREMENT_TICK
|
||||
#define traceTASK_INCREMENT_TICK( xTickCount ) \
|
||||
if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) {extern uint32_t uiTraceTickCount; uiTraceTickCount++; uiTracePortGetTimeStamp(0);}
|
||||
#undef INCLUDE_xTaskGetSchedulerState
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
/* Called on each task-switch */
|
||||
#undef traceTASK_SWITCHED_IN
|
||||
#define traceTASK_SWITCHED_IN() \
|
||||
vTraceStoreTaskswitch();
|
||||
|
||||
/* Called on vTaskSuspend */
|
||||
#undef traceTASK_SUSPEND
|
||||
#define traceTASK_SUSPEND( pxTaskToSuspend ) \
|
||||
vTraceStoreKernelCall(TASK_SUSPEND, TRACE_CLASS_TASK, pxTaskToSuspend->uxTaskNumber); \
|
||||
vTraceSetTaskInstanceFinished((uint8_t)pxTaskToSuspend->uxTaskNumber);
|
||||
|
||||
/* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */
|
||||
#undef traceTASK_DELAY
|
||||
#define traceTASK_DELAY() \
|
||||
portENTER_CRITICAL(); \
|
||||
vTraceStoreKernelCallWithNumericParamOnly(TASK_DELAY, (uint16_t)xTicksToDelay);\
|
||||
vTraceSetTaskInstanceFinished((uint8_t)pxCurrentTCB->uxTaskNumber);\
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */
|
||||
#undef traceTASK_DELAY_UNTIL
|
||||
#define traceTASK_DELAY_UNTIL() \
|
||||
portENTER_CRITICAL(); \
|
||||
vTraceStoreKernelCallWithNumericParamOnly(TASK_DELAY_UNTIL, (uint16_t)xTimeToWake); \
|
||||
vTraceSetTaskInstanceFinished((uint8_t)pxCurrentTCB->uxTaskNumber); \
|
||||
portEXIT_CRITICAL();
|
||||
#undef INCLUDE_xTaskGetCurrentTaskHandle
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
|
||||
#ifndef INCLUDE_OBJECT_DELETE
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
#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)
|
||||
/* Called on vTaskDelete */
|
||||
#undef traceTASK_DELETE
|
||||
#define traceTASK_DELETE( pxTaskToDelete ) \
|
||||
trcCRITICAL_SECTION_BEGIN(); \
|
||||
vTraceStoreKernelCall(EVENTGROUP_DELETE + TRACE_CLASS_TASK, TRACE_CLASS_TASK, pxTaskToDelete->uxTaskNumber); \
|
||||
vTraceStoreObjectNameOnCloseEvent((objectHandleType)pxTaskToDelete->uxTaskNumber, TRACE_CLASS_TASK); \
|
||||
vTraceStoreObjectPropertiesOnCloseEvent((objectHandleType)pxTaskToDelete->uxTaskNumber, TRACE_CLASS_TASK); \
|
||||
vTraceSetPriorityProperty(TRACE_CLASS_TASK, (objectHandleType)pxTaskToDelete->uxTaskNumber, (uint8_t)pxTaskToDelete->uxPriority); \
|
||||
vTraceSetObjectState(TRACE_CLASS_TASK, (objectHandleType)pxTaskToDelete->uxTaskNumber, TASK_STATE_INSTANCE_NOT_ACTIVE); \
|
||||
vTraceFreeObjectHandle(TRACE_CLASS_TASK, (objectHandleType)pxTaskToDelete->uxTaskNumber); \
|
||||
trcCRITICAL_SECTION_END();
|
||||
/* 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
|
||||
|
||||
/* Called on vTaskCreate */
|
||||
#undef traceTASK_CREATE
|
||||
#define traceTASK_CREATE( pxNewTCB ) \
|
||||
if (pxNewTCB != NULL){ \
|
||||
pxNewTCB->uxTaskNumber = xTraceGetObjectHandle(TRACE_CLASS_TASK); \
|
||||
vTraceSetObjectName(TRACE_CLASS_TASK, (objectHandleType)pxNewTCB->uxTaskNumber, (char*)pxNewTCB->pcTaskName); \
|
||||
vTraceSetPriorityProperty(TRACE_CLASS_TASK, (objectHandleType)pxNewTCB->uxTaskNumber, (uint8_t)pxNewTCB->uxPriority); \
|
||||
vTraceStoreKernelCall(EVENTGROUP_CREATE + TRACE_CLASS_TASK, TRACE_CLASS_TASK, pxNewTCB->uxTaskNumber);\
|
||||
}
|
||||
|
||||
/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */
|
||||
#undef traceTASK_CREATE_FAILED
|
||||
#define traceTASK_CREATE_FAILED() \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_CREATE + TRACE_CLASS_TASK, TRACE_CLASS_TASK, 0); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */
|
||||
#undef traceQUEUE_CREATE
|
||||
#define traceQUEUE_CREATE( pxNewQueue )\
|
||||
portENTER_CRITICAL(); \
|
||||
pxNewQueue->ucQueueNumber = xTraceGetObjectHandle(TraceObjectClassTable[pxNewQueue->ucQueueType]);\
|
||||
vTraceStoreKernelCall(EVENTGROUP_CREATE + TraceObjectClassTable[pxNewQueue->ucQueueType], TraceObjectClassTable[pxNewQueue->ucQueueType], pxNewQueue->ucQueueNumber); \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxNewQueue->ucQueueType], pxNewQueue->ucQueueNumber, 0); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called in xQueueCreate, if the queue creation fails */
|
||||
#undef traceQUEUE_CREATE_FAILED
|
||||
#define traceQUEUE_CREATE_FAILED( queueType ) \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall((uint8_t)(EVENTGROUP_FAILED_CREATE + TraceObjectClassTable[queueType]), TraceObjectClassTable[queueType], 0); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */
|
||||
#undef traceCREATE_MUTEX
|
||||
#define traceCREATE_MUTEX( pxNewQueue ) \
|
||||
portENTER_CRITICAL();\
|
||||
pxNewQueue->ucQueueNumber = xTraceGetObjectHandle(TRACE_CLASS_MUTEX); \
|
||||
vTraceStoreKernelCall(EVENTGROUP_CREATE + TraceObjectClassTable[pxNewQueue->ucQueueType], TraceObjectClassTable[pxNewQueue->ucQueueType], pxNewQueue->ucQueueNumber); \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxNewQueue->ucQueueType], pxNewQueue->ucQueueNumber, 0); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */
|
||||
#undef traceCREATE_MUTEX_FAILED
|
||||
#define traceCREATE_MUTEX_FAILED() \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_CREATE + TRACE_CLASS_MUTEX, TRACE_CLASS_MUTEX, 0);\
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called when the Mutex can not be given, since not holder */
|
||||
#undef traceGIVE_MUTEX_RECURSIVE_FAILED
|
||||
#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_SEND + TRACE_CLASS_MUTEX, TRACE_CLASS_MUTEX, pxMutex->ucQueueNumber); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called when a message is sent to a queue */
|
||||
#undef traceQUEUE_SEND
|
||||
#define traceQUEUE_SEND( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_SEND + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
if (TraceObjectClassTable[pxQueue->ucQueueType] == TRACE_CLASS_MUTEX){\
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (uint8_t)pxQueue->ucQueueNumber, (uint8_t)0); \
|
||||
}else{\
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (uint8_t)pxQueue->ucQueueNumber, (uint8_t)(pxQueue->uxMessagesWaiting + 1)); \
|
||||
}
|
||||
|
||||
/* Called when a message failed to be sent to a queue (timeout) */
|
||||
#undef traceQUEUE_SEND_FAILED
|
||||
#define traceQUEUE_SEND_FAILED( pxQueue ) \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_SEND + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called when the task is blocked due to a send operation on a full queue */
|
||||
#undef traceBLOCKING_ON_QUEUE_SEND
|
||||
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall(EVENTGROUP_BLOCK_ON_SEND + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called when a message is received from a queue */
|
||||
#undef traceQUEUE_RECEIVE
|
||||
#define traceQUEUE_RECEIVE( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_RECEIVE + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
if (TraceObjectClassTable[pxQueue->ucQueueType] == TRACE_CLASS_MUTEX){\
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber, (objectHandleType)uxTaskGetTaskNumber((xTaskHandle)pxCurrentTCB)); /*For mutex, store the new owner rather than queue length */ \
|
||||
}else{\
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber, (uint8_t)(pxQueue->uxMessagesWaiting - 1)); \
|
||||
}
|
||||
|
||||
/* Called when the task is blocked due to a receive operation on an empty queue */
|
||||
#undef traceBLOCKING_ON_QUEUE_RECEIVE
|
||||
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \
|
||||
portENTER_CRITICAL(); \
|
||||
vTraceStoreKernelCall(EVENTGROUP_BLOCK_ON_RECEIVE + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
if (TraceObjectClassTable[pxQueue->ucQueueType] != TRACE_CLASS_MUTEX){\
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
vTraceSetTaskInstanceFinished((objectHandleType)uxTaskGetTaskNumber((xTaskHandle)pxCurrentTCB)); \
|
||||
}\
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called on xQueuePeek */
|
||||
#undef traceQUEUE_PEEK
|
||||
#define traceQUEUE_PEEK( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_PEEK + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber);
|
||||
|
||||
/* Called when a receive operation on a queue fails (timeout) */
|
||||
#undef traceQUEUE_RECEIVE_FAILED
|
||||
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \
|
||||
portENTER_CRITICAL(); \
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_RECEIVE + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */
|
||||
#undef traceQUEUE_SEND_FROM_ISR
|
||||
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_SEND_FROM_ISR + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber, (uint8_t)(pxQueue->uxMessagesWaiting + 1));
|
||||
|
||||
/* Called when a message send from interrupt context fails (since the queue was full) */
|
||||
#undef traceQUEUE_SEND_FROM_ISR_FAILED
|
||||
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_SEND_FROM_ISR + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber);
|
||||
|
||||
/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */
|
||||
#undef traceQUEUE_RECEIVE_FROM_ISR
|
||||
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_RECEIVE_FROM_ISR + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber, (uint8_t)(pxQueue->uxMessagesWaiting - 1));
|
||||
|
||||
/* Called when a message receive from interrupt context fails (since the queue was empty) */
|
||||
#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED
|
||||
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \
|
||||
vTraceStoreKernelCall(EVENTGROUP_FAILED_RECEIVE_FROM_ISR + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber);
|
||||
|
||||
#if (INCLUDE_OBJECT_DELETE == 1)
|
||||
/* Called on vQueueDelete */
|
||||
#undef traceQUEUE_DELETE
|
||||
#define traceQUEUE_DELETE( pxQueue ) \
|
||||
{ \
|
||||
portENTER_CRITICAL();\
|
||||
vTraceStoreKernelCall(EVENTGROUP_DELETE + TraceObjectClassTable[pxQueue->ucQueueType], TraceObjectClassTable[pxQueue->ucQueueType], pxQueue->ucQueueNumber); \
|
||||
vTraceStoreObjectNameOnCloseEvent((objectHandleType)pxQueue->ucQueueNumber, TraceObjectClassTable[pxQueue->ucQueueType]); \
|
||||
vTraceStoreObjectPropertiesOnCloseEvent((objectHandleType)pxQueue->ucQueueNumber, TraceObjectClassTable[pxQueue->ucQueueType]); \
|
||||
if (TraceObjectClassTable[pxQueue->ucQueueType] == TRACE_CLASS_MUTEX){ \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber, (objectHandleType)uxTaskGetTaskNumber((xTaskHandle)pxQueue->pxMutexHolder)); \
|
||||
}else{ \
|
||||
vTraceSetObjectState(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber, (uint8_t)uxQueueMessagesWaiting(pxQueue)); \
|
||||
} \
|
||||
vTraceFreeObjectHandle(TraceObjectClassTable[pxQueue->ucQueueType], (objectHandleType)pxQueue->ucQueueNumber); \
|
||||
portEXIT_CRITICAL();\
|
||||
}
|
||||
/* 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
|
||||
|
||||
/* Called in vTaskPrioritySet */
|
||||
#undef traceTASK_PRIORITY_SET
|
||||
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \
|
||||
vTraceStoreKernelCallWithParam(TASK_PRIORITY_SET, TRACE_CLASS_TASK, pxTask->uxTaskNumber, uiTraceGetPriorityProperty(TRACE_CLASS_TASK, (uint8_t)pxTask->uxTaskNumber));\
|
||||
vTraceSetPriorityProperty( TRACE_CLASS_TASK, (uint8_t)pxTask->uxTaskNumber, (uint8_t)uxNewPriority);
|
||||
|
||||
/* Called in vTaskPriorityInherit, which is called by Mutex operations */
|
||||
#undef traceTASK_PRIORITY_INHERIT
|
||||
#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \
|
||||
vTraceStoreKernelCallWithParam(TASK_PRIORITY_INHERIT, TRACE_CLASS_TASK, pxTask->uxTaskNumber, uiTraceGetPriorityProperty(TRACE_CLASS_TASK, (uint8_t)pxTask->uxTaskNumber));\
|
||||
vTraceSetPriorityProperty( TRACE_CLASS_TASK, (uint8_t)pxTask->uxTaskNumber, (uint8_t)uxNewPriority );
|
||||
/* This macro will create a task in the object table */
|
||||
#undef trcKERNEL_HOOKS_TASK_CREATE
|
||||
#define trcKERNEL_HOOKS_TASK_CREATE(SERVICE, 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));
|
||||
|
||||
/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */
|
||||
#undef traceTASK_PRIORITY_DISINHERIT
|
||||
#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \
|
||||
vTraceStoreKernelCallWithParam(TASK_PRIORITY_DISINHERIT, TRACE_CLASS_TASK, pxTask->uxTaskNumber, uiTraceGetPriorityProperty(TRACE_CLASS_TASK, (uint8_t)pxTask->uxTaskNumber));\
|
||||
vTraceSetPriorityProperty( TRACE_CLASS_TASK, (uint8_t)pxTask->uxTaskNumber, (uint8_t)uxNewPriority );
|
||||
/* 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) \
|
||||
vTraceStoreKernelCall(TRACE_GET_TASK_EVENT_CODE(SERVICE, FAILED, CLASS, pxTCB), TRACE_CLASS_TASK, 0);
|
||||
|
||||
/* Called in vTaskResume */
|
||||
#undef traceTASK_RESUME
|
||||
#define traceTASK_RESUME( pxTaskToResume ) \
|
||||
vTraceStoreKernelCall(TASK_RESUME, TRACE_CLASS_TASK, pxTaskToResume->uxTaskNumber);
|
||||
/* 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);
|
||||
|
||||
/* Called in vTaskResumeFromISR */
|
||||
#undef traceTASK_RESUME_FROM_ISR
|
||||
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume )\
|
||||
vTraceStoreKernelCall(TASK_RESUME_FROM_ISR, TRACE_CLASS_TASK, pxTaskToResume->uxTaskNumber);
|
||||
/* 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(CLASS, pxObject) \
|
||||
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));
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* TRCKERNELHOOKS_H */
|
||||
|
||||
@@ -1,64 +1,61 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Tracealyzer v2.4.1 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcKernel.h
|
||||
*
|
||||
* Functions used by trcHooks.h, for the FreeRTOS kernel integration.
|
||||
* 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 trcPort.c and trcPort.h
|
||||
* 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
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCKERNEL_H
|
||||
#define TRCKERNEL_H
|
||||
|
||||
#include "trcBase.h"
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
/* Internal functions */
|
||||
|
||||
|
||||
#if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1
|
||||
void vTraceStoreTaskReady(objectHandleType handle);
|
||||
#endif
|
||||
|
||||
void vTraceStoreTaskswitch(void);
|
||||
void vTraceStoreTaskswitch(objectHandleType task_handle);
|
||||
|
||||
void vTraceStoreKernelCall(uint32_t eventcode, traceObjectClass objectClass, uint32_t byteParam);
|
||||
void vTraceStoreKernelCall(uint32_t eventcode, traceObjectClass objectClass, uint32_t byteParam);
|
||||
|
||||
void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode,
|
||||
uint16_t param);
|
||||
void vTraceStoreKernelCallWithNumericParamOnly(uint32_t evtcode,
|
||||
uint32_t param);
|
||||
|
||||
void vTraceStoreKernelCallWithParam(uint32_t evtcode, traceObjectClass objectClass,
|
||||
void vTraceStoreKernelCallWithParam(uint32_t evtcode, traceObjectClass objectClass,
|
||||
uint32_t objectNumber, uint8_t param);
|
||||
|
||||
void vTraceSetTaskInstanceFinished(objectHandleType handle);
|
||||
@@ -71,12 +68,12 @@ void vTraceSetObjectState(uint8_t objectclass, uint8_t id, uint8_t value);
|
||||
|
||||
uint8_t uiTraceGetObjectState(uint8_t objectclass, uint8_t id);
|
||||
|
||||
#if (INCLUDE_OBJECT_DELETE == 1)
|
||||
#if (INCLUDE_OBJECT_DELETE == 1)
|
||||
|
||||
void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,
|
||||
void vTraceStoreObjectNameOnCloseEvent(objectHandleType handle,
|
||||
traceObjectClass objectclass);
|
||||
|
||||
void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,
|
||||
void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,
|
||||
traceObjectClass objectclass);
|
||||
#endif
|
||||
|
||||
@@ -85,190 +82,7 @@ void vTraceStoreObjectPropertiesOnCloseEvent(objectHandleType handle,
|
||||
#define TASK_STATE_INSTANCE_ACTIVE 1
|
||||
#define TASK_STATE_INSTANCE_MARKED_FINISHED 2
|
||||
|
||||
extern objectHandleType handle_of_running_task;
|
||||
|
||||
/* This defines the mapping between FreeRTOS queue types and our internal
|
||||
class IDs */
|
||||
extern traceObjectClass TraceObjectClassTable[5];
|
||||
|
||||
/*******************************************************************************
|
||||
* The event codes - should match the offline config file.
|
||||
*
|
||||
* Some sections below are encoded to allow for constructions like:
|
||||
*
|
||||
* vTraceStoreKernelCall(EVENTGROUP_CREATE + objectclass, ...
|
||||
*
|
||||
* The object class ID is given by the three LSB bits, in such cases. Since each
|
||||
* object class has a separate object property table, the class ID is needed to
|
||||
* know what section in the object table to use for getting an object name from
|
||||
* an object handle.
|
||||
******************************************************************************/
|
||||
|
||||
#define NULL_EVENT (0x00) /* Ignored in the analysis*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_RE
|
||||
*
|
||||
* Events that indicate that something is ready to execute.
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_RE (NULL_EVENT + 2) /*0x02*/
|
||||
#define TR_TASK_READY (EVENTGROUP_RE + 0) /*0x02*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_TS
|
||||
*
|
||||
* Events for storing task-switches and interrupts. The RESUME events are
|
||||
* generated if the task/interrupt is already marked active.
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_TS (EVENTGROUP_RE + 2) /*0x04*/
|
||||
#define TS_ISR_BEGIN (EVENTGROUP_TS + 0) /*0x04*/
|
||||
#define TS_ISR_RESUME (EVENTGROUP_TS + 1) /*0x05*/
|
||||
#define TS_TASK_BEGIN (EVENTGROUP_TS + 2) /*0x06*/
|
||||
#define TS_TASK_RESUME (EVENTGROUP_TS + 3) /*0x07*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_OBJCLOSE_NAME
|
||||
*
|
||||
* About Close Events
|
||||
* When an object is evicted from the object property table (object close), two
|
||||
* internal events are stored (EVENTGROUP_OBJCLOSE_NAME and
|
||||
* EVENTGROUP_OBJCLOSE_PROP), containg the handle-name mapping and object
|
||||
* properties valid up to this point.
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_OBJCLOSE_NAME (EVENTGROUP_TS + 4) /*0x08*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_OBJCLOSE_PROP
|
||||
*
|
||||
* The internal event carrying properties of deleted objects
|
||||
* The handle and object class of the closed object is not stored in this event,
|
||||
* but is assumed to be the same as in the preceeding CLOSE event. Thus, these
|
||||
* two events must be generated from within a critical section.
|
||||
* When queues are closed, arg1 is the "state" property (i.e., number of
|
||||
* buffered messages/signals).
|
||||
* When actors are closed, arg1 is priority, arg2 is handle of the "instance
|
||||
* finish" event, and arg3 is event code of the "instance finish" event.
|
||||
* In this case, the lower three bits is the object class of the instance finish
|
||||
* handle. The lower three bits are not used (always zero) when queues are
|
||||
* closed since the queue type is given in the previous OBJCLOSE_NAME event.
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_OBJCLOSE_PROP (EVENTGROUP_OBJCLOSE_NAME + 8) /*0x10*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_CREATE
|
||||
*
|
||||
* The events in this group are used to log Kernel object creations.
|
||||
* The lower three bits in the event code gives the object class, i.e., type of
|
||||
* create operation (task, queue, semaphore, etc).
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_CREATE (EVENTGROUP_OBJCLOSE_PROP + 8) /*0x18*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_SEND
|
||||
*
|
||||
* The events in this group are used to log Send/Give events on queues,
|
||||
* semaphores and mutexeds The lower three bits in the event code gives the
|
||||
* object class, i.e., what type of object that is operated on (queue, semaphore
|
||||
* or mutex).
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_SEND (EVENTGROUP_CREATE + 8) /*0x20*/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENTGROUP_RECEIVE
|
||||
*
|
||||
* The events in this group are used to log Receive/Take events on queues,
|
||||
* semaphores and mutexes. The lower three bits in the event code gives the
|
||||
* object class, i.e., what type of object that is operated on (queue, semaphore
|
||||
* or mutex).
|
||||
******************************************************************************/
|
||||
#define EVENTGROUP_RECEIVE (EVENTGROUP_SEND + 8) /*0x28*/
|
||||
|
||||
/* Send/Give operations, from ISR */
|
||||
#define EVENTGROUP_SEND_FROM_ISR (EVENTGROUP_RECEIVE + 8) /*0x30*/
|
||||
|
||||
/* Receive/Take operations, from ISR */
|
||||
#define EVENTGROUP_RECEIVE_FROM_ISR (EVENTGROUP_SEND_FROM_ISR + 8) /*0x38*/
|
||||
|
||||
/* "Failed" event type versions of above (timeout, failed allocation, etc) */
|
||||
#define EVENTGROUP_FAILED_KSE (EVENTGROUP_RECEIVE_FROM_ISR + 8) /*0x40*/
|
||||
|
||||
/* Failed create calls - memory allocation failed */
|
||||
#define EVENTGROUP_FAILED_CREATE (EVENTGROUP_FAILED_KSE) /*0x40*/
|
||||
|
||||
/* Failed send/give - timeout! */
|
||||
#define EVENTGROUP_FAILED_SEND (EVENTGROUP_FAILED_CREATE + 8) /*0x48*/
|
||||
|
||||
/* Failed receive/take - timeout! */
|
||||
#define EVENTGROUP_FAILED_RECEIVE (EVENTGROUP_FAILED_SEND + 8) /*0x50*/
|
||||
|
||||
/* Failed non-blocking send/give - queue full */
|
||||
#define EVENTGROUP_FAILED_SEND_FROM_ISR (EVENTGROUP_FAILED_RECEIVE + 8) /*0x58*/
|
||||
|
||||
/* Failed non-blocking receive/take - queue empty */
|
||||
#define EVENTGROUP_FAILED_RECEIVE_FROM_ISR \
|
||||
(EVENTGROUP_FAILED_SEND_FROM_ISR + 8) /*0x60*/
|
||||
|
||||
/* Events when blocking on receive/take */
|
||||
#define EVENTGROUP_BLOCK_ON_RECEIVE \
|
||||
(EVENTGROUP_FAILED_RECEIVE_FROM_ISR + 8) /*0x68*/
|
||||
|
||||
/* Events when blocking on send/give */
|
||||
#define EVENTGROUP_BLOCK_ON_SEND (EVENTGROUP_BLOCK_ON_RECEIVE + 8) /*0x70*/
|
||||
|
||||
/* Events on queue peek (receive) */
|
||||
#define EVENTGROUP_PEEK (EVENTGROUP_BLOCK_ON_SEND + 8) /*0x78*/
|
||||
|
||||
/* Events on object delete (vTaskDelete or vQueueDelete) */
|
||||
#define EVENTGROUP_DELETE (EVENTGROUP_PEEK + 8) /*0x80*/
|
||||
|
||||
/* Other events - object class is implied: TASK */
|
||||
#define EVENTGROUP_OTHERS (EVENTGROUP_DELETE + 8) /*0x88*/
|
||||
#define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0) /*0x88*/
|
||||
#define TASK_DELAY (EVENTGROUP_OTHERS + 1) /*0x89*/
|
||||
#define TASK_SUSPEND (EVENTGROUP_OTHERS + 2) /*0x8A*/
|
||||
#define TASK_RESUME (EVENTGROUP_OTHERS + 3) /*0x8B*/
|
||||
#define TASK_RESUME_FROM_ISR (EVENTGROUP_OTHERS + 4) /*0x8C*/
|
||||
#define TASK_PRIORITY_SET (EVENTGROUP_OTHERS + 5) /*0x8D*/
|
||||
#define TASK_PRIORITY_INHERIT (EVENTGROUP_OTHERS + 6) /*0x8E*/
|
||||
#define TASK_PRIORITY_DISINHERIT (EVENTGROUP_OTHERS + 7) /*0x8F*/
|
||||
|
||||
/* Not yet used */
|
||||
#define EVENTGROUP_FTRACE_PLACEHOLDER (EVENTGROUP_OTHERS + 8) /*0x90*/
|
||||
|
||||
/* User events */
|
||||
#define EVENTGROUP_USEREVENT (EVENTGROUP_FTRACE_PLACEHOLDER + 8) /*0x98*/
|
||||
#define USER_EVENT (EVENTGROUP_USEREVENT + 0)
|
||||
|
||||
/* Allow for 0-15 arguments (the number of args is added to event code) */
|
||||
#define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15) /*0xA7*/
|
||||
|
||||
/*******************************************************************************
|
||||
* XTS Event - eXtended TimeStamp events
|
||||
* The timestamps used in the recorder are "differential timestamps" (DTS), i.e.
|
||||
* the time since the last stored event. The DTS fields are either 1 or 2 bytes
|
||||
* in the other events, depending on the bytes available in the event struct.
|
||||
* If the time since the last event (the DTS) is larger than allowed for by
|
||||
* the DTS field of the current event, an XTS event is inserted immidiatly
|
||||
* before the original event. The XTS event contains up to 3 additional bytes
|
||||
* of the DTS value - the higher bytes of the true DTS value. The lower 1-2
|
||||
* bytes are stored in the normal DTS field.
|
||||
* There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored
|
||||
* when there is only room for 1 byte (8 bit) DTS data in the original event,
|
||||
* which means a limit of 0xFF (255). The XTS16 is used when the original event
|
||||
* has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535).
|
||||
*
|
||||
* Using a very high frequency time base can result in many XTS events.
|
||||
* Preferably, the time between two OS ticks should fit in 16 bits, i.e.,
|
||||
* at most 65535. If your time base has a higher frequency, you can define
|
||||
* the TRACE
|
||||
******************************************************************************/
|
||||
|
||||
#define EVENTGROUP_SYS (EVENTGROUP_USEREVENT + 16) /*0xA8*/
|
||||
#define XTS8 (EVENTGROUP_SYS + 0) /*0xA8*/
|
||||
#define XTS16 (EVENTGROUP_SYS + 1) /*0xA9*/
|
||||
|
||||
#define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2) /*0xAA*/
|
||||
|
||||
#define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3) /*0xAB*/
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Tracealyzer v2.4.1 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcTypes.h
|
||||
@@ -9,7 +9,7 @@
|
||||
* 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
|
||||
* 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
|
||||
@@ -31,11 +31,7 @@
|
||||
* damages, or the exclusion of implied warranties or limitations on how long an
|
||||
* implied warranty may last, so the above limitations may not apply to you.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
@@ -46,36 +42,10 @@
|
||||
|
||||
typedef uint16_t traceLabel;
|
||||
|
||||
typedef uint8_t UserEventChannel;
|
||||
|
||||
typedef uint8_t objectHandleType;
|
||||
|
||||
typedef uint8_t traceObjectClass;
|
||||
|
||||
#define TRACE_CLASS_QUEUE ((traceObjectClass)0)
|
||||
#define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1)
|
||||
#define TRACE_CLASS_MUTEX ((traceObjectClass)2)
|
||||
#define TRACE_CLASS_TASK ((traceObjectClass)3)
|
||||
#define TRACE_CLASS_ISR ((traceObjectClass)4)
|
||||
|
||||
typedef uint8_t traceKernelService;
|
||||
|
||||
#define TRACE_KERNEL_SERVICE_TASK_CREATE ((traceKernelService)0)
|
||||
#define TRACE_KERNEL_SERVICE_TASK_DELETE ((traceKernelService)1)
|
||||
#define TRACE_KERNEL_SERVICE_TASK_DELAY ((traceKernelService)2)
|
||||
#define TRACE_KERNEL_SERVICE_PRIORITY_SET ((traceKernelService)3)
|
||||
#define TRACE_KERNEL_SERVICE_TASK_SUSPEND ((traceKernelService)4)
|
||||
#define TRACE_KERNEL_SERVICE_TASK_RESUME ((traceKernelService)5)
|
||||
#define TRACE_KERNEL_SERVICE_QUEUE_CREATE ((traceKernelService)6)
|
||||
#define TRACE_KERNEL_SERVICE_QUEUE_DELETE ((traceKernelService)7)
|
||||
#define TRACE_KERNEL_SERVICE_QUEUE_SEND ((traceKernelService)8)
|
||||
#define TRACE_KERNEL_SERVICE_QUEUE_RECEIVE ((traceKernelService)9)
|
||||
#define TRACE_KERNEL_SERVICE_QUEUE_PEEK ((traceKernelService)10)
|
||||
#define TRACE_KERNEL_SERVICE_MUTEX_CREATE ((traceKernelService)11)
|
||||
#define TRACE_KERNEL_SERVICE_MUTEX_DELETE ((traceKernelService)12)
|
||||
#define TRACE_KERNEL_SERVICE_MUTEX_GIVE ((traceKernelService)13)
|
||||
#define TRACE_KERNEL_SERVICE_MUTEX_TAKE ((traceKernelService)14)
|
||||
#define TRACE_KERNEL_SERVICE_SEMAPHORE_CREATE ((traceKernelService)15)
|
||||
#define TRACE_KERNEL_SERVICE_SEMAPHORE_DELETE ((traceKernelService)16)
|
||||
#define TRACE_KERNEL_SERVICE_SEMAPHORE_GIVE ((traceKernelService)17)
|
||||
#define TRACE_KERNEL_SERVICE_SEMAPHORE_TAKE ((traceKernelService)18)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Tracealyzer v2.4.1 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcUser.h
|
||||
@@ -8,72 +8,103 @@
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCUSER_H
|
||||
#define TRCUSER_H
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#include "trcKernel.h"
|
||||
|
||||
#if (configUSE_TRACE_FACILITY == 1)
|
||||
|
||||
#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
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* 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
|
||||
* 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 in
|
||||
* FreeRTOS+Trace v2.2.2 or later.
|
||||
* Any error message is also presented when opening a trace file.
|
||||
*
|
||||
******************************************************************************/
|
||||
uint32_t uiTraceStart(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStart
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* This function is obsolete, but has been saved for backwards compatibility.
|
||||
* We recommend using uiTraceStart instead.
|
||||
******************************************************************************/
|
||||
void vTraceStart(void);
|
||||
@@ -81,12 +112,12 @@ void vTraceStart(void);
|
||||
/*******************************************************************************
|
||||
* vTraceStartStatusMonitor
|
||||
*
|
||||
* This starts a task to monitor the status of the recorder module.
|
||||
* This task periodically prints a line to the console window, which shows the
|
||||
* recorder status, the number of events recorded and the latest timestamp.
|
||||
* This task calls vTracePortEnd (trcPort.c) when it detects that the recorder
|
||||
* has been stopped. This allows for adding custom actions, e.g., to store the
|
||||
* trace to a file in case a file system is available on the device.
|
||||
* This starts a task to monitor the status of the recorder module.
|
||||
* This task periodically prints a line to the console window, which shows the
|
||||
* recorder status, the number of events recorded and the latest timestamp.
|
||||
* This task calls vTracePortEnd (trcHardwarePort.c) when it detects that the
|
||||
* recorder has been stopped. This allows for adding custom actions, e.g., to
|
||||
* store the trace to a file in case a file system is available on the device.
|
||||
******************************************************************************/
|
||||
void vTraceStartStatusMonitor(void);
|
||||
|
||||
@@ -101,33 +132,19 @@ void vTraceStop(void);
|
||||
/*******************************************************************************
|
||||
* vTraceClear
|
||||
*
|
||||
* Resets the recorder. Only necessary if a restart is desired - this is not
|
||||
* Resets the recorder. Only necessary if a restart is desired - this is not
|
||||
* needed in the startup initialization.
|
||||
******************************************************************************/
|
||||
void vTraceClear(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceSetQueueName
|
||||
*
|
||||
* Assigns a name to a FreeRTOS Queue, Semaphore or Mutex. This function should
|
||||
* be called right after creation of the queue/mutex/semaphore. If not using
|
||||
* this function, the queues/mutexes/semaphores will be presented by their
|
||||
* numeric handle only.
|
||||
*
|
||||
* Example:
|
||||
* actuatorQ = xQueueCreate(3, sizeof(QueueMessage));
|
||||
* vTraceSetQueueName(actuatorQ, "ActuatorQueue");
|
||||
******************************************************************************/
|
||||
void vTraceSetQueueName(void* queue, const char* name);
|
||||
|
||||
#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
|
||||
* called before using vTraceStoreISRBegin to store ISR events. This is
|
||||
* typically called in the startup of the system, before the scheduler is
|
||||
* started.
|
||||
*
|
||||
* Example:
|
||||
@@ -151,18 +168,9 @@ void vTraceSetISRProperties(objectHandleType handle, const char* name, char prio
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStoreISRBegin
|
||||
*
|
||||
*
|
||||
* Registers the beginning of an Interrupt Service Routine.
|
||||
*
|
||||
* Note! This may only be used for interrupts affected by portENTER_CRITICAL.
|
||||
* In some FreeRTOS ports, such as ARM Cortex M3, this does not disable all
|
||||
* interrupts. Interrupts above configMAX_SYSCALL_INTERRUPT_PRIORITY are still
|
||||
* enabled, but may not call the FreeRTOS API. Such may not call the recorder
|
||||
* API, including this function.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*
|
||||
* If allowing nested ISRs, this must be called with interrupts disabled.
|
||||
* If allowing nested ISRs, this must be called with interrupts disabled.
|
||||
*
|
||||
* Example:
|
||||
* #define ID_ISR_TIMER1 1 // lowest valid ID is 1
|
||||
@@ -180,23 +188,16 @@ void vTraceSetISRProperties(objectHandleType handle, const char* name, char prio
|
||||
* vTraceStoreISREnd();
|
||||
* portEXIT_CRITICAL();
|
||||
* }
|
||||
*
|
||||
******************************************************************************/
|
||||
void vTraceStoreISRBegin(objectHandleType id);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceStoreISREnd
|
||||
*
|
||||
*
|
||||
* Registers the end of an Interrupt Service Routine.
|
||||
*
|
||||
* Note! This may only be used for interrupts affected by portENTER_CRITICAL.
|
||||
* In some FreeRTOS ports, such as ARM Cortex M3, this does not disable all
|
||||
* interrupts. Interrupts above configMAX_SYSCALL_INTERRUPT_PRIORITY are still
|
||||
* enabled, but may not call the FreeRTOS API. Such may not call the recorder
|
||||
* API, including this function.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*
|
||||
* If allowing nested ISRs, this must be called with interrupts disabled.
|
||||
* If allowing nested ISRs, this must be called with interrupts disabled.
|
||||
*
|
||||
* Example:
|
||||
* #define ID_ISR_TIMER1 1 // lowest valid ID is 1
|
||||
@@ -214,6 +215,7 @@ void vTraceStoreISRBegin(objectHandleType id);
|
||||
* vTraceStoreISREnd();
|
||||
* portEXIT_CRITICAL();
|
||||
* }
|
||||
*
|
||||
******************************************************************************/
|
||||
void vTraceStoreISREnd(void);
|
||||
|
||||
@@ -233,41 +235,41 @@ void vTraceDecreaseISRActive(void);
|
||||
/*******************************************************************************
|
||||
* vvTraceTaskSkipDefaultInstanceFinishedEvents
|
||||
*
|
||||
* This is useful if there are implicit Instance Finish Events, such as
|
||||
* vTaskDelayUntil or xQueueReceive, in a task where an explicit Instance Finish
|
||||
* Event has been defined. This function tells the recorder that only the
|
||||
* This is useful if there are implicit Instance Finish Events, such as
|
||||
* vTaskDelayUntil or xQueueReceive, in a task where an explicit Instance Finish
|
||||
* Event has been defined. This function tells the recorder that only the
|
||||
* explicitly defined functions (using vTraceTaskInstanceIsFinished) should be
|
||||
* treated as Instance Finish Events for this task. The implicit Instance Finish
|
||||
* treated as Instance Finish Events for this task. The implicit Instance Finish
|
||||
* Events are thus disregarded for this task.
|
||||
******************************************************************************/
|
||||
void vTraceTaskSkipDefaultInstanceFinishedEvents(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceTaskInstanceIsFinished
|
||||
*
|
||||
* This defines an explicit Instance Finish Event for the current task. It tells
|
||||
* the recorder that the current instance of this task is finished at the next
|
||||
* kernel call of the task, e.g., a taskDelay or a queue receive. This function
|
||||
* should be called right before the api function call considered to be the end
|
||||
*
|
||||
* This defines an explicit Instance Finish Event for the current task. It tells
|
||||
* the recorder that the current instance of this task is finished at the next
|
||||
* kernel call of the task, e.g., a taskDelay or a queue receive. This function
|
||||
* should be called right before the api function call considered to be the end
|
||||
* of the task instamce, i.e., the Instance Finish Event.
|
||||
******************************************************************************/
|
||||
void vTraceTaskInstanceIsFinished(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
|
||||
*
|
||||
* 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,
|
||||
*
|
||||
* 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);
|
||||
@@ -276,14 +278,14 @@ uint32_t uiTraceGetTraceBufferSize(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
*
|
||||
* used to identify the event. This is obtained by calling
|
||||
*
|
||||
* xTraceOpenLabel()
|
||||
*
|
||||
* whihc adds the string to the symbol table (if not already present)
|
||||
@@ -304,7 +306,7 @@ uint32_t uiTraceGetTraceBufferSize(void);
|
||||
* ...
|
||||
* vTraceUserEvent(myEventHandle);
|
||||
*
|
||||
* The second option is faster since no lookup is required on each event, and
|
||||
* 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.
|
||||
@@ -315,40 +317,40 @@ 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
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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",
|
||||
* 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",
|
||||
* 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
|
||||
* 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:
|
||||
@@ -361,84 +363,62 @@ void vTraceUserEvent(traceLabel eventLabel);
|
||||
* %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
|
||||
*
|
||||
* 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)
|
||||
* 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. PIC24F.
|
||||
* Before using a %lf argument on a 16-bit MCU, please verify that
|
||||
*
|
||||
* Note that the double-precision float (%lf) assumes a 64 bit double
|
||||
* representation. This does not seem to be the case on e.g. PIC24F.
|
||||
* 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)
|
||||
#define vTraceUserEvent(eventLabel)
|
||||
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* vTraceExclude______FromTrace
|
||||
*
|
||||
* Excludes a task or object from the trace.
|
||||
* This can be useful if some irrelevant task is very frequent and is "eating
|
||||
* up the buffer". This should be called after the task has been created, but
|
||||
* before starting the FreeRTOS scheduler.
|
||||
*****************************************************************************/
|
||||
void vTraceExcludeQueueFromTrace(void* handle);
|
||||
void vTraceExcludeSemaphoreFromTrace(void* handle);
|
||||
void vTraceExcludeMutexFromTrace(void* handle);
|
||||
void vTraceExcludeTaskFromTrace(void* handle);
|
||||
void vTraceExcludeKernelServiceFromTrace(traceKernelService kernelService);
|
||||
|
||||
/******************************************************************************
|
||||
* vTraceInclude______InTrace
|
||||
*
|
||||
* Includes a task, object or kernel service in the trace. This is only
|
||||
* necessary if the task or object has been previously exluded.
|
||||
*****************************************************************************/
|
||||
void vTraceIncludeQueueInTrace(void* handle);
|
||||
void vTraceIncludeSemaphoreInTrace(void* handle);
|
||||
void vTraceIncludeMutexInTrace(void* handle);
|
||||
void vTraceIncludeTaskInTrace(void* handle);
|
||||
void vTraceIncludeKernelServiceInTrace(traceKernelService kernelService);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include "trcPort.h"
|
||||
/* Empty defines for user functions to avoid compiler errors if trace is not to be used */
|
||||
|
||||
#define vTraceInit()
|
||||
#define uiTraceStart() (1)
|
||||
#define vTraceInitTraceData()
|
||||
#define uiTraceStart() (1) // Fake "success", if used when recorder is excluded from build
|
||||
#define vTraceStart()
|
||||
#define vTraceStop()
|
||||
#define vTraceClear()
|
||||
#define vTraceStartStatusMonitor()
|
||||
#define vTracePortSetOutFile(f)
|
||||
#define vTraceGetTraceBuffer() ((void*)0)
|
||||
#define uiTraceGetTraceBufferSize() 0
|
||||
#define xTraceOpenLabel(label) 0
|
||||
#define vTraceUserEvent(eventLabel)
|
||||
#define vTracePrintF(eventLabel,formatStr,...)
|
||||
#define vTraceExcludeTaskFromSchedulingTrace(name)
|
||||
#define vTraceSetQueueName(queue, name)
|
||||
|
||||
#define vTraceTaskSkipDefaultInstanceFinishedEvents()
|
||||
#define vTraceSetISRProperties(handle, name, priority)
|
||||
#define vTraceStoreISRBegin(id)
|
||||
#define vTraceStoreISREnd()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
|
||||
FreeRTOS+Trace - Uploading the trace data
|
||||
Tracealyzer - Uploading the trace data
|
||||
-----------------------------------------
|
||||
Percepio AB, Nov. 8, 2012
|
||||
|
||||
This document decribes how to upload the trace data from the target system to
|
||||
FreeRTOS+Trace. For information on how to integrate and enable the recorder
|
||||
library in your FreeRTOS project, see the FreeRTOS+Trace User Manual.
|
||||
Tracealyzer.
|
||||
|
||||
FreeRTOS+Trace uses your existing debugger to upload the trace data from the
|
||||
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.
|
||||
|
||||
Note that hardware-generated trace is not required (or used by) FreeRTOS+Trace.
|
||||
We however plan to add support for that in future versions of FreeRTOS+Trace
|
||||
If the device has a file system and some possibility of accessing this file
|
||||
system from the development PC, it is also possible to write the recorder data
|
||||
to a file, using vTraceGetTraceBuffer() and uiTraceGetTraceBufferSize()
|
||||
found in trcUser.h/.c.
|
||||
|
||||
Note that hardware-generated trace is not required (or used by) Tracealyzer.
|
||||
We however plan to add support for that in future versions of Tracealyzer
|
||||
and other Tracealyzer products.
|
||||
|
||||
Built-in support for Segger J-Link/J-Trace and Atmel SAM-ICE
|
||||
------------------------------------------------------------
|
||||
FreeRTOS+Trace v2.3 supports Segger J-Link and J-Link compatible debuggers
|
||||
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.
|
||||
|
||||
@@ -36,7 +40,7 @@ can be found can by inspecting the "RecorderData" struct or the
|
||||
Typical values are 0x0, 0x10000000 or 0x20000000 as start address
|
||||
and 0x10000 or 0x20000 as size (64 KB or 128 KB).
|
||||
|
||||
This makes FreeRTOS+Trace reads the chip RAM and locate the trace data.
|
||||
This makes Tracealyzer reads the chip RAM and locate the trace data.
|
||||
Note that this option is only available if a compatible debug probe is found.
|
||||
|
||||
J-Link compatible debug probes also include Atmel SAM-ICE and many built-in
|
||||
@@ -46,17 +50,17 @@ connection directly to the board). Look for a Segger J-Link label on the board.
|
||||
MemoryLogger extension in Atmel Studio 6
|
||||
----------------------------------------
|
||||
Atmel's new MemoryLogger extension provides a superb integration with
|
||||
FreeRTOS+Trace. Look for "MemoryLogger" in Atmel Gallery, available in
|
||||
Tracealyzer. Look for "MemoryLogger" in Atmel Gallery, available in
|
||||
Atmel Studio and at the Atmel website.
|
||||
|
||||
This extension automatically detects the path to FreeRTOS+Trace, if
|
||||
This extension automatically detects the path to Tracealyzer, 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. FreeRTOS+Trace
|
||||
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)
|
||||
@@ -66,7 +70,7 @@ 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. FreeRTOS+Trace automatically
|
||||
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.
|
||||
@@ -84,7 +88,7 @@ In the debugger view, when stopped on a breakpoint:
|
||||
- File format: Intel Extended
|
||||
- Filename: <name>.hex
|
||||
- Press "Save" button
|
||||
You can now open <name>.hex in FreeRTOS+Trace.
|
||||
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
|
||||
@@ -100,7 +104,7 @@ In the debugger view, when stopped on a breakpoint:
|
||||
- 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 FreeRTOS+Trace.
|
||||
- Press "Save" button and open <name>.bin in Tracealyzer.
|
||||
|
||||
Using Microchip MPLAB v8.86
|
||||
------------------------------------------------------
|
||||
@@ -110,7 +114,7 @@ Using Microchip MPLAB v8.86
|
||||
- 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 FreeRTOS+Trace v2.2.4 or later (support for the .mch format was added in v2.2.4).
|
||||
- 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
|
||||
------------------------------------------------------
|
||||
@@ -118,7 +122,7 @@ Using STM32 ST-Link
|
||||
- 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 FreeRTOS+Trace.
|
||||
- Open the resulting file in Tracealyzer.
|
||||
|
||||
In case you have any question, contact support@percepio.com
|
||||
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
|
||||
FreeRTOS+Trace Trace Recorder Library
|
||||
Tracealyzer Trace Recorder Library
|
||||
-------------------------------------
|
||||
Percepio AB
|
||||
www.percepio.com
|
||||
|
||||
This directory contains the core trace recorder library used by FreeRTOS+Trace v2.3.
|
||||
|
||||
Ready-to-run demonstrations projects are found at www.percepio.com.
|
||||
|
||||
For information on how to integrate the recorder library in your FreeRTOS build, see
|
||||
the FreeRTOS+Trace User Manual, section 2.
|
||||
This directory contains the a generic trace recorder library for Tracealyzer v2.4.
|
||||
|
||||
For information on how to upload the trace data from your target system RAM to
|
||||
FreeRTOS+Trace, see "debugger trace upload.txt"
|
||||
|
||||
NOTE: This trace recorder library requires FreeRTOS v7.3.0 or later.
|
||||
Tracealyzer, see "debugger trace upload.txt"
|
||||
|
||||
Files included
|
||||
--------------
|
||||
@@ -22,8 +15,9 @@ Files included
|
||||
- trcUser.c / trcUser.h - The main API towards the application (trcUser.h in the only include necessary).
|
||||
- trcKernel.c / trcKernel.h - Internal routines for storing kernel events.
|
||||
- trcBase.c / trcBase.h - Internal routines for manipulating the data structures and calculating timestamps.
|
||||
- trcPort.c / trcPort.h - The port layer, abstracting the hardware (mainly the timer used for timestamping).
|
||||
- trcHooks.h - The interface between FreeRTOS and the recorder, containing trace macro defintions.
|
||||
- trcHardwarePort.c / trcHardwarePort.h - The port layer, abstracting the hardware (mainly the timer used for timestamping).
|
||||
- trcKernelHooks.h - The interface between the Kernel and the recorder, containing trace macro defintions.
|
||||
- trcKernelPort.h - Kernel specific implementations of macros and data.
|
||||
- trcTypes.h - Type definitions used.
|
||||
|
||||
Hardware Timer Ports
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v2.4.1 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.
|
||||
*
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#include "trcHardwarePort.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
/******************************************************************************
|
||||
* 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;
|
||||
|
||||
/* 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 (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;
|
||||
}
|
||||
|
||||
/* Store the previous values. */
|
||||
last_traceTickCount = traceTickCount;
|
||||
last_hwtc_count = hwtc_count;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,191 @@
|
||||
/*******************************************************************************
|
||||
* Tracealyzer v2.4.1 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcKernelPort.c
|
||||
*
|
||||
* Kernel-specific functionality for FreeRTOS, used by the 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.
|
||||
*
|
||||
* Copyright Percepio AB, 2013.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#if (USE_TRACEALYZER_RECORDER == 1)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "task.h"
|
||||
|
||||
traceObjectClass TraceObjectClassTable[5] = {
|
||||
TRACE_CLASS_QUEUE,
|
||||
TRACE_CLASS_MUTEX,
|
||||
TRACE_CLASS_SEMAPHORE,
|
||||
TRACE_CLASS_SEMAPHORE,
|
||||
TRACE_CLASS_MUTEX
|
||||
};
|
||||
|
||||
extern unsigned char ucQueueGetQueueType(void*);
|
||||
extern unsigned char ucQueueGetQueueNumber(void*);
|
||||
|
||||
objectHandleType prvTraceGetObjectNumber(void* handle)
|
||||
{
|
||||
return ucQueueGetQueueNumber(handle);
|
||||
}
|
||||
|
||||
unsigned char prvTraceGetObjectType(void* handle)
|
||||
{
|
||||
return ucQueueGetQueueType(handle);
|
||||
}
|
||||
|
||||
objectHandleType prvTraceGetTaskNumber(void* handle)
|
||||
{
|
||||
return (objectHandleType)uxTaskGetTaskNumber(handle);
|
||||
}
|
||||
|
||||
void prvTraceEnterCritical()
|
||||
{
|
||||
taskENTER_CRITICAL();
|
||||
}
|
||||
|
||||
void prvTraceExitCritical()
|
||||
{
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
unsigned char prvTraceIsSchedulerActive()
|
||||
{
|
||||
return xTaskGetSchedulerState() == taskSCHEDULER_RUNNING;
|
||||
}
|
||||
|
||||
unsigned char prvTraceIsSchedulerSuspended()
|
||||
{
|
||||
return xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED;
|
||||
}
|
||||
|
||||
unsigned char prvTraceIsSchedulerStarted()
|
||||
{
|
||||
return xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED;
|
||||
}
|
||||
|
||||
void* prvTraceGetCurrentTaskHandle()
|
||||
{
|
||||
return xTaskGetCurrentTaskHandle();
|
||||
}
|
||||
|
||||
/* Initialization of the object property table */
|
||||
void vTraceInitObjectPropertyTable()
|
||||
{
|
||||
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectClasses = TRACE_NCLASSES;
|
||||
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[0] = NQueue;
|
||||
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[1] = NSemaphore;
|
||||
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[2] = NMutex;
|
||||
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[3] = NTask;
|
||||
RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[4] = NISR;
|
||||
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[0] = NameLenQueue;
|
||||
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[1] = NameLenSemaphore;
|
||||
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[2] = NameLenMutex;
|
||||
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[3] = NameLenTask;
|
||||
RecorderDataPtr->ObjectPropertyTable.NameLengthPerClass[4] = NameLenISR;
|
||||
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[0] = PropertyTableSizeQueue;
|
||||
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[1] = PropertyTableSizeSemaphore;
|
||||
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[2] = PropertyTableSizeMutex;
|
||||
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[3] = PropertyTableSizeTask;
|
||||
RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[4] = PropertyTableSizeISR;
|
||||
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[0] = StartIndexQueue;
|
||||
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[1] = StartIndexSemaphore;
|
||||
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[2] = StartIndexMutex;
|
||||
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[3] = StartIndexTask;
|
||||
RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[4] = StartIndexISR;
|
||||
RecorderDataPtr->ObjectPropertyTable.ObjectPropertyTableSizeInBytes = TRACE_OBJECT_TABLE_SIZE;
|
||||
}
|
||||
|
||||
/* Initialization of the handle mechanism, see e.g, xTraceGetObjectHandle */
|
||||
void vTraceInitObjectHandleStack()
|
||||
{
|
||||
objectHandleStacks.indexOfNextAvailableHandle[0] = 0;
|
||||
objectHandleStacks.indexOfNextAvailableHandle[1] = NQueue;
|
||||
objectHandleStacks.indexOfNextAvailableHandle[2] = NQueue + NSemaphore;
|
||||
objectHandleStacks.indexOfNextAvailableHandle[3] = NQueue + NSemaphore + NMutex;
|
||||
objectHandleStacks.indexOfNextAvailableHandle[4] = NQueue + NSemaphore + NMutex + NTask;
|
||||
objectHandleStacks.lowestIndexOfClass[0] = 0;
|
||||
objectHandleStacks.lowestIndexOfClass[1] = NQueue;
|
||||
objectHandleStacks.lowestIndexOfClass[2] = NQueue + NSemaphore;
|
||||
objectHandleStacks.lowestIndexOfClass[3] = NQueue + NSemaphore + NMutex;
|
||||
objectHandleStacks.lowestIndexOfClass[4] = NQueue + NSemaphore + NMutex + NTask;
|
||||
objectHandleStacks.highestIndexOfClass[0] = NQueue - 1;
|
||||
objectHandleStacks.highestIndexOfClass[1] = NQueue + NSemaphore - 1;
|
||||
objectHandleStacks.highestIndexOfClass[2] = NQueue + NSemaphore + NMutex - 1;
|
||||
objectHandleStacks.highestIndexOfClass[3] = NQueue + NSemaphore + NMutex + NTask - 1;
|
||||
objectHandleStacks.highestIndexOfClass[4] = NQueue + NSemaphore + NMutex + NTask + NISR - 1;
|
||||
}
|
||||
|
||||
/* Returns the "Not enough handles" error message for this object class */
|
||||
const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass)
|
||||
{
|
||||
switch(objectclass)
|
||||
{
|
||||
case TRACE_CLASS_TASK:
|
||||
return "Not enough TASK handles - increase NTask in trcConfig.h";
|
||||
case TRACE_CLASS_ISR:
|
||||
return "Not enough ISR handles - increase NISR in trcConfig.h";
|
||||
case TRACE_CLASS_SEMAPHORE:
|
||||
return "Not enough SEMAPHORE handles - increase NSemaphore in trcConfig.h";
|
||||
case TRACE_CLASS_MUTEX:
|
||||
return "Not enough MUTEX handles - increase NMutex in trcConfig.h";
|
||||
case TRACE_CLASS_QUEUE:
|
||||
return "Not enough QUEUE handles - increase NQueue in trcConfig.h";
|
||||
default:
|
||||
return "pszTraceGetErrorHandles: Invalid objectclass!";
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the exclude state of the object */
|
||||
uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, objectHandleType handle)
|
||||
{
|
||||
TRACE_ASSERT(objectclass < TRACE_NCLASSES, "prvTraceIsObjectExcluded: objectclass >= TRACE_NCLASSES", 1);
|
||||
TRACE_ASSERT(handle <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass], "uiTraceIsObjectExcluded: Invalid value for handle", 1);
|
||||
|
||||
switch(objectclass)
|
||||
{
|
||||
case TRACE_CLASS_TASK:
|
||||
return TRACE_GET_TASK_FLAG_ISEXCLUDED(handle);
|
||||
case TRACE_CLASS_SEMAPHORE:
|
||||
return TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(handle);
|
||||
case TRACE_CLASS_MUTEX:
|
||||
return TRACE_GET_MUTEX_FLAG_ISEXCLUDED(handle);
|
||||
case TRACE_CLASS_QUEUE:
|
||||
return TRACE_GET_QUEUE_FLAG_ISEXCLUDED(handle);
|
||||
}
|
||||
|
||||
/* Must never reach */
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,208 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.3.0 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcPort.c
|
||||
*
|
||||
* Contains all portability issues of the trace recorder library.
|
||||
* See also trcPort.h, where port-specific macros are defined.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* OFFER FROM PERCEPIO:
|
||||
* For silicon companies and non-corporate FreeRTOS users (researchers, students
|
||||
* , hobbyists or early-phase startups) we have an attractive offer:
|
||||
* Provide a hardware timer port and get a FREE single-user licence for
|
||||
* FreeRTOS+Trace Professional Edition. Read more about this offer at
|
||||
* www.percepio.com or contact us directly at support@percepio.com.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.com/products/downloads/
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#include "trcUser.h"
|
||||
|
||||
#if (configUSE_TRACE_FACILITY == 1)
|
||||
|
||||
#if (INCLUDE_SAVE_TO_FILE == 1)
|
||||
static char* prvFileName = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* uiTraceTickCount
|
||||
*
|
||||
* This variable is updated by the traceTASK_INCREMENT_TICK macro in the
|
||||
* FreeRTOS tick handler. This does not need to be modified when developing a
|
||||
* new timer port. It is prefered to keep any timer port changes in the HWTC
|
||||
* macro definitions, which typically give sufficient flexibility.
|
||||
******************************************************************************/
|
||||
uint32_t uiTraceTickCount = 0;
|
||||
|
||||
/******************************************************************************
|
||||
* uiTracePortGetTimeStamp
|
||||
*
|
||||
* Returns the current time based on the HWTC macros which provide a hardware
|
||||
* isolation layer towards the hardware timer/counter.
|
||||
*
|
||||
* The HWTC macros and uiTracePortGetTimeStamp is the main porting issue
|
||||
* or the trace recorder library. Typically you should not need to change
|
||||
* the code of uiTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
* OFFER FROM PERCEPIO:
|
||||
* For silicon companies and non-corporate FreeRTOS users (researchers, students
|
||||
* , hobbyists or early-phase startups) we have an attractive offer:
|
||||
* Provide a hardware timer port and get a FREE single-user license for
|
||||
* FreeRTOS+Trace Professional Edition. Read more about this offer at
|
||||
* www.percepio.com or contact us directly at support@percepio.com.
|
||||
******************************************************************************/
|
||||
void uiTracePortGetTimeStamp(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;
|
||||
|
||||
/* 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 (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;
|
||||
}
|
||||
|
||||
/* Store the previous values. */
|
||||
last_traceTickCount = traceTickCount;
|
||||
last_hwtc_count = hwtc_count;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* vTracePortEnd
|
||||
*
|
||||
* This function is called by the monitor when a recorder stop is detected.
|
||||
* This is used by the Win32 port to store the trace to a file. The file path is
|
||||
* set using vTracePortSetOutFile.
|
||||
******************************************************************************/
|
||||
void vTracePortEnd()
|
||||
{
|
||||
vTraceConsoleMessage("\n\r[FreeRTOS+Trace] Running vTracePortEnd.\n\r");
|
||||
|
||||
#if (WIN32_PORT_SAVE_WHEN_STOPPED == 1)
|
||||
vTracePortSave();
|
||||
#endif
|
||||
|
||||
#if (WIN32_PORT_EXIT_WHEN_STOPPED == 1)
|
||||
/* In the FreeRTOS/Win32 demo, this allows for killing the application
|
||||
when the recorder is stopped (e.g., when the buffer is full) */
|
||||
system("pause");
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (INCLUDE_SAVE_TO_FILE == 1)
|
||||
/*******************************************************************************
|
||||
* vTracePortSetOutFile
|
||||
*
|
||||
* Sets the filename/path used in vTracePortSave.
|
||||
* This is set in a separate function, since the Win32 port calls vTracePortSave
|
||||
* in vTracePortEnd if WIN32_PORT_SAVE_WHEN_STOPPED is set.
|
||||
******************************************************************************/
|
||||
void vTracePortSetOutFile(char* path)
|
||||
{
|
||||
prvFileName = path;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* vTracePortSave
|
||||
*
|
||||
* Saves the trace to a file on a local file system. The path is set in a
|
||||
* separate function, vTracePortSetOutFile, since the Win32 port calls
|
||||
* vTracePortSave in vTracePortEnd if WIN32_PORT_SAVE_WHEN_STOPPED is set.
|
||||
******************************************************************************/
|
||||
void vTracePortSave()
|
||||
{
|
||||
char buf[180];
|
||||
FILE* f;
|
||||
|
||||
if (prvFileName == NULL)
|
||||
{
|
||||
prvFileName = "FreeRTOSPlusTrace.dump";
|
||||
sprintf(buf, "No filename specified, using default \"%s\".", prvFileName);
|
||||
vTraceConsoleMessage(buf);
|
||||
}
|
||||
|
||||
fopen_s(&f, prvFileName, "wb");
|
||||
if (f)
|
||||
{
|
||||
fwrite(RecorderDataPtr, sizeof(RecorderDataType), 1, f);
|
||||
fclose(f);
|
||||
sprintf(buf, "\n\r[FreeRTOS+Trace] Saved in: %s\n\r", prvFileName);
|
||||
vTraceConsoleMessage(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buf, "\n\r[FreeRTOS+Trace] Failed to write to output file!\n\r");
|
||||
vTraceConsoleMessage(buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user