This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Turn off all optimizations?

I was following a tutorial that was showing how the ARM processor worked
and it used a main like this:

int main()
{ int counter = 0;
++counter;
++counter;
++counter;
++counter;
return 0;
}

The example was to show some register usage by the arm.
Everything I tried optimzed away the steps.
Their keil example had an instruction for each increment.
the closest I got was putting volatile on the int, and
that produce a move of 4 to the stack.

Can it be done in MDK5?

Thanks.