I'm using avr studio v4.18 with winavr 20090313 and atmega8
I have a variable and the following code
uint32_t frequency; .... frequency= (uint32_t)((((uint64_t)TCNT1+((uint64_t)65536*(uint64_t)timer1_ovf)) * (uint64_t)2034635417)/1000000000);
i need to use the uint64_t to avoid overflow, i also use multiply with 2034635417 instead of 2,034635417 and i divide the result in the end with 1000000000 so it is able to fit in the uint32_t variable.
My code including the above statements compiles to 1660 bytes.
If i use
volatile uint32_t frequency;
then the size becomes 6393 bytes!!!
I want to avoid float operations so i prefer the uint64_t.
I'm using volatile just for debugging to be able to view the variable value inside proteus simulator.
I never has such a strange behavior before but i also have never used uint64_t.
Any idea what might be wrong with volatile?