FYI, if you want to connect an external (ST-LINK) debugger: most of the STM NUCLEO boards have ST-LINK onboard. You can "hijack":
Some boards, e.g. I use NUCLEO-H743ZI, provide a 6-pin SWD header. Open two jumpers on NUCLEO board and have a cable from this NUCLEO to Portenta H7 JTAG.
Is provides an ST-LINK V2 debugger via USB on NUCLEO (Portenta H7 needs still USB-C for power).
Here the schematics for it:
It is just a bit tricky to solder a cable on this small-pitch female connector for Portenta H7. And bear in mind:
-
the 3V3 signal is not for power: it is used by the debugger to sense the target voltage
-
wire also the RESET signal: debugger will use it in order to release the target
-
The SWO signal is optional (not needed to flash, debug): it is used as SWD Viewer (SWV), with sending print messages via ITM (like a read-only serial connection to host, I use to monitor debug messages on a running system)

