Final preparation for new release:

FreeRTOS+Trace:
 - Add trace macros for task notifications.
 - Update to the latest trace recorder library.

Demo projects:
 - Only include the CLI command to show run time states if configGENERATE_RUN_TIME_STATS is set to 1.
This commit is contained in:
Richard Barry 2015-08-12 10:34:30 +00:00
parent 99d4f2c454
commit 3291f5a08d
23 changed files with 5473 additions and 1268 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.0 Recorder Library
* Tracealyzer v2.7.7 Recorder Library
* Percepio AB, www.percepio.com
*
* trcConfig.h
@ -38,7 +38,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2014.
* Copyright Percepio AB, 2012-2015.
* www.percepio.com
******************************************************************************/
@ -70,18 +70,20 @@
* PORT_NXP_LPC210X 13 No Any
* PORT_MICROCHIP_PIC32MZ 14 Yes Any
* PORT_ARM_CORTEX_A9 15 No Any
* PORT_ARM_CORTEX_M0 16 Yes Any
*****************************************************************************/
#ifndef WIN32
// Set the port setting here!
#define SELECTED_PORT PORT_NOT_SET
// Set the port setting here!
#define SELECTED_PORT PORT_NOT_SET
#if (SELECTED_PORT == PORT_NOT_SET)
#error "You need to define SELECTED_PORT here!"
#endif
#else
// For Win32 demo projects this is set automatically
#define SELECTED_PORT PORT_Win32
#if (SELECTED_PORT == PORT_ARM_CortexM)
/* For ARM Cortex-M: make sure ARM's CMSIS library is included here, which
is used for accessing the PRIMASK register. e.g. #include "board.h" */
#endif
#if (SELECTED_PORT == PORT_NOT_SET)
#error "You need to define SELECTED_PORT here!"
#endif
/******************************************************************************

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.0 Recorder Library
* Tracealyzer v2.7.7 Recorder Library
* Percepio AB, www.percepio.com
*
* trcHardwarePort.h
@ -34,7 +34,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2014.
* Copyright Percepio AB, 2012-2015.
* www.percepio.com
******************************************************************************/
@ -112,6 +112,7 @@
#define PORT_NXP_LPC210X 13 /* No Any */
#define PORT_MICROCHIP_PIC32MZ 14 /* Yes Any */
#define PORT_ARM_CORTEX_A9 15 /* No Any */
#define PORT_ARM_CORTEX_M0 16 /* Yes Any */
#include "trcConfig.h"
@ -199,12 +200,12 @@
#elif (SELECTED_PORT == PORT_ARM_CortexM)
void prvTraceInitCortexM(void);
#define REG_DEMCR (*(volatile unsigned int*)0xE000EDFC)
#define REG_DWT_CTRL (*(volatile unsigned int*)0xE0001000)
#define REG_DWT_CYCCNT (*(volatile unsigned int*)0xE0001004)
#define REG_DWT_EXCCNT (*(volatile unsigned int*)0xE000100C)
/* Bit mask for TRCENA bit in DEMCR - Global enable for DWT and ITM */
#define DEMCR_TRCENA (1 << 24)
@ -223,7 +224,7 @@
#define PORT_SPECIFIC_INIT() prvTraceInitCortexM()
extern uint32_t DWT_CYCLES_ADDED;
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
#define HWTC_COUNT (REG_DWT_CYCCNT + DWT_CYCLES_ADDED)
#define HWTC_PERIOD 0
@ -231,6 +232,14 @@
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
#elif (SELECTED_PORT == PORT_ARM_CORTEX_M0)
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
#define HWTC_COUNT (*((uint32_t*)0xE000E018))
#define HWTC_PERIOD ((*(uint32_t*)0xE000E014) + 1)
#define HWTC_DIVISOR 2
#define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant
#elif (SELECTED_PORT == PORT_Renesas_RX600)
#include "iodefine.h"
@ -241,8 +250,8 @@
#define HWTC_DIVISOR 1
#define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant
#elif (SELECTED_PORT == PORT_MICROCHIP_PIC32MX || SELECTED_PORT == PORT_MICROCHIP_PIC32MZ)
#elif ((SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ))
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
#define HWTC_COUNT (TMR1)
#define HWTC_PERIOD (PR1 + 1)
@ -299,11 +308,11 @@
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
#define RTIFRC0 *((uint32_t *)0xFFFFFC10)
#define RTICOMP0 *((uint32_t *)0xFFFFFC50)
#define RTIUDCP0 *((uint32_t *)0xFFFFFC54)
#define TRC_RTIFRC0 *((uint32_t *)0xFFFFFC10)
#define TRC_RTICOMP0 *((uint32_t *)0xFFFFFC50)
#define TRC_RTIUDCP0 *((uint32_t *)0xFFFFFC54)
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
#define HWTC_COUNT (RTIFRC0 - (RTICOMP0 - RTIUDCP0))
#define HWTC_COUNT (TRC_RTIFRC0 - (TRC_RTICOMP0 - TRC_RTIUDCP0))
#define HWTC_PERIOD (RTIUDCP0)
#define HWTC_DIVISOR 1

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.0 Recorder Library
* Tracealyzer v2.7.7 Recorder Library
* Percepio AB, www.percepio.com
*
* trcKernel.h
@ -31,7 +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.
*
* Copyright Percepio AB, 2013.
* Copyright Percepio AB, 2012-2015.
* www.percepio.com
******************************************************************************/
@ -45,7 +45,10 @@
/* Internal functions */
#if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1
void vTraceStoreTaskReady(objectHandleType handle);
void vTraceSetReadyEventsEnabled(int status);
void vTraceStoreTaskReady(objectHandleType handle);
#else
#define vTraceSetReadyEventsEnabled(status)
#endif
void vTraceStoreLowPower(uint32_t flag);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.0 Recorder Library
* Tracealyzer v2.7.7 Recorder Library
* Percepio AB, www.percepio.com
*
* trcUser.h
@ -32,7 +32,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2014.
* Copyright Percepio AB, 2012-2015.
* www.percepio.com
******************************************************************************/
@ -448,7 +448,7 @@ void vTraceChannelUserEvent(UserEventChannel channel);
#define vTraceSetISRProperties(handle, name, priority)
#define vTraceStoreISRBegin(id)
#define vTraceStoreISREnd()
#define vTraceStoreISREnd(flag)
#define vTraceExcludeTaskFromTrace(handle)
#define vTraceSetQueueName(a, b)
#define vTraceSetMutexName(a, b)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.0 Recorder Library
* Tracealyzer v2.7.7 Recorder Library
* Percepio AB, www.percepio.com
*
* trcKernel.c
@ -33,7 +33,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2014.
* Copyright Percepio AB, 2012-2015.
* www.percepio.com
******************************************************************************/
@ -44,18 +44,28 @@
#include <stdint.h>
/* Internal variables */
uint8_t nISRactive = 0;
int8_t nISRactive = 0;
objectHandleType handle_of_last_logged_task = 0;
uint8_t inExcludedTask = 0;
#if (INCLUDE_MEMMANG_EVENTS == 1)
/* Current heap usage. Always updated. */
static uint32_t heapMemUsage = 0;
#endif
#if (TRACE_SCHEDULING_ONLY == 0)
static uint32_t prvTraceGetParam(uint32_t, uint32_t);
#endif
#if !defined INCLUDE_READY_EVENTS || INCLUDE_READY_EVENTS == 1
static int readyEventsEnabled = 1;
void vTraceSetReadyEventsEnabled(int status)
{
readyEventsEnabled = status;
}
/*******************************************************************************
* vTraceStoreTaskReady
*
@ -75,6 +85,14 @@ void vTraceStoreTaskReady(objectHandleType handle)
placement of the trace macro. In that case, the events are ignored. */
return;
}
if (! readyEventsEnabled)
{
/* When creating tasks, ready events are also created. If creating
a "hidden" (not traced) task, we must therefore disable recording
of ready events to avoid an undesired ready event... */
return;
}
TRACE_ASSERT(handle <= NTask, "vTraceStoreTaskReady: Invalid value for handle", );
@ -171,13 +189,15 @@ void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t signed_si
uint16_t addr_low;
uint8_t addr_high;
uint32_t size;
TRACE_SR_ALLOC_CRITICAL_SECTION();
if (RecorderDataPtr == NULL) // This happens in vTraceInitTraceData, if using dynamic allocation...
return;
if (signed_size < 0)
size = (uint32_t)(- signed_size);
else
size = (uint32_t)(signed_size);
TRACE_SR_ALLOC_CRITICAL_SECTION();
trcCRITICAL_SECTION_BEGIN();
@ -619,9 +639,9 @@ void vTraceSetPriorityProperty(uint8_t objectclass, objectHandleType id, uint8_t
uint8_t uiTraceGetPriorityProperty(uint8_t objectclass, objectHandleType id)
{
TRACE_ASSERT(objectclass < TRACE_NCLASSES,
"uiTraceGetPriorityProperty: objectclass >= TRACE_NCLASSES", 0);
"uiTraceGetPriorityProperty: Invalid objectclass number (>= TRACE_NCLASSES)", 0);
TRACE_ASSERT(id <= RecorderDataPtr->ObjectPropertyTable.NumberOfObjectsPerClass[objectclass],
"uiTraceGetPriorityProperty: Invalid value for id", 0);
"uiTraceGetPriorityProperty: Task handle exceeds NTask. You may need to increase this constant in trcConfig.h.", 0);
return TRACE_PROPERTY_ACTOR_PRIORITY(objectclass, id);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Tracealyzer v2.7.0 Recorder Library
* Tracealyzer v2.7.7 Recorder Library
* Percepio AB, www.percepio.com
*
* trcUser.c
@ -33,7 +33,7 @@
*
* Tabs are used for indent in this file (1 tab = 4 spaces)
*
* Copyright Percepio AB, 2014.
* Copyright Percepio AB, 2012-2015.
* www.percepio.com
******************************************************************************/
#include "FreeRTOS.h"
@ -50,7 +50,7 @@
TRACE_STOP_HOOK vTraceStopHookPtr = (TRACE_STOP_HOOK)0;
extern uint8_t inExcludedTask;
extern uint8_t nISRactive;
extern int8_t nISRactive;
extern objectHandleType handle_of_last_logged_task;
extern uint32_t dts_min;
extern uint32_t hwtc_count_max_after_tick;
@ -127,6 +127,8 @@ void vTraceClear(void)
memset(RecorderDataPtr->eventData, 0, RecorderDataPtr->maxEvents * 4);
handle_of_last_logged_task = 0;
trcCRITICAL_SECTION_END();
}
@ -632,47 +634,55 @@ void vTraceStoreISREnd(int pendingISR)
uint16_t dts5;
TRACE_SR_ALLOC_CRITICAL_SECTION();
if (! RecorderDataPtr->recorderActive || ! handle_of_last_logged_task)
{
return;
}
if (recorder_busy)
{
vTraceError("Illegal call to vTraceStoreISREnd, recorder busy!");
return;
}
if (nISRactive == 0)
{
vTraceError("Unmatched call to vTraceStoreISREnd (nISRactive == 0, expected > 0)");
return;
}
trcCRITICAL_SECTION_BEGIN();
if (pendingISR == 0)
{
if (RecorderDataPtr->recorderActive && handle_of_last_logged_task)
uint8_t hnd8, type;
dts5 = (uint16_t)prvTraceGetDTS(0xFFFF);
if (nISRactive > 1)
{
uint8_t hnd8, type;
dts5 = (uint16_t)prvTraceGetDTS(0xFFFF);
if (nISRactive > 1)
{
/* return to another isr */
type = TS_ISR_RESUME;
hnd8 = prvTraceGet8BitHandle(isrstack[nISRactive]);
}
else
{
/* return to task */
type = TS_TASK_RESUME;
hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task);
}
ts = (TSEvent*)xTraceNextFreeEventBufferSlot();
if (ts != NULL)
{
ts->type = type;
ts->objHandle = hnd8;
ts->dts = dts5;
prvTraceUpdateCounters();
}
#if (SELECTED_PORT == PORT_ARM_CortexM)
/* Remember the last ISR exit event, as the event needs to be modified in case of a following ISR entry (if tail-chained ISRs) */
ptrLastISRExitEvent = (uint8_t*)ts;
#endif
/* return to another isr */
type = TS_ISR_RESUME;
hnd8 = prvTraceGet8BitHandle(isrstack[nISRactive]);
}
else
{
/* return to task */
type = TS_TASK_RESUME;
hnd8 = prvTraceGet8BitHandle(handle_of_last_logged_task);
}
ts = (TSEvent*)xTraceNextFreeEventBufferSlot();
if (ts != NULL)
{
ts->type = type;
ts->objHandle = hnd8;
ts->dts = dts5;
prvTraceUpdateCounters();
}
#if (SELECTED_PORT == PORT_ARM_CortexM)
/* Remember the last ISR exit event, as the event needs to be modified in case of a following ISR entry (if tail-chained ISRs) */
ptrLastISRExitEvent = (uint8_t*)ts;
#endif
}
nISRactive--;