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 #1264 background imageLoading...
Page #1264 background image
Chapter 4
API Guides
4.1 Application Level Tracing library
4.1.1 Overview
IDF provides useful feature for program behavior analysis: application level tracing. It is implemented in the corre-
sponding library and can be enabled in menuconfig. This feature allows to transfer arbitrary data between host and
ESP32-S2 via JTAG interface with small overhead on program execution.
Developers can use this library to send application specific state of execution to the host and receive commands or
other type of info in the opposite direction at runtime. The main use cases of this library are:
1. Collecting application specific data, see Application Specific Tracing
2. Lightweight logging to the host, see Logging to Host
3. System behavior analysis, see System Behavior Analysis with SEGGER SystemView
4. Source code coverage, see Gcov (Source Code Coverage)
Tracing components when working over JTAG interface are shown in the figure below.
4.1.2 Modes of Operation
The library supports two modes of operation:
Post-mortem mode. This is the default mode. The mode does not need interaction with the host side. In this mode
tracing module does not check whether host has read all the data from HW UP BUFFER buffer and overwrites old
data with the new ones. This mode is useful when only the latest trace data are interesting to the user, e.g. for
analyzing programs behavior just before the crash. Host can read the data later on upon user request, e.g. via
special OpenOCD command in case of working via JTAG interface.
Streaming mode. Tracing module enters this mode when host connects to ESP32-S2. In this mode before writ-
ing new data to HW UP BUFFER tracing module checks that there is enough space in it and if necessary waits for
the host to read data and free enough memory. Maximum waiting time is controlled via timeout values passed by
users to corresponding API routines. So when application tries to write data to trace buffer using finite value of
the maximum waiting time it is possible situation that this data will be dropped. Especially this is true for trac-
ing from time critical code (ISRs, OS scheduler code etc.) when infinite timeouts can lead to system malfunction.
In order to avoid loss of such critical data developers can enable additional data buffering via menuconfig option
CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX. This macro specifies the size of data which can be buffered in
above conditions. The option can also help to overcome situation when data transfer to the host is temporarily slowed
down, e.g due to USB bus congestions etc. But it will not help when average bitrate of trace data stream exceeds HW
interface capabilities.
1253

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