I am getting a Error erasing flash with vFlashErase packet when trying to connect using JTAG to the device. It works fine using SWD.
Here is the BMDA log of the interaction:
> ./build/blackmagic -s 6DA48568 -v 5
Black Magic Debug App v2.0.0-515-gb79287d75
for Black Magic Probe, ST-Link v2 and v3, CMSIS-DAP, J-Link, FTDI (MPSSE) and WCH-Link
Using 1d50:6018 6DA48568 Black Magic Debug
Black Magic Probe v3 v2.0.0-515-gb79287d7
Setting V6ONLY to off for dual stack listening.
Listening on TCP port: 2000
Got connection
Speed set to 5.000MHz for JTAG
Resetting TAP
Change state to Shift-DR
Scanning out ID codes
Return to Run-Test/Idle
Change state to Shift-IR
Scanning out IRs
Return to Run-Test/Idle
Change state to Shift-DR
Return to Run-Test/Idle
ID code 0x4ba00477: ADIv5 JTAG-DP port.
ID code 0x06471041: STM32 BSD.
DPv0 detected based on JTAG IDCode
AP 0: IDR=24770011 CFG=00000000 BASE=e00ff000 CSW=e3000040 (AHB3-AP var1 rev2)
Halt via DHCSR(00030003): success after 4ms
ROM Table: BASE=0xe00ff000 SYSMEM=1, Manufacturer 020 Partno 470 (PIDR = 0x00000a0470)
0 0x0e000e000: Generic IP component - Cortex-M4 SCS (System Control Space) (PIDR = 0x04000bb00c DEVTYPE = 0x00 ARCHID = 0x0000)
-> cortexm_probe
CPUID 0x410fc241 (M4 var 0 rev 1)
cortexm_probe: Examining Part ID 0x0470, AP Part ID: 0x0470
Calling stm32f1_probe
Calling stm32f4_probe
Calling stm32h5_probe
Calling stm32h7_probe
Calling stm32mp15_cm4_probe
Calling stm32l0_probe
Calling stm32l1_probe
Calling stm32l4_probe
1 0x0e0001000: Generic IP component - Cortex-M3 DWT (Data Watchpoint and Trace) (PIDR = 0x04003bb002 DEVTYPE = 0x00 ARCHID = 0x0000)
2 0x0e0002000: Generic IP component - Cortex-M3 FBP (Flash Patch and Breakpoint) (PIDR = 0x04002bb003 DEVTYPE = 0x00 ARCHID = 0x0000)
3 0x0e0000000: Generic IP component - Cortex-M3 ITM (Instrumentation Trace Module) (PIDR = 0x04003bb001 DEVTYPE = 0x00 ARCHID = 0x0000)
4 0x0e0040000: Debug component - Cortex-M4 TPIU (Trace Port Interface Unit) (PIDR = 0x04000bb9a1 DEVTYPE = 0x11 ARCHID = 0x0000)
5 0x0e0041000: Debug component - Cortex-M4 ETM (Embedded Trace) (PIDR = 0x04000bb925 DEVTYPE = 0x13 ARCHID = 0x0000)
ROM Table: END
Resuming target
Attaching to target..
Halting target
Target halted: Halt requested
Attach success
Resetting target
Exception caught while detaching from target: Remote protocol exception
TARGET LOST.
I have bisected the issue and narrowed it down to 32c8fd6930 being the first commit that introduces the issue. The connection erase flash and section compare works fine before this commit.
I am getting a `Error erasing flash with vFlashErase packet` when trying to connect using JTAG to the device. It works fine using SWD.
Here is the BMDA log of the interaction:
```
> ./build/blackmagic -s 6DA48568 -v 5
Black Magic Debug App v2.0.0-515-gb79287d75
for Black Magic Probe, ST-Link v2 and v3, CMSIS-DAP, J-Link, FTDI (MPSSE) and WCH-Link
Using 1d50:6018 6DA48568 Black Magic Debug
Black Magic Probe v3 v2.0.0-515-gb79287d7
Setting V6ONLY to off for dual stack listening.
Listening on TCP port: 2000
Got connection
Speed set to 5.000MHz for JTAG
Resetting TAP
Change state to Shift-DR
Scanning out ID codes
Return to Run-Test/Idle
Change state to Shift-IR
Scanning out IRs
Return to Run-Test/Idle
Change state to Shift-DR
Return to Run-Test/Idle
ID code 0x4ba00477: ADIv5 JTAG-DP port.
ID code 0x06471041: STM32 BSD.
DPv0 detected based on JTAG IDCode
AP 0: IDR=24770011 CFG=00000000 BASE=e00ff000 CSW=e3000040 (AHB3-AP var1 rev2)
Halt via DHCSR(00030003): success after 4ms
ROM Table: BASE=0xe00ff000 SYSMEM=1, Manufacturer 020 Partno 470 (PIDR = 0x00000a0470)
0 0x0e000e000: Generic IP component - Cortex-M4 SCS (System Control Space) (PIDR = 0x04000bb00c DEVTYPE = 0x00 ARCHID = 0x0000)
-> cortexm_probe
CPUID 0x410fc241 (M4 var 0 rev 1)
cortexm_probe: Examining Part ID 0x0470, AP Part ID: 0x0470
Calling stm32f1_probe
Calling stm32f4_probe
Calling stm32h5_probe
Calling stm32h7_probe
Calling stm32mp15_cm4_probe
Calling stm32l0_probe
Calling stm32l1_probe
Calling stm32l4_probe
1 0x0e0001000: Generic IP component - Cortex-M3 DWT (Data Watchpoint and Trace) (PIDR = 0x04003bb002 DEVTYPE = 0x00 ARCHID = 0x0000)
2 0x0e0002000: Generic IP component - Cortex-M3 FBP (Flash Patch and Breakpoint) (PIDR = 0x04002bb003 DEVTYPE = 0x00 ARCHID = 0x0000)
3 0x0e0000000: Generic IP component - Cortex-M3 ITM (Instrumentation Trace Module) (PIDR = 0x04003bb001 DEVTYPE = 0x00 ARCHID = 0x0000)
4 0x0e0040000: Debug component - Cortex-M4 TPIU (Trace Port Interface Unit) (PIDR = 0x04000bb9a1 DEVTYPE = 0x11 ARCHID = 0x0000)
5 0x0e0041000: Debug component - Cortex-M4 ETM (Embedded Trace) (PIDR = 0x04000bb925 DEVTYPE = 0x13 ARCHID = 0x0000)
ROM Table: END
Resuming target
Attaching to target..
Halting target
Target halted: Halt requested
Attach success
Resetting target
Exception caught while detaching from target: Remote protocol exception
TARGET LOST.
```
I have bisected the issue and narrowed it down to 32c8fd693018f9b7d7b7651ecebe17a781612ce0 being the first commit that introduces the issue. The connection erase flash and section compare works fine before this commit.