@cliffle Did you ever get to the root of the STM32 WFI bug?
I personally found myself performing the following step to alleviate it: (1) I made the idle thread run in privileged mode*, (2) masked interrupts before wfi, and (3) inserted various memory barrier instructions before and after (only before is required so far as I can tell)
*I first tried to execute masked WFI from a svc instruction / syscall - not realizing that was not possible