I was asked recently what the total RAM and Flash usage of one of my applications was. I figured an easy way to do this was to rebuild the project and look at what avr-size dumps out. I never caught on before but it seems that .data is used to calculate both the "Program" and the "Data" sizes. Further it appears that Program=Flash and Data=RAM. How can .data reside in both places at once? I see from some online WinAVR documentation that .data contains static variables and that one can change the location of the .data section. However it still seems it needs to reside completely in ROM or in RAM.
Am I just misunderstanding something here? Is the best strategy to look directly at the output of
avr-size -A -x Filename.elf
and calculate memory usage myself based on what address each section resides in?
Thanks in advance.