I would like an embedded device to wait before entering a certain state until I can set up the remote debugger via JTAG to continue execution.
I tried to use an infinite loop continuing execution by setting the program counter to the next instruction.
I'm using a constant expression so as the loop doesn't get optimized away as the SEI CERT C Coding Standard states in MSC06-C as compliant example:
while(1);
My problem is now that gcc optimizes away everything following this code in the same function and at first glance I found no gcc option to specifically prevent this.
Is this the right way to do what I want? And how is it done the right way?