Reputation: 11
I am currently optimising and streamlining development code in preparation for release. Hardware and compiler specifics as follows:
PIC18F46J11, MPLABX, XC8 - V2.45, C99, Optimization level 1
See below (heavily truncated(I.P)) code of area of interest.
DEV CODE:
unsigned long Adc18;
unsigned long ReadAdc;
unsigned long AvgAdc;
ReadAdc=Adc18;
AvgAdc = AvgAdc + ReadAdc;
Estimated memory usage: 2988 bytes DATA (RAM), 57753 bytes PROGRAM (ROM)
STREAMLINED CODE:
unsigned long Adc18;
unsigned long AvgAdc;
AvgAdc = AvgAdc + Adc18;
Estimated memory usage: 3022 bytes DATA (RAM), 57651 bytes PROGRAM (ROM)
Question: What could cause the DATA usage increase in a scenario such as this? I expected PROGRAM memory to decrease as we have both removed a variable of type long and associated code.
This is my first question on this platform so please forgive any errors in formatting.
Thanks in advance!
Upvotes: 1
Views: 48