In my code I haven't initialized even a single var initially. All my vars are defined line:
datatype_t my_var; uint8_t x; uint32_t z;
AlSo all var should take space in ZI data. I also read that due to some optimization keil put some vars in r/w data. But my r/w data goes as high as 648 bytes.
Is this only due to optimization.
But even at zero level optimization this goes at 660 bytes.
There are so many facts regarding your program that you have not given, so it is impossible to decide whether 648 bytes is reasonable or not.
First up must be what library functions is your program using? Many of these might have initialised data and might therefore consume space in the R/W data section.
If slightly curious about the consumption of R/W memory, wouldn't a look in the map file be a good idea?