Repair EEMEM directive with Arduino IDE

Arduino development platform overtake lot of usefull features from atmels avr. But initialization of eeprom memory was not succesfuly done yet.
For original avr we have directive EEMEM, that to allows define, that this variable is allocated in eeprom memory. Once we will define variable
with this directive, the allocation will be done in eeprom, then we can not use the value by simple assignment, but we have to use eeprom library
functions for read and write. Once we will define initial value for variable with this directive, then this initial value is used for creation of
*.eep file ready for upload to eeprom memory.

The problem is, that actual version of Arduino IDE 1.6.9 does not upload this file to processor itself, although all components are ready
for this upload.

Because it is very useful for model railroading components to have pre initialized values in eeprom, then I decided to look what is necessary to done
for this upload will happen. I was surprised, how small work it mean.
Let us define example program we will work with:

Take a look into line 3, where we have definition of variable "ee_i". It mean definition of integer size place in eeprom memory that will contain value "123".
Program read this value on line 15 and store it into regular variable "ram_i" used in future code as usual.
The code on line 3 mean, that compiler will write into file .eep definition for first two/four bytes (unsigned int)
to value 123. But default Arduino IDE will never use this file.
It is little inconvenient for me, then I decided to make little upgrade. In the case, that compiler will create the .eep file, then IDE will send for upload.

First of all we must add parameter for avrdude code to upload eep file itself. This parameter is -Ueeprom:w:file.eep:i.
This parameter has to be defined in file platform.txt located
in directory %Arduino%\hardware\arduino\avr\platform.txt (C:\Program Files (x86)\Arduino on windows).
Then we can add parameter for upload eeprom as a next variable parameter and we have to add this parameter also at the end of uploading pattern.
Diff list for those changes follows. Affected lines are 101, 102, 108 and 109.

I was published same diff on GitHub.
Once you are not comfortable with interpreting of this type of diff file, you can download all file HERE,
or full plain text version HERE.

Next step, we have to done, is change code for IDE itself to use this configuration. IDE using SerialUploader.java for this action.
This file has to be changed to look, if eep file is created, is not directory and file size is greater than 13 bytes.
Because file size 13 bytes mean correct Intel HEX file without any information (empty file).
This check has to be on place, where parameters for avrdude are assembled. It mean lines 109, 204 and 335. Details can be found in following diff:

Zvláštní poděkování

Same as in previous cases I was published this diff on GitHub.
Once you are not comfortable with applying this diff file, you can download full file HERE,
or full plain text file HERE.

Well, it is little problem, because change of file is not enough. File has to be compiled and incorporated into arduino-core.jar.
It can be done for example by installation of Eclipse development environment and make requested build. Because I'm not enought familiar with
this activity, then I was ask Eva Q. for helping me during compilation. She compiled the file into arduino-core.class,
and then I was incorporated it into arduino-core.jar using manager for zip files
(at the end of page in download section).

Because it is not easy to say, when default production IDE will allow this functionality, I decided to public this page with instructions how to change your own
Arduino IDE.

Note again, that change is done and designed for Arduino 1.6.9. It was not tested with any other version.

Download and install Arduino IDE 1.6.9 as usual (once you already have it, you can skip this step)

In existing IDE first of all change or modify platform.txt (on Windows C:\Program Files (x86)\Arduino\hardware\arduino\avr\platform.txt)