Runs with debugger but not standalone, using ATSAMD10D13 and Atmel ICE
I haven't seen answers to my earlier questions yet, but as I'm about to go offline, I'll add my hypothesis (which might become more or less likely, depending on the answers to those questions), in case it helps.

I have seen symptoms similar to yours a few times, due to missing or insufficient power decoupling near the MCUs, or an unstable power supply. For either of those cases, the result is unstable power to the MCU(s) in a "normal" configuration (i.e. without a debugger attached). That could explain the "freezing".

JTAG debuggers will often contain a capacitor connected between the target power rail and ground pins. When the debugger is physically attached to the target system, even when the debugger is not actually in-use, it adds that "hidden" internal capacitor across the target system's power rail. Therefore in some cases, if the target is suffering from inadequate power decoupling, or needs extra capacitance due to an unstable power input, then "bingo!" the target system works - just by attaching the debugger :-)