]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/ARM_ITM/Keil-uVision-Tracealyzer-ITM-Exporter.ini
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-Plus-Trace / streamports / ARM_ITM / Keil-uVision-Tracealyzer-ITM-Exporter.ini
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
6 \r
7 FUNC void tzSetEnable(int enable)\r
8 {       \r
9         if (enable == 1)\r
10         {\r
11                 printf("Starting Tracealyzer recorder\n");              \r
12         \r
13                 // Forward the ITM data to file\r
14                 exec("ITMLOG 1 > .\\tracealyzer.psf");\r
15                 \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
19         }\r
20         else if (enable == 0)\r
21         {       \r
22                 printf("Stopping Tracealyzer recorder...\n"); \r
23                 \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
27 \r
28                 _sleep_(2000); // Wait a while to let all data be written the host file.\r
29                 \r
30                 // Stop forwarding the ITM data to file and close the file.\r
31                 exec("ITMLOG 1 OFF");\r
32                 \r
33                 printf("Tracealyzer recorder stopped.\n"); \r
34                 \r
35         }\r
36         else printf("Usage: tzSetEnable(0 or 1), where 0 is disable (stops recorder) and 1 enable (starts recording)");\r
37         \r
38\r
39 \r
40 \r
41 // The Tracealyzer ITM stream port for Keil µVision can be used in two ways.\r
42 //\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
45 //\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
48 \r
49 tzSetEnable(1);\r
50 \r
51 DEFINE BUTTON "Start Recording", "tzSetEnable(1)";\r
52 DEFINE BUTTON "Stop Recording", "tzSetEnable(0)";