Maybe submit a strawman patch and see what discussion ensues in the review?
Maybe it's still an issue on the GDB side for targets that you're not using?
I notice that no bundled Tcl scripts enable the option which may or may not be 
relevant.
I can't find much detail about it, its provenance etc. other than this:

https://sourceforge.net/p/openocd/mailman/openocd-devel/thread/c09652430810240018m424edc20p7460d16f0b118885%40mail.gmail.com/#msg28333318

But I imagine that one of the veteran contributors might be able to provide 
more info about it, if it's still needed and why (I couldn't locate any 
obviously related bug in the GDB bugzilla).

While the addition of the command seems to date back to 2008 it was also 
mentioned more recently in 2018 in this thread maybe suggesting that it was 
still needed then?

https://sourceforge.net/p/openocd/mailman/openocd-devel/thread/CAGDihe%3DiomZxsnduqUUN1R3-T46AQBNzEXmP67EV4Dt3NuFq8g%40mail.gmail.com/#msg36280177

Is there any possibility that the occurrence of the failed reads indicate some 
problem with your target configuration?


---

**[tickets:#406] "Failed to read memory" leads to 0 value instead of error 
message in gdb**

**Status:** new
**Milestone:** 0.10.0
**Created:** Fri Jun 30, 2023 09:44 AM UTC by PlasmaHH
**Last Updated:** Mon Jul 03, 2023 06:30 AM UTC
**Owner:** nobody


I am using openocd from git commit eebcf3cff with this patch applied: 
https://github.com/STMicroelectronics/OpenOCD/commit/5bb46921e7ed1376595509c62ad1c48694045c3c

Intial log of openocd:

~~~
Open On-Chip Debugger 0.12.0+dev-00246-geebcf3cff-dirty (2023-06-26-14:41)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter speed' not 'adapter_khz'
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V4J2B1S0 (API v3) VID:PID 0483:3757
Info : Target voltage: 2.501978
Info : Unable to match requested speed 4000 kHz, using 3500 kHz
Info : Unable to match requested speed 4000 kHz, using 3500 kHz
Info : clock speed 3500 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x0be12477
Info : [stm32u5x.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32u5x.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32u5x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
CPU in Non-Secure state
[stm32u5x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x69000000 pc: 0x08005978 msp: 0x2000a4d8
Info : device idcode = 0x20016482 (STM32U57/U58xx - Rev X : 0x2001)
Info : TZEN = 0 : TrustZone disabled by option bytes
Info : RDP level 0 (0xAA)
Info : flash size = 2048 KiB
Info : flash mode : dual-bank
Info : device idcode = 0x20016482 (STM32U57/U58xx - Rev X : 0x2001)
Info : TZEN = 0 : TrustZone disabled by option bytes
Info : RDP level 0 (0xAA)
Info : flash size = 2048 KiB
Info : flash mode : dual-bank
Info : device idcode = 0x20016482 (STM32U57/U58xx - Rev X : 0x2001)
Info : TZEN = 0 : TrustZone disabled by option bytes
Info : RDP level 0 (0xAA)
Info : OTP size is 512 bytes, base address is 0x0bfa0000
Error: Failed to read memory at 0x00000000
~~~

Upon reading any address that is not available instead of getting an error 
within gdb, I get a value of 0. This is what openocd -d3 says to one of these 
accesses:

~~~
Debug: 2042 11419 gdb_server.c:375 gdb_log_incoming_packet(): [stm32u5x.cpu] 
received packet: m7055363,4
Debug: 2043 11419 gdb_server.c:1510 gdb_read_memory_packet(): addr: 
0x0000000007055363, len: 0x00000004
Debug: 2044 11419 target.c:2437 target_read_buffer(): reading buffer of 4 byte 
at 0x07055363
Debug: 2045 11419 stlink_usb.c:1120 stlink_usb_error_check(): 
STLINK_SWD_AP_WDATA_ERROR
Error: 2046 11420 arm_adi_v5.c:570 mem_ap_read(): Failed to read memory at 
0x07055363
Debug: 2047 11420 gdb_server.c:391 gdb_log_outgoing_packet(): [stm32u5x.cpu] 
sending packet: $00000000#80
~~~




---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to