EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1267 background imageLoading...
Page #1267 background image
Chapter 4. API Guides
(continued from previous page)
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to read data from host!");
return res;
}
if (sz > 0) {
/* we have data, process them */
...
}
esp_apptrace_read() function uses memcpy to copy host data to user buffer. In
some cases it can be more optimal to use esp_apptrace_down_buffer_get() and
esp_apptrace_down_buffer_put() functions. They allow developers to occupy chunk of
read buffer and process it in-place. The following piece of code shows how to do this.
#include "esp_app_trace.h"
...
char down_buf[32];
uint32_t *number;
size_t sz = 32;
/* config down buffer */
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
char *ptr = (char *)esp_apptrace_down_buffer_get(ESP_APPTRACE_DEST_TRAX, &sz,
,100/*tmo in us*/);
if (ptr == NULL) {
ESP_LOGE(TAG, "Failed to get buffer!");
return ESP_FAIL;
}
if (sz > 4) {
number = (uint32_t *)ptr;
printf("Here is the number %d", *number);
} else {
printf("No data");
}
esp_err_t res = esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/
,*tmo in us*/);
if (res != ESP_OK) {
/* in case of error host tracing tool (e.g. OpenOCD) will report
,incomplete user buffer */
ESP_LOGE(TAG, "Failed to put buffer!");
return res;
}
2. The next step is to build the program image and download it to the target as described in the Getting Started
Guide.
3. Run OpenOCD (see JTAG Debugging).
4. Connect to OpenOCD telnet server. It can be done using the following command in terminal telnet
<oocd_host> 4444. If telnet session is opened on the same machine which runs OpenOCD you can
use localhost as <oocd_host> in the command above.
5. Start trace data collection using special OpenOCD command. This command will transfer tracing data and
redirect them to specified file or socket (currently only files are supported as trace data destination). For
description of the corresponding commands see OpenOCD Application Level Tracing Commands.
6. The final step is to process received data. Since format of data is defined by user the processing stage is out
of the scope of this document. Good starting points for data processor are python scripts in $IDF_PATH/
tools/esp_app_trace: apptrace_proc.py (used for feature tests) and logtrace_proc.py
(see more details in section Logging to Host).
OpenOCD Application Level Tracing Commands HW UP BUFFER is shared between user data blocks and
filling of the allocated memory is performed on behalf of the API caller (in task or ISR context). In multithreading
environment it can happen that task/ISR which fills the buffer is preempted by another high priority task/ISR. So
Espressif Systems 1256
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish