I've been having a very weird problem and I thought to ask if anyone else suffered this by any chance. I have a board with reset line with pull-up and a switch to tie the line to ground (with a capacitor in parallel) as per typical STM32 circuit. This line also is exposed to the SWD connector. When I build without size optimizations, the board works as expected: it comes up normally and can be reset with the button. SWD also is able to reset it for debugging. When I disable optimizations, the board does not boot again even when pressing the reset button. It only boots normally if I start debugging with OCD, which issues the reset from there. Since with the debugger it boots normally this is impossible to debug. Any similar experience?
Best, Matias