1 /************************************************************
\r
2 * Percepio Tracealyzer - ITM Trace Exporter for Keil uVision
\r
3 * Copyright (c) 2018, Percepio AB.
\r
4 * https://percepio.com
\r
5 ************************************************************/
\r
7 FUNC void tzSetEnable(int enable)
\r
11 printf("Starting Tracealyzer recorder\n");
\r
13 // Forward the ITM data to file
\r
14 exec("ITMLOG 1 > .\\tracealyzer.psf");
\r
16 // Send start command to Tracealyzer (not required if using vTraceEnable(TRC_START))
\r
17 exec("E CHAR tz_host_command_data = 1, 1, 0, 0, 0, 0, 0xFD, 0xFF");
\r
18 exec("tz_host_command_bytes_to_read = 8");
\r
20 else if (enable == 0)
\r
22 printf("Stopping Tracealyzer recorder...\n");
\r
24 // Send stop command to Tracealyzer, to stop writing ITM data.
\r
25 exec("E CHAR tz_host_command_data = 1, 0, 0, 0, 0, 0, 0xFE, 0xFF");
\r
26 exec("tz_host_command_bytes_to_read = 8");
\r
28 _sleep_(2000); // Wait a while to let all data be written the host file.
\r
30 // Stop forwarding the ITM data to file and close the file.
\r
31 exec("ITMLOG 1 OFF");
\r
33 printf("Tracealyzer recorder stopped.\n");
\r
36 else printf("Usage: tzSetEnable(0 or 1), where 0 is disable (stops recorder) and 1 enable (starts recording)");
\r
41 // The Tracealyzer ITM stream port for Keil µVision can be used in two ways.
\r
43 // 1. Start tracing directly from startup.
\r
44 // Make sure tzSetEnable(1) is called below and vTraceEnable(TRC_START) in your target startup.
\r
46 // 2. Start the trace manually, using the "Start Recording" button in Keil µVision.
\r
47 // 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).
\r
51 DEFINE BUTTON "Start Recording", "tzSetEnable(1)";
\r
52 DEFINE BUTTON "Stop Recording", "tzSetEnable(0)";