1
6
14
15
21
22
23
24
25
26
27
28
31
32
33
34
44
45
46
/* ... */
/* ... */
#include <stdio.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_app_trace.h"
#include "esp_log.h"6 includes
static const char *TAG = "example";
void app_main(void)
{
ESP_LOGI(TAG, "Waiting for OpenOCD connection");
while (!esp_apptrace_host_is_connected(ESP_APPTRACE_DEST_JTAG)) {
vTaskDelay(1);
}{...}
ESP_LOGI(TAG, "Sending example data to the host...");
for (unsigned int cnt = 1; cnt < 51; ++cnt) {
char buf[32] = {0};
snprintf(buf, sizeof(buf), "Apptrace test data[%d]:%d\n", cnt, cnt * cnt);
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, buf, strlen(buf), ESP_APPTRACE_TMO_INFINITE);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to write data to host [0x%x] (%s)", res, esp_err_to_name(res));
}{...}
esp_apptrace_flush(ESP_APPTRACE_DEST_JTAG, 1000);
vTaskDelay(50 / portTICK_PERIOD_MS);
}{...}
ESP_LOGI(TAG, "Done!");
}{ ... }