avrdude pretents to be able to upload into EEPROM but it can't ?

Hi everybody,

I currently work on linux with arduino 1.6.4 and a UNO Rev 3 board

I tried to play with the .eep file that is generated by the arduino IDE but nearly always empty.
I wrote a program with :

int EEMEM addr = 0x1234;
int EEMEM j = 0x9876;

in the global variables part.

Then I clicked on "verify" which generated both the .elf end the .eep files.
The .eep file was ok :

:0400000076983412A8 # The values 0x1234 and 0x9876 in Intel hex parlance
:00000001FF

Since I know that the "upload" button will not upload the .eep file, I executed :

/usr/bin/avrdude -C/etc/avrdude/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Ueeprom:w:essai52.cpp.eep:i

I got all the usual messages from avrdude, ending with :
avrdude: verifying ...
avrdude: 4 bytes of eeprom verified

apparently, everything went smoothly, but alas, that was not the case. I dumped all the EEPROM and could see that avrdude uploaded nothing into the EEPROM.

When avrdude uploads, it speaks with optiboot. One of them is lying. Somebody knows the culprit ?

The UNO uses the optiboot bootloader which is not capable to upload into EEPROM since the priority was to keep the bootloader under 512B size. The only way is to use ISP and programmer (it can cause lost of the bootloader) or to write such option into the sketch.

bcassagne:
When avrdude uploads, it speaks with optiboot. One of them is lying. Somebody knows the culprit ?

optiboot. Definitely optiboot.
I'm surprised that it verified correctly!

johnwasser:
optiboot. Definitely optiboot.
I'm surprised that it verified correctly!

Me too!

static inline void writebuffer(int8_t memtype, uint8_t *mybuff,
			       uint16_t address, pagelen_t len)
{
    switch (memtype) {
    case 'E': // EEPROM
#if defined(SUPPORT_EEPROM) || defined(BIGBOOT)
        while(len--) {
	    eeprom_write_byte((uint8_t *)(address++), *mybuff++);
        }
#else
	/*
	 * On systems where EEPROM write is not supported, just busy-loop
	 * until the WDT expires, which will eventually cause an error on
	 * host system (which is what it should do.)
	 */
	while (1)
	    ; // Error: wait for WDT
#endif

From optiboot.c:

/* What you lose:                                         */
/*   Implements a skeleton STK500 protocol which is       */
/*     missing several features including EEPROM          */
/*     programming and non-page-aligned writes            */

BIGBOOT (1k bootloader) is turned on in the Makefile for the Sanguino, MEGA 2560, and MEGA 1280 builds. Those devices should allow EEPROM programming.

I am using this on my board with 1284P. There is 1k minimum boosize.