Espressif ESP32-S2 Programming Manual page 90

Table of Contents

Advertisement

Chapter 1. Get Started
Launching GDB with GDBStub
stack dump (similar to the ones above) over the serial port. Then it resets the board.
Furthermore, the application can be configured to run GDBStub in the background and handle the Ctrl+C event from
the monitor.
Optionally, the panic handler can be configured to run GDBStub, the tool which can communicate with
debugger. GDBStub allows to read memory, examine call stack frames and variables, etc. It is not as versatile as
JTAG debugging, but this method does not require any special hardware.
To enable GDBStub on panic, open the project configuration menu (idf.py menuconfig) and set
FIG_ESP_SYSTEM_PANIC
runtime.
In this case, if the panic handler or Ctrl+C command is triggered, as soon as IDF Monitor sees that GDBStub has
loaded, it automatically pauses serial monitoring and runs GDB with necessary arguments. After GDB exits, the
board is reset via the RTS serial line. If this line is not connected, please reset the board manually by pressing its
Reset button.
In the background, IDF Monitor runs the following command:
xtensa-esp32s2-elf-gdb -ex "set serial baud BAUD" -ex "target remote PORT"
interrupt build/PROJECT.elf :idf_target:`Hello NAME chip`
Output Filtering
IDF monitor can be invoked as idf.py monitor --print-filter="xyz", where
--print-filter is the parameter for output filtering. The default value is an empty string, which means that
everything is printed.
Restrictions on what to print can be specified as a series of <tag>:<log_level> items where <tag> is the tag
string and <log_level> is a character from the set {N, E, W, I, D, V, *} referring to a level for logging.
For example,
PRINT_FILTER="tag1:W" matches and prints only the outputs written with
ESP_LOGW("tag1", ...) or at lower verbosity level, i.e. ESP_LOGE("tag1", ...). Not speci-
fying a <log_level> or using * defaults to Verbose level.
Note: Use primary logging to disable at compilation the outputs you do not need through the
filtering with IDF monitor is a secondary solution which can be useful for adjusting the filtering options without
recompiling the application.
Your app tags must not contain spaces, asterisks *, or colons : to be compatible with the output filtering feature.
If the last line of the output in your app is not followed by a carriage return, the output filtering might get confused, i.e.,
the monitor starts to print the line and later finds out that the line should not have been written. This is a known issue
and can be avoided by always adding a carriage return (especially when no output follows immediately afterwards).
Examples Of Filtering Rules:
• * can be used to match any tags. However, the string PRINT_FILTER="*:I tag1:E" with regards to
tag1 prints errors only, because the rule for tag1 has a higher priority over the rule for *.
• The default (empty) rule is equivalent to *:V because matching every tag at the Verbose level or lower means
matching everything.
• "*:N" suppresses not only the outputs from logging functions, but also the prints made by printf, etc. To
avoid this, use *:E or a higher verbosity level.
• Rules "tag1:V", "tag1:v", "tag1:", "tag1:*", and "tag1" are equivalent.
• Rule "tag1:W tag1:E" is equivalent to "tag1:E" because any consequent occurrence of the same tag
name overwrites the previous one.
• Rule "tag1:I tag2:W" only prints tag1 at the Info verbosity level or lower and tag2 at the Warning
verbosity level or lower.
• Rule "tag1:I tag2:W tag3:N" is essentially equivalent to the previous one because tag3:N specifies
that tag3 should not be printed.
Espressif Systems
By default, if esp-idf crashes, the panic handler prints relevant registers and the
to GDBStub on panic or set
Submit Document Feedback
CONFIG_ESP_SYSTEM_PANIC
79
GDB
project
CON-
to GDBStub on
-ex␣
logging
library. Output
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Table of Contents

Save PDF