setting the initial state of the EEPROM

I am starting to mess with the EEPROM library to store the state of Firmata. I have run into a question that I can't seem to find the answer to. Basically, I need to find a way to set the initial state of the EEPROM so that I can set the initial state of Firmata. I imagine that by default the EEPROM has gibberish in it, like reading unallocated memory. Ideally, there would be some way to init the EEPROM to 0.

This thread says

I think if I read the bootloader correctly the EEPROM is erased when you upload a sketch

. That would work quite nicely if that was true. But it does not seem to be. According to my tests, the EEPROM remains untouched when burning a new firmware.

This thread means that there is code in the bootloader for reseting the EEPROM. Any chance of this getting activated?

Or are there other options for reseting the EEPROM? Maybe this would work best as a menu option in the Arduino IDE.

Perhaps you could use some sort of signature? Say, if the the EEPROM begins 0xdeadbeef or whatever you choose then you will believe that you have initialized it and it has your data in it. Otherwise, initialize it in your code. You probably want a version number in there too so you know when it is initialized with old format data after you inevitably change formats.

Yeah, that's a good hack for that. I thought of another: adding a function to the Firmata firmware that zeros the EEPROM and make it part of the SYSTEM_RESET functionality.

But now I can't seem to undo my EEPROM writes... hmm...

I am starting to mess with the EEPROM library to store the state of Firmata. I have run into a question that I can't seem to find the answer to. Basically, I need to find a way to set the initial state of the EEPROM so that I can set the initial state of Firmata. I imagine that by default the EEPROM has gibberish in it, like reading unallocated memory. Ideally, there would be some way to init the EEPROM to 0.

This thread says

I think if I read the bootloader correctly the EEPROM is erased when you upload a sketch

. That would work quite nicely if that was true. But it does not seem to be. According to my tests, the EEPROM remains untouched when burning a new firmware.

This thread means that there is code in the bootloader for reseting the EEPROM. Any chance of this getting activated?

Or are there other options for reseting the EEPROM? Maybe this would work best as a menu option in the Arduino IDE.

I am not so usre that erasing EEPROM with each sketch upload would be such a good idea.

(1) the whole write cycle thing, although flash is getting rewritten each time a sketch is loaded I am wondering about the write-cycle life of the EEPROM.

(2) on a more personal basis I want to use EEPROM in a simple program to read to store and EEPROM 1-Wire device IDs, then load a different sketch to make use of the 1-Wire devices.

cheers ... BBR