docs: Improve information about debugging for Espressif SoCs

Provide more information on how to properly use OpenOCD and gdb to
debug Espressif SoCs on NuttX.
This commit is contained in:
Tiago Medicci
2024-08-14 13:18:04 -03:00
committed by Xiang Xiao
parent b3f1871bc3
commit 3ae30d00ea
7 changed files with 263 additions and 47 deletions
@@ -135,8 +135,10 @@ externally-built 2nd stage bootloader and the partition table (if applicable): w
``make bootloader``, these files are placed into ``nuttx`` folder. ``ESPTOOL_BAUD`` is able to
change the flash baud rate if desired.
Debugging with OpenOCD
======================
Debugging with ``openocd`` and ``gdb``
======================================
Espressif uses a specific version of OpenOCD to support ESP32-S2: `openocd-esp32 <https://github.com/espressif/>`_.
Please check `Building OpenOCD from Sources <https://docs.espressif.com/projects/esp-idf/en/release-v5.1/esp32s2/api-guides/jtag-debugging/index.html#jtag-debugging-building-openocd>`_
for more information on how to build OpenOCD for ESP32-S2.
@@ -157,10 +159,33 @@ Some boards, like :ref:`ESP32-S2-Kaluga-1 Kit v1.3 <platforms/xtensa/esp32s2/boa
Other boards that don't have any built-in JTAG debugger can be debugged using an external JTAG debugger being connected
directly to the ESP32-S2 JTAG pins.
.. note:: One must configure the USB drivers to enable JTAG communication. Please check
`Configure USB Drivers <https://docs.espressif.com/projects/esp-idf/en/release-v5.1/esp32s2/api-guides/jtag-debugging/configure-ft2232h-jtag.html?highlight=udev#configure-usb-drivers>`_
for configuring the JTAG adapter of the :ref:`ESP32-S2-Kaluga-1 <platforms/xtensa/esp32s2/boards/esp32s2-kaluga-1/index:ESP32-S2-Kaluga-1 Kit v1.3>` board
and other FT2232-based JTAG adapters.
OpenOCD can then be used::
openocd -c 'set ESP_RTOS hwthread; set ESP_FLASH_SIZE 0' -f board/esp32s2-kaluga-1.cfg
Once OpenOCD is running, you can use GDB to connect to it and debug your application::
xtensa-esp32s2-elf-gdb -x gdbinit nuttx
whereas the content of the ``gdbinit`` file is::
target remote :3333
set remote hardware-watchpoint-limit 2
mon reset halt
flushregs
monitor reset halt
thb nsh_main
c
.. note:: ``nuttx`` is the ELF file generated by the build process. Please note that ``CONFIG_DEBUG_SYMBOLS`` must be enabled in the ``menuconfig``.
Please refer to :doc:`/quickstart/debugging` for more information about debugging techniques.
Peripheral Support
==================