I have a legacy application that is known to work on our custom hardware. When I tried to run this same application on a STM Discovery board with the same MCU, it ended up bricking the ST-Link part of the Disco. The results were not consistent: once it did not brick it, once STMCubeProgrammer was able to unbrick the board with a ST-Link FW upgrade, and the last time I tried, CubeProgrammer didn't recognize the board anymore.
The application in question just reads data from I2C, and when it has read one flash pageful of it, it writes that data to flash. I am (for some reason, gut feeling?) assuming the write-to-flash is the culprit here.
I am completely baffled about what is happening. How can the application MCU brick the ST-Link? Especially the last time, when the ST-Link had the latest firmware. Any thoughts on what might be happening here would be greatly appreciated.