We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
Turn Off All Optimizations and it wont optimize away your stuff...
Optimization is a selection box in the C/C++ tab of the project options
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!