I used a Atmel-ICE as CMSIS DSP SWD programmer, this is the content of my openocd_atmelice_stm32.cfg:

$ cat openocd_atmelice_stm32.cfg
# Atmel-ICE JTAG/SWD in-circuit debugger.
adapter driver cmsis-dap
cmsis_dap_vid_pid 0x03eb 0x2141
cmsis_dap_serial J418000XXXXX

# Don't use srst, it will not work
reset_config  srst_nogate
 
adapter srst delay 100
adapter srst pulse_width 100

Then I ran OpenOCD this way:

$ sudo openocd -f openocd_atmelice_stm32.cfg -f target/stm32h7x.cfg
Open On-Chip Debugger 0.11.0+dev-00062-g6405d35f3 (2023-08-28-15:47)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter srst pulse_width: 100

Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 01.27.0082
Info : CMSIS-DAP: Serial# = J418000XXXXX
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x6ba02477
Info : stm32h7x.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections

From another terminal:

$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Open On-Chip Debugger
> stm32h7x unlock 0
Device: STM32H7Ax/7Bx
flash size probed value 2048
STM32H7 flash has dual banks
Bank (0) size is 1024 kb, base address is 0x08000000
Target not halted
stm32h7x failed to unlock device
> reset halt
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000f4c msp: 0x24100000
> stm32h7x unlock 0
the requested RDP value is already programmed
stm32h7x unlocked

> stm32h7x mass_erase 0
stm32h7x mass erase complete

>