openocd Warn : address 0x... not writable

giofrdab
Posts: 2
Joined: Tue Jun 07, 2022 2:12 pm

openocd Warn : address 0x... not writable

Postby giofrdab » Tue Jun 07, 2022 3:04 pm

After some changes to my firmware on esp32, debugging over JTAG using openocd and FTDI chip has stopped working :?.

Below is the output of openocd:


openocd -f board/esp32-wrover-kit-1.8v.cfg
Open On-Chip Debugger v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : esp32.cpu0: Target halted, PC=0x40094A52, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x40081D8D, debug_reason=00000001
Info : accepting 'telnet' connection on tcp/4444
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Error: timed out while waiting for target halted / 4 - 2
Info : esp32.cpu0: Target halted, PC=0x40008547, debug_reason=00000000
Error: xtensa_wait_algorithm: not halted 0, pc 0x40008547, ps 0x60623
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
Error: Too many flash mappings 11682344! Must be 2.
Warn : Failed to get flash mappings (-4)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Failed to get flash size!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Failed to get flash size!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
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'.
Error: attempted 'gdb' connection rejected
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash maps (6)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 0 KB
Info : Using flash bank 'esp32.cpu0.flash' size 0 KB
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash maps (6)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Info : Using flash bank 'esp32.cpu0.irom' size 0 KB
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash maps (6)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Info : Using flash bank 'esp32.cpu0.drom' size 0 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : Prefer GDB command "target extended-remote 3333" instead of "target remote 3333"
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
===== Xtensa registers
(0) pc (/32): 0x40000400
(1) ar0 (/32): 0x00000000
....
(214) f64r_hi (/32): 0x00000000
(215) f64s (/32): 0x00000000

Warn : address 0x400d9d64 not writable
Error: esp32.cpu0: Failed to write breakpoint instruction (-4)!
Error: esp32.cpu0: Failed to add SW breakpoint!
Error: can't add breakpoint: unknown reason


openocd is unable to set breakpoint!

After some attempts I found that by adding the following loop of a few tens of seconds at the beginning of application it is still possible to debug again as long as the debugging session is started by the end of the loop.


Empiric solution:

Code: Select all

void app_main() {
  while(esp_log_timestamp() < (20*1000)) {
  	vTaskDelay(200);
  }
  ...

Has the firmware reached such a size that the flash mapping on the esp32 cache affects the debug session?

Is openocd wrong?
Or there are other gdb/openocd options useful to successfully start debug session in situation like that?

Thanks!

peturdainn
Posts: 1
Joined: Mon Jul 24, 2023 9:59 am

Re: openocd Warn : address 0x... not writable

Postby peturdainn » Mon Jul 24, 2023 10:02 am

I'm now encountering the same thing, did you find any solution to this?

Who is online

Users browsing this forum: No registered users and 164 guests