Chapter 4. API Guides
Once make process is successfully completed, the executable of OpenOCD will be saved in ~/esp/openocd-
esp32/src/openocd directory.
Next Steps To carry on with debugging environment setup, proceed to section Configuring ESP32-S2 Target.
The examples of invoking OpenOCD in this document assume using pre-built binary distribution described in section
Setup of OpenOCD.
To use binaries build locally from sources, change the path to OpenOCD executable to src/openocd and set
the OPENOCD_SCRIPTS environment variable so that OpenOCD can find the configuration files. For Linux and
macOS:
cd ~/esp/openocd-esp32
export OPENOCD_SCRIPTS=$PWD/tcl
For Windows:
cd %USERPROFILE%\esp\openocd-esp32
set "OPENOCD_SCRIPTS=%CD%\tcl"
Example of invoking OpenOCD build locally from sources, for Linux and macOS:
src/openocd -f board/esp32s2-kaluga-1.cfg
and Windows:
src\openocd -f board/esp32s2-kaluga-1.cfg
4.17.9 Tips and Quirks
This section provides collection of links to all tips and quirks referred to from various parts of this guide.
Tips and Quirks
This section provides collection of all tips and quirks referred to from various parts of this guide.
Breakpoints and watchpoints available ESP32-S2 debugger supports 2 hardware implemented breakpoints and
64 software ones. Hardware breakpoints are implemented by ESP32-S2 chip’s logic and can be set anywhere
in the code: either in flash or IRAM program’s regions. Additionally there are 2 types of software break-
points implemented by OpenOCD: flash (up to 32) and IRAM (up to 32) breakpoints. Currently GDB can not
set software breakpoints in flash. So until this limitation is removed those breakpoints have to be emulated by
OpenOCD as hardware ones (see below for details). ESP32-S2 also supports two watchpoints, so two variables can
be watched for change or read by the GDB command watch myVariable. Note that menuconfig option CON-
FIG_FREERTOS_WATCHPOINT_END_OF_STACK uses the 2nd watchpoint and will not provide expected results,
if you also try to use it within OpenOCD / GDB. See menuconfig’s help for detailed description.
What else should I know about breakpoints? Emulating part of hardware breakpoints using software flash ones
means that the GDB command hb myFunction which is invoked for function in flash will use pure hardware
breakpoint if it is avalable otherwise one of the 32 software flash breakpoints is used. The same rule applies to b
myFunction-like commands. In this case GDB will decide what type of breakpoint to set itself. If myFunction
is resided in writable region (IRAM) software IRAM breakpoint will be used otherwise hardware or software flash
breakpoint is used as it is done for hb command.
Espressif Systems 1382
Submit Document Feedback
Release v4.4