There are four scenarios:
Run a debug session using the 'PE Debug' build
Run a board that has been flashed with a 'PE Debug' build, not in debugger
Run a debug session using the 'PE Release' build
Run a board that has been flashed with a 'PE Release' build, not in debugger
I know RTFM is the right answer here, but I would appreciate a brief explanation of what is occurring in each of these 4 scenarios, as each leads to different behaviors.
Also, to prove code correctness, I assume the code should work properly under a 'PE Release' non-debug session. As of now only a 'PE Debug' debug session works correctly.