It is hard to say what could be reason for such behavior.
Idea1: Some pending interrupt could blocks MCU when it wake-ups. Please try disable all interrupts prior you call __boot function. e.g. by CPSID instruction (asm (CPSID f);).
Idea2: Problem could be in some transitions between clock modes. You can try set clock to default values after reset or switch to some non-conflict clock mode.
Theoretically you can try set some software breakpoint at enter from sleep mode, attach debugger and try debugging root cause of system hangs.
The MCU freeze in 100% cases or behavior is random?
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------