$ openocd -f esp32s2_saola.cfg 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 adapter speed: 3000 kHz Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : clock speed 3000 kHz Info : JTAG tap: esp32s2.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1) Info : esp32s2: Target halted, PC=0x40000400, debug_reason=00000000 Info : Detected ESP32-S2 chip Info : Listening on port 3333 for gdb connections Info : accepting 'gdb' connection on tcp/3333 Warn : No symbols for FreeRTOS! Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Error: Failed to get flash maps (-6)! Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'. Warn : Failed to get flash mappings (-4)! Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Auto-detected flash bank 'esp32s2.flash' size 4096 KB Info : Using flash bank 'esp32s2.flash' size 4096 KB Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Error: Failed to get flash maps (-6)! Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'. Warn : Failed to get flash mappings (-4)! Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Using flash bank 'esp32s2.irom' size 0 KB Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Error: Failed to get flash maps (-6)! Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'. Warn : Failed to get flash mappings (-4)! Info : esp32s2: Target halted, PC=0x40031CAA, debug_reason=00000001 Info : Using flash bank 'esp32s2.drom' size 0 KB Warn : negative reply, retrying Warn : RTOS FreeRTOS not detected. (GDB could not find symbol 'pxCurrentTCB') Warn : RTOS FreeRTOS not detected. (GDB could not find symbol 'pxCurrentTCB') Warn : RTOS FreeRTOS not detected. (GDB could not find symbol 'pxCurrentTCB') invalid command name "nuttx.pid_offset" invalid command name "nuttx.xcpreg_offset" invalid command name "nuttx.state_offset" invalid command name "nuttx.name_offset" invalid command name "nuttx.name_size" 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 : esp32s2: Target halted, PC=0x40007299, debug_reason=00000000 Info : esp32s2: Core was reset. Info : esp32s2: Target halted, PC=0x40000400, debug_reason=00000000 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 : esp32s2: Target halted, PC=0x4000F99B, debug_reason=00000000 Info : esp32s2: Core was reset. Info : esp32s2: Target halted, PC=0x40000400, debug_reason=00000000 Warn : address 0x400804b0 not writable Error: esp32s2: Failed to write breakpoint instruction (-4)! Error: esp32s2: Failed to add SW breakpoint! Error: can't add breakpoint: unknown reason
In another terminal execute:
$ xtensa-esp32-elf-gdb nuttx GNU gdb (crosstool-NG esp-2020r2) 8.1.0.20180627-git Copyright (C) 2018 Free Software Foundation, Inc. … Reading symbols from nuttx…done. (gdb) target extended-remote :3333 Remote debugging using :3333 0x4001276f in ?? () (gdb) symbol-file nuttx Load new symbol table from "nuttx"? (y or n) y Reading symbols from nuttx…done. invalid command name "nuttx.pid_offset" invalid command name "nuttx.xcpreg_offset" invalid command name "nuttx.state_offset" invalid command name "nuttx.name_offset" invalid command name "nuttx.name_size" (gdb) set remote hardware-watchpoint-limit 2 (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=0x40007299, debug_reason=00000000 esp32s2: Core was reset. esp32s2: Target halted, PC=0x40000400, debug_reason=00000000 (gdb) flushregs Register cache flushed. (gdb) b __start Breakpoint 1 at 0x400226b8: file chip/esp32s2_start.c, line 77. (gdb) b nx_start Breakpoint 2 at 0x400804b0: file init/nx_start.c, line 353. (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /comum/workspace/Espressif/NuttX/nuttx/nuttx Warning: Cannot insert breakpoint 2. Cannot access memory at address 0x400804b0 Command aborted. (gdb) c Continuing. Warning: Cannot insert breakpoint 2. Cannot access memory at address 0x400804b0 Command aborted. (gdb)