Apptrace - Read data from host
Posted: Tue Aug 04, 2020 3:19 pm
I have some questions using the apptrace library to read data from host via jtag and openocd-esp32. I've successfully got communication working from target to host with the example in the documentation: https://docs.espressif.com/projects/esp ... ic-tracing:
What I'm wondering is how to set up the host in order to write data to the target. The apptrace library provides API for reading data from host:
But there is no information on how to set up this on the host side. Anyone that has done this? Is it possible to send data via openocd-esp32 with some command?
Any tips are helpful!
Code: Select all
#include "esp_app_trace.h"
...
char buf[] = "Hello World!";
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, buf, strlen(buf), ESP_APPTRACE_TMO_INFINITE);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to write data to host!");
return res;
}
Code: Select all
#include "esp_app_trace.h"
...
char buf[32];
char down_buf[32];
size_t sz = sizeof(buf);
/* config down buffer */
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
/* check for incoming data and read them if any */
esp_err_t res = esp_apptrace_read(ESP_APPTRACE_DEST_TRAX, buf, &sz, 0/*do not wait*/);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to read data from host!");
return res;
}
if (sz > 0) {
/* we have data, process them */
...
}
Any tips are helpful!