summaryrefslogtreecommitdiff
path: root/FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini')
-rw-r--r--FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini52
1 files changed, 52 insertions, 0 deletions
diff --git a/FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini b/FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini
new file mode 100644
index 000000000..5e2c8b99b
--- /dev/null
+++ b/FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini
@@ -0,0 +1,52 @@
+/************************************************************
+* Percepio Tracealyzer - ITM Trace Exporter for Keil uVision
+* Copyright (c) 2018, Percepio AB.
+* https://percepio.com
+************************************************************/
+
+FUNC void tzSetEnable(int enable)
+{
+ if (enable == 1)
+ {
+ printf("Starting Tracealyzer recorder\n");
+
+ // Forward the ITM data to file
+ exec("ITMLOG 1 > .\\tracealyzer.psf");
+
+ // Send start command to Tracealyzer (not required if using vTraceEnable(TRC_START))
+ exec("E CHAR tz_host_command_data = 1, 1, 0, 0, 0, 0, 0xFD, 0xFF");
+ exec("tz_host_command_bytes_to_read = 8");
+ }
+ else if (enable == 0)
+ {
+ printf("Stopping Tracealyzer recorder...\n");
+
+ // Send stop command to Tracealyzer, to stop writing ITM data.
+ exec("E CHAR tz_host_command_data = 1, 0, 0, 0, 0, 0, 0xFE, 0xFF");
+ exec("tz_host_command_bytes_to_read = 8");
+
+ _sleep_(2000); // Wait a while to let all data be written the host file.
+
+ // Stop forwarding the ITM data to file and close the file.
+ exec("ITMLOG 1 OFF");
+
+ printf("Tracealyzer recorder stopped.\n");
+
+ }
+ else printf("Usage: tzSetEnable(0 or 1), where 0 is disable (stops recorder) and 1 enable (starts recording)");
+
+}
+
+
+// The Tracealyzer ITM stream port for Keil µVision can be used in two ways.
+//
+// 1. Start tracing directly from startup.
+// Make sure tzSetEnable(1) is called below and vTraceEnable(TRC_START) in your target startup.
+//
+// 2. Start the trace manually, using the "Start Recording" button in Keil µVision.
+// In this case, comment out the below call to tzSetEnable and make sure you call vTraceEnable(TRC_INIT) in your target startup (not TRC_START).
+
+tzSetEnable(1);
+
+DEFINE BUTTON "Start Recording", "tzSetEnable(1)";
+DEFINE BUTTON "Stop Recording", "tzSetEnable(0)"; \ No newline at end of file