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.
So who is "they" ?
Why are you not asking them ?
Surely, if you want to be seeing the detail of how CPU instructions work, then a HLL is the wrong tool for the job - for exactly the reasons you're seeing!
If you want to work at the assembler level, then use Assembler!