How to write to EEPROM without overwriting important data?

Using EEPROMWrite seems fairly simple, but wouldn't i overwrite important data like my program code or the firmware if I just write into some random address?

For example

EEPROM.write(0, 123);

would write the value 123 to address 0x0. But you would think that something very important like the bootloader is stored at that location.

So how do I safely choose addresses for EEPROM.write?

EEPROM != program memory

What does that mean? Are you saying the EEPROM is not used at all by either the firmware or my program code and thus I wouldn't overwrite anything of importance?

That's what I'm saying.
At least for the AVRs.
I'm not sure I know of a core Arduino library that uses EEPROM

Thank you. :slight_smile:

For all AVR based Arduinos you can write the whole EEPROM safely (sizes differ depending on the model, of course).

ESP32 and ESP8266 have a different way to deal with it, you have to allocate a certain size (multiple of 4) but you can use that whole area too.

I have never used any of the 32bits arduinos. Perhaps someone could add some knowledge here.