AVR GCC : Global / Static Array not getting initialized properly
Found the solution. As suggested by members at avrfreaks.net here the problem was that by using the default makefile the .data part of code was not getting included in the final hex file. as a result the ram was getting initialized by default value (0xFF) since it could not find the array values (in the .data part). Using a custom makefile with the flag -j .data in avr-objcopy solved the problem.