No real a idea, just some thoughts: 1) ST-Link firmware is rather old 2) First failing access at 0x5c001004 is in DBGMCU module, this does't look to be QSPI related except: 3) Try debug session with "gdb_flash_program disable" right after power-on reset of target. 4) Increase FSIZE by one upon initialization of QSPI, i.e. double the apparent size of external flash in your firmware.
--- ** [tickets:#365] Cannot debug using openocd** **Status:** new **Milestone:** 0.11.0 **Created:** Wed Sep 28, 2022 11:54 AM UTC by HaoboGu **Last Updated:** Wed Sep 28, 2022 11:54 AM UTC **Owner:** nobody Hello, I'm using openocd to flash and debug my custom stm32h7b0vbt6 board. The flashing is good, but I cannot debug my board with st-link **after I added qspi** and re-generate my code using CubeMX, openocd reports: ~~~ [2022-09-28T11:45:23.982Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions. openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /Users/haobogu/Projects/others/stm32/h7b0 -f /Users/haobogu/.vscode/extensions/marus25.cortex-debug-1.6.5/support/openocd-helpers.tcl -f openocd.cfg Open On-Chip Debugger 0.11.0+dev-00873-g219cb9598 (2022-09-14-03:28) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html CDRTOSConfigure Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD none separate Info : Listening on port 50001 for tcl connections Info : Listening on port 50002 for telnet connections Info : clock speed 1800 kHz Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 2.827092 Info : [stm32h7b0xx.cpu0] Cortex-M7 r1p1 processor detected Info : [stm32h7b0xx.cpu0] target has 8 breakpoints, 4 watchpoints Info : starting gdb server for stm32h7b0xx.cpu0 on 50000 Info : Listening on port 50000 for gdb connections Info : accepting 'gdb' connection on tcp/50000 target halted due to debug-request, current mode: Thread xPSR: 0x21000000 pc: 0x08000bcc msp: 0x2001ffa0 Info : Device: STM32H7Ax/7Bx Info : flash size probed value 128k Info : STM32H7 flash has a single bank Info : Bank (0) size is 128 kb, base address is 0x08000000 Error: jtag status contains invalid mode value - communication failure Polling target stm32h7b0xx.cpu0 failed, trying to reexamine Examination failed, GDB will be halted. Polling again in 100ms Error: read_memory: read at 0x5c001004 with width=32 and count=1 failed Error executing event examine-end on target stm32h7b0xx.cpu0: /opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg:237: Error: read_memory: failed to read memory in procedure 'ocd_process_reset' in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 1193 in procedure 'stm32h7x_dbgmcu_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 170 in procedure 'stm32h7x_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 260 in procedure 'stm32h7x_mrw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 242 at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 237 Info : Previous state query failed, trying to reconnect Error: jtag status contains invalid mode value - communication failure Polling target stm32h7b0xx.cpu0 failed, trying to reexamine Examination failed, GDB will be halted. Polling again in 300ms Error: read_memory: read at 0x5c001004 with width=32 and count=1 failed Error executing event examine-end on target stm32h7b0xx.cpu0: /opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg:237: Error: read_memory: failed to read memory in procedure 'ocd_process_reset' in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 1193 in procedure 'stm32h7x_dbgmcu_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 170 in procedure 'stm32h7x_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 260 in procedure 'stm32h7x_mrw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 242 at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 237 Error executing event gdb-flash-erase-start on target stm32h7b0xx.cpu0: Error: error while reading from address 0x5200200c Error: error while writing to address 0x5200200c Error: error during the lock of flash Error: failed erasing sectors 0 to 2 Error: flash_erase returned -4 Info : Previous state query failed, trying to reconnect Error: jtag status contains invalid mode value - communication failure Polling target stm32h7b0xx.cpu0 failed, trying to reexamine Examination failed, GDB will be halted. Polling again in 700ms Error: read_memory: read at 0x5c001004 with width=32 and count=1 failed Error executing event examine-end on target stm32h7b0xx.cpu0: /opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg:237: Error: read_memory: failed to read memory in procedure 'ocd_process_reset' in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 1193 in procedure 'stm32h7x_dbgmcu_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 170 in procedure 'stm32h7x_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 260 in procedure 'stm32h7x_mrw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 242 at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 237 shutdown command invoked ~~~ And GDB reports: ~~~ in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 1193 GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"in procedure 'stm32h7x_dbgmcu_mmw' called at file \"/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg\", line 170\n"}]} in procedure 'stm32h7x_dbgmcu_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 170 GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"in procedure 'stm32h7x_mmw' called at file \"/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg\", line 260\n"}]} in procedure 'stm32h7x_mmw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 260 GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"in procedure 'stm32h7x_mrw' called at file \"/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg\", line 242\n"}]} in procedure 'stm32h7x_mrw' called at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 242 GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"at file \"/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg\", line 237\n"}]} at file "/opt/homebrew/Cellar/open-ocd/HEAD-219cb95/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 237 GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"Previous state query failed, trying to reconnect\n"}]} Previous state query failed, trying to reconnect GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"jtag status contains invalid mode value - communication failure\n"}]} jtag status contains invalid mode value - communication failure GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"Polling target stm32h7b0xx.cpu0 failed, trying to reexamine\n"}]} Polling target stm32h7b0xx.cpu0 failed, trying to reexamine GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"Examination failed, GDB will be halted. Polling again in 300ms\n"}]} Examination failed, GDB will be halted. Polling again in 300ms GDB -> App: {"output":"","outOfBandRecord":[{"isStream":true,"type":"target","content":"\n"}]} GDB -> App: {"output":"","token":10,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}} 11-target-download GDB -> App: {"output":"","token":11,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Error erasing flash with vFlashErase packet"]]}} 12-interpreter-exec console "monitor reset halt" Failed to launch GDB: Error erasing flash with vFlashErase packet (from target-download) ~~~ --- 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.