AVRDUDE: Write EEPROM bytes without file

Is it possible to write EEPROM bytes via AVRDUDE and an AVRISP mkII directly from the command line without needing an EEPROM file read from another chip? Kind of like how you can specify the fuse bytes directly at the command line.

I need to be able to change a single byte of the EEPROM but would rather not mess with a file.

Answer

The avrdude write command (-U) knows an ‘immediate’ mode (see the manual), which allows you to specify the bytes to be written directly.

The syntax is like

avrdude -U eeprom:w:0xff:m

But this mode doesn’t allow you to specify the address of the byte to be written, so I presume it will start writing at address zero. This works great for fuses (where instead of ‘eeprom’ you use ‘hfuse’, ‘lfuse’ or ‘efuse’), but not so much for real memory.

But you can always create a hex file (e.g. INTEL Hex records containing just the single byte with the address you need to change.

Attribution
Source : Link , Question Author : Adam Haile , Answer Author : hli

1 thought on “AVRDUDE: Write EEPROM bytes without file”

  1. Has the proposed solution been tested successfully? When I wrote an Intel Hex file to only write a small portion of EEPROM, AVRDUDE cleared all preceding bytes, and then successfully wrote what was specified. For example, I wrote a 4-byte file, starting at byte 3, and AVRDUDE erased and wrote 7 bytes starting at byte 0 (3 erased bytes, followed by the 4 bytes in the Intel Hex file). Functionally equivalent to writing a 7-byte hex file to EEPROM starting at byte 0. Exactly what I was trying to avoid. Maybe I missed something?

    Reply

Leave a Comment