Commit 3f49ab72 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Enable instrumentation including logging of task names for execution analysis

parent b1af1384
......@@ -16,6 +16,9 @@
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* Instrumentation headers */
#include <ti/uia/runtime/LogSnapshot.h>
/* Driverlib headers */
#include <driverlib/gpio.h>
......@@ -62,3 +65,29 @@ int main(void)
/* Start BIOS */
BIOS_start();
}
/**** The code below is only for Instrumentation purposes! ****/
/* The redefinition of ti_uia_runtime_LogSnapshot_writeNameOfReference
* is necessary due to bug UIA-23 fixed in UIA 2.00.06.52, cf.
* http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/uia/2_00_06_52/exports/docs/uia_2_00_06_52_release_notes.html
*/
#undef ti_uia_runtime_LogSnapshot_writeNameOfReference
#define ti_uia_runtime_LogSnapshot_writeNameOfReference(refId, fmt, startAdrs, lengthInMAUs) \
( \
(ti_uia_runtime_LogSnapshot_putMemoryRange(ti_uia_events_UIASnapshot_nameOfReference, Module__MID, \
(IArg)refId,(IArg)__FILE__,(IArg)__LINE__, \
(IArg)fmt, (IArg)startAdrs, (IArg)lengthInMAUs)) \
)
/* Log the task name whenever a task is created.
* This works around a limitation of UIA where tasks sharing a "main"
* function do not show up separately in the execution analyzer, cf.
* http://processors.wiki.ti.com/index.php/System_Analyzer_Tutorial_3A#Going_Further:_How_to_have_Analysis_tables_and_graphs_display_the_names_of_tasks_created_at_run_time
*/
#include <string.h>
Void tskCreateHook(Task_Handle hTask, Error_Block *eb) {
String name = Task_Handle_name(hTask);
LogSnapshot_writeNameOfReference(hTask, "Task_create: handle=%x", name, strlen(name)+1);
ti_uia_runtime_LogSnapshot_writeNameOfReference(hTask, "Task_create: handle=%x", name, strlen(name)+1);
}
......@@ -31,6 +31,8 @@ var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
var Event = xdc.useModule('ti.sysbios.knl.Event');
var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Timer = xdc.useModule('ti.sysbios.hal.Timer');
var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
var LogSnapshot = xdc.useModule('ti.uia.runtime.LogSnapshot');
System.SupportProxy = SysMin;
/* ================ Kernel configuration ================ */
......@@ -41,31 +43,36 @@ BIOS.libType = BIOS.LibType_Custom;
//slower and bigger, but full debug capabilities
//BIOS.libType = BIOS.LibType_Debug;
BIOS.logsEnabled = false;
BIOS.assertsEnabled = false;
/* ================ Driver configuration ================ */
/*
Per driver configuration is not neccessary anymore.
TIRTOS and XDC automatically detect which driver is
TIRTOS and XDC automatically detect which driver is
used by the application and link the modules when needed.
\cite{TI-RTOS 2.16 User Guide}
*/
var DriversConfig = xdc.useModule('ti.drivers.Config');
var driversConfig = xdc.useModule('ti.drivers.Config');
/* =========== Instrumentation configuration =========== */
/* Deactivate RTOS assertions */
BIOS.assertsEnabled = false;
/* Deactivate assertions and logging for drivers */
DriversConfig.libType = DriversConfig.LibType_NonInstrumented;
//deactivate assertions and logging for drivers
driversConfig.libType = driversConfig.LibType_NonInstrumented;
BIOS.logsEnabled = true;
Defaults.common$.namedInstance = true;
/* Add hooks for UIA to monitor task creation and task switches */
Task.addHookSet ({ createFxn: '&tskCreateHook', });
LoggingSetup.snapshotLogging = true
/* =========== Various custom configuration values =========== */
Task.idleTaskStackSize = 512;
BIOS.heapSize = (1024*10*2);/*system heap - used for task stacks for example*/
/*
Buffer size for system_printf() - use with care -
it is SLOW, needs system_flush() after every call and
may cause observation of unpredictable behaviour
Buffer size for System_printf() - use with care -
it is SLOW, needs System_flush() after every call and
may cause observation of unpredictable behaviour.
*/
SysMin.bufSize = 1024;
Defaults.common$.namedInstance = true;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment