Chapter 4. API Guides
if
(res
!=
ESP_OK) {
ESP_LOGE(TAG,
return
res;
}
if
(sz
>
0) {
/* we have data, process them */
...
}
esp_apptrace_read() function uses memcpy to copy host data to user buffer.
some cases it can be more optimal to use esp_apptrace_down_buffer_get() and
esp_apptrace_down_buffer_put() functions.
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
100/*tmo in
us*/);
→
if
(ptr
==
NULL) {
ESP_LOGE(TAG,
return
ESP_FAIL;
}
if
(sz
>
4) {
number
=
(uint32_t
printf("Here is the number
}
else
{
printf("No
}
esp_err_t res
=
*tmo in
us*/);
→
if
(res
!=
ESP_OK) {
/* in case of error host tracing tool (e.g. OpenOCD) will
incomplete user buffer */
→
ESP_LOGE(TAG,
return
res;
}
2. The next step is to build the program image and download it to the target as described in the
Guide.
3. Run OpenOCD (see
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
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
OpenOCD Application Level Tracing Commands
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
"Failed to read data from
*)esp_apptrace_down_buffer_get(ESP_APPTRACE_DEST_TRAX,
"Failed to get
buffer!");
*)ptr;
%d", *number);
data");
esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr,
"Failed to put
buffer!");
JTAG
Debugging).
Logging to
Host).
Submit Document Feedback
host!");
They allow developers to occupy chunk of
OpenOCD Application Level Tracing
HW UP BUFFER is shared between user data blocks and
1256
(continued from previous page)
In
&sz,␣
100/
report␣
Getting Started
Commands.
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?