Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-S3-DevKitC-1: debug is not working (OCD-1033) #344

Closed
jsmith173 opened this issue Oct 29, 2024 · 6 comments
Closed

ESP32-S3-DevKitC-1: debug is not working (OCD-1033) #344

jsmith173 opened this issue Oct 29, 2024 · 6 comments

Comments

@jsmith173
Copy link

I'm using the latest Espressif-IDE. When I try to create a new openocd debug configuration and press the Debug button the console shows the following log and the Debug is not started.

GNU gdb (esp-gdb) 14.2_20240403
http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : [esp32s3.cpu0] Target halted, PC=0x4038E452, debug_reason=00000001
Warn : Failed to get flash maps (-1)!
Warn : Failed to get flash mappings (-4)!
Info : [esp32s3.cpu0] Target halted, PC=0x4038E
452, debug_reason=00000001
Error: Failed to get flash size!
Please refer to the troubleshooting guide below to identify the problem.
https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ
Info : [esp32s3.cpu0] Target halted, PC=0x4038E452,
debug_reason=00000001
Error: Failed to get
Please refer to the troubleshooting guide below to identify the problem.
https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ
flash size!
Error: Failed to probe flash, s
Please refer to the troubleshooting guide below to identify the problem.
https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ
ize 0 KB
Error: auto_probe failed
Please refer to the troubleshooting guide below to identify the problem.
https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Please refer to the troubleshooting guide below to identify the problem.
https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ
Error: attempted 'gdb' connection rejected
Please refer to the troubleshooting guide below to identify the problem.
https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ
shutdown command invoked

I tried to start separately openocd and connect gdb. Openocd starts but gdb can't connect.

@github-actions github-actions bot changed the title ESP32-S3-DevKitC-1: debug is not working ESP32-S3-DevKitC-1: debug is not working (OCD-1033) Oct 29, 2024
@erhankur
Copy link
Collaborator

I tried to start separately openocd and connect gdb. Openocd starts but gdb can't connect.

@jsmith173 Do you mean did you try from the console? Did you try with a hello-world app to make sure your hw and usb cable connection works fine?

You can share the openocd logs (-d3) to help us understand what is going on in the background.

First,

openocd  -f board/esp32s3-builtin.cfg -c "esp stub_log on" -d3 -l log.txt

Then you can run xtensa-esp32s3-elf-gdb and attach the log.txt here.

@jsmith173
Copy link
Author

I'm sending the log file

log.txt

@erhankur
Copy link
Collaborator

Debug: 2244 67528 gdb_server.c:379 gdb_log_incoming_packet(): [esp32s3.cpu0] {1} received packet: qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+
Debug: 2245 67528 xtensa.c:1420 xtensa_get_gdb_reg_list(): reg_class=0, num_regs=228
Debug: 2246 67528 gdb_server.c:397 gdb_log_outgoing_packet(): [esp32s3.cpu0] {1} sending packet: $PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+#02
Error: 2247 67528 gdb_server.c:505 gdb_put_packet_inner(): GDB missing ack(2) - assumed good
Debug: 2248 67528 gdb_server.c:379 gdb_log_incoming_packet(): [esp32s3.cpu0] {1} received packet: qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+
Debug: 2249 67528 xtensa.c:1420 xtensa_get_gdb_reg_list(): reg_class=0, num_regs=228
Debug: 2250 67528 gdb_server.c:397 gdb_log_outgoing_packet(): [esp32s3.cpu0] {1} sending packet: $PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+#02
Debug: 2251 67528 gdb_server.c:379 gdb_log_incoming_packet(): [esp32s3.cpu0] {1} received packet: +
Debug: 2252 67528 gdb_server.c:379 gdb_log_incoming_packet(): [esp32s3.cpu0] {1} received packet: vCont?
Debug: 2253 67528 gdb_server.c:397 gdb_log_outgoing_packet(): [esp32s3.cpu0] {1} sending packet: $vCont;c;C;s;S#62
Debug: 2254 67528 gdb_server.c:379 gdb_log_incoming_packet(): [esp32s3.cpu0] {1} received packet: +
Debug: 2255 67528 gdb_server.c:379 gdb_log_incoming_packet(): [esp32s3.cpu0] {1} received packet: vMustReplyEmpty
Debug: 2256 67528 gdb_server.c:397 gdb_log_outgoing_packet(): [esp32s3.cpu0] {1} sending packet: $#00
Warn : 2257 67528 gdb_server.c:345 gdb_write(): Error writing to GDB socket. Dropping the connection.

Looks like a gdb timeout issue for me. Can you check the gdb remotetimeout value set from the IDE or from the console you run? According to the timestamp in the log file, 5 seconds will be enough when all debugs are enabled.

From the GDB console, before connection to the remote target (OpenOCD) you can set it like;

set remotetimeout 5

In the IDE, it is under GDB client setup.

image

Other than this, I don't see an issue regarding reading flash mapping from the target.

@jsmith173
Copy link
Author

log2.txt
cnf2
cnf1

It looks like the problem similar to #334
Does this even work?

@erhankur
Copy link
Collaborator

From the previous log, I can see there is no issue with reading the flash.

STUB_D: cpu_freq:160 Mhz
STUB_D: DATA 0x3fca0000..0x3fca110a
STUB_D: BSS 0x3fca110c..0x3fca2221
STUB_D: cmd 5:FLASH_MAP_GET
STUB_D: stub_flash_handler arg1 ffffffff, arg2 1070212920
STUB_I: Flash state prepared...
STUB_D: stub_flash_get_size: ENTER
STUB_D: flash c28039, cs 2000000, bs 10000, ss 1000, ps 100, sm ffff
STUB_D: Flash ID read 3980c2
STUB_D: Flash ID 39, size 32768 KB
STUB_D: stub_flash_get_size: ENTER
STUB_D: flash c28039, cs 2000000, bs 10000, ss 1000, ps 100, sm ffff
STUB_D: Flash ID read 3980c2
STUB_D: Flash ID 39, size 32768 KB
STUB_D: stub_flash_get_map: 0xffffffff 0x3fca2738
STUB_D: start_page: 2 map_src: 0 map_size: 8020 page_cnt: 1 flash_page: 0 map_ptr: 3c028000
STUB_D: Found partition 0, m 0x50aa, t 0x1, st 0x2, l 'nvs'
STUB_D: start_page: 2 map_src: 0 map_size: 8040 page_cnt: 1 flash_page: 0 map_ptr: 3c028020
STUB_D: Found partition 1, m 0x50aa, t 0x1, st 0x1, l 'phy_init'
STUB_D: start_page: 2 map_src: 0 map_size: 8060 page_cnt: 1 flash_page: 0 map_ptr: 3c028040
STUB_D: Found partition 2, m 0x50aa, t 0x0, st 0x0, l 'factory'
STUB_I: Found app partition: 'factory' 1024 KB @ 0x10000
STUB_D: start_page: 2 map_src: 10000 map_size: 18 page_cnt: 1 flash_page: 1 map_ptr: 3c020000
STUB_I: Found app image: magic 0xe9, 5 segments, entry @ 0x403752dc
STUB_D: start_page: 2 map_src: 10000 map_size: 20 page_cnt: 1 flash_page: 1 map_ptr: 3c020018
STUB_I: App segment 0: 41736 bytes @ 0x3c020020
STUB_I: Mapped segment 0: 41736 bytes @ 0x10020 -> 0x3c020020
STUB_D: start_page: 2 map_src: 10000 map_size: a330 page_cnt: 1 flash_page: 1 map_ptr: 3c02a328
STUB_I: App segment 1: 10820 bytes @ 0x3fc92200
STUB_D: start_page: 2 map_src: 10000 map_size: cd7c page_cnt: 1 flash_page: 1 map_ptr: 3c02cd74
STUB_I: App segment 2: 12956 bytes @ 0x40374000
STUB_D: start_page: 2 map_src: 20000 map_size: 20 page_cnt: 1 flash_page: 2 map_ptr: 3c020018
STUB_I: App segment 3: 96092 bytes @ 0x42000020
STUB_I: Mapped segment 1: 96092 bytes @ 0x20020 -> 0x42000020
STUB_D: start_page: 2 map_src: 30000 map_size: 7784 page_cnt: 1 flash_page: 3 map_ptr: 3c02777c
STUB_I: App segment 4: 44832 bytes @ 0x4037729c
STUB_D: exit 0

Does log2.txt come from a different board? Or behavior changes when you enable the debugs. Do you try from the IDE or console? Please give me more details about your trials.

Can you also update your OpenOCD version with the latest release. v0.12.0-esp32-20241016

We have a fix in the v0.12.0-esp32-20240726 might be related to your issue.

contrib/loaders: Fixed esp32s3 flash init sequence. This led to flash probe failure for octal flash chips IDF app is built w/o PSRAM support.

@jsmith173
Copy link
Author

It works with the fix you provided.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants