The only why I got it working was build and flashing the esp-idf hello_main example for ESP32S2 and then:
$ esp32s2openocd -c "set ESP_RTOS none" -f esp32s2_saola.cfg -c "init; halt" Open On-Chip Debugger v0.10.0-esp32-20210401-13-g5d011fa5 (2021-05-12-12:41) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html none adapter speed: 3000 kHz Info : clock speed 3000 kHz Info : JTAG tap: esp32s2.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1) Info : esp32s2: Debug controller was reset. Info : esp32s2: Core was reset. Info : Listening on port 3333 for gdb connections Info : esp32s2: Target halted, PC=0x400902BE, debug_reason=00000000 Info : Detected ESP32-S2 chip Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Flash mapping 0: 0x10020 -> 0x3f000020, 23 KB Info : Flash mapping 1: 0x20020 -> 0x40080020, 66 KB Info : Using flash bank 'esp32s2.irom' size 68 KB Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Flash mapping 0: 0x10020 -> 0x3f000020, 23 KB Info : Flash mapping 1: 0x20020 -> 0x40080020, 66 KB Info : Using flash bank 'esp32s2.irom' size 68 KB Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Flash mapping 0: 0x10020 -> 0x3f000020, 23 KB Info : Flash mapping 1: 0x20020 -> 0x40080020, 66 KB Info : Using flash bank 'esp32s2.drom' size 24 KB Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Flash mapping 0: 0x10020 -> 0x3f000020, 23 KB Info : Flash mapping 1: 0x20020 -> 0x40080020, 66 KB Info : Using flash bank 'esp32s2.drom' size 24 KB Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections
In the second terminal:
$ xtensa-esp32s2-elf-gdb nuttx GNU gdb (crosstool-NG esp-2020r3) 8.1.0.20180627-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32s2-elf". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"… Reading symbols from nuttx…done. (gdb) target extended-remote :3333 Remote debugging using :3333 0x400902be in ?? () (gdb) mon reset halt JTAG tap: esp32s2.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1) esp32s2: Debug controller was reset. esp32s2: Core was reset. esp32s2: Target halted, PC=0x4000FCD5, debug_reason=00000000 esp32s2: Core was reset. esp32s2: Target halted, PC=0x40000400, debug_reason=00000000 (gdb) flushregs Register cache flushed. (gdb) b nx_start Breakpoint 1 at 0x40080b80: file init/nx_start.c, line 353. (gdb) c Continuing. Note: automatically using hardware breakpoints for read-only addresses. esp32s2: Target halted, PC=0x40080B80, debug_reason=00000001 Breakpoint 1, nx_start () at init/nx_start.c:353 353 { (gdb)