I had a working STM32G0316-DISCO board, but after programming the STM31G031 I cannot connect to the MCU anymore using ST-LINK. This is because I set pin 7 and 8 to a digital input whereas pin 7 and 8 are SWDIO and SWCLK respectively as well. This messes up the communication. I tried to pull pin 8 high (which is the boot0 pin as well) when powering the board in order to force it in a different boot mode, but STM32CubeProgrammer still cannot connect to the board, reporting "Error: No STM32 target found!"
I also tried setting the program mode to "under reset" and the reset mode to "Software reset", but nothing seems to work. What I can do?