From 4d6574dc511983a5f48ccbb357b61962bd6e0a6c Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Fri, 13 Sep 2013 19:37:54 +0000 Subject: [PATCH] (part of patch #8176: butterfly.c (AVR109 protocol implementation) clean-up and bug-fixing) * butterfly.c (butterfly_page_erase): Add dummy function to avoid segfault when writing to EEPROM. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@1227 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 6 ++++++ avrdude/butterfly.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 5a04a6b5..1bdf5da0 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,9 @@ +2013-09-13 Joerg Wunsch + + patch #8176: butterfly.c (AVR109 protocol implementation) clean-up and bug-fixing + * butterfly.c (butterfly_page_erase): Add dummy function to avoid + segfault when writing to EEPROM. + 2013-09-13 Joerg Wunsch bug #35474 Feature request: print fuse values in safemode output diff --git a/avrdude/butterfly.c b/avrdude/butterfly.c index db4098a5..ac4c558b 100644 --- a/avrdude/butterfly.c +++ b/avrdude/butterfly.c @@ -544,6 +544,17 @@ static int butterfly_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return 0; } +static int butterfly_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int addr) +{ + if (strcmp(m->desc, "flash") == 0) + return -1; /* not supported */ + if (strcmp(m->desc, "eeprom") == 0) + return 0; /* nothing to do */ + fprintf(stderr, + "%s: butterfly_page_erase() called on memory type \"%s\"\n", + progname, m->desc); + return -1; +} static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char * value) @@ -729,6 +740,7 @@ void butterfly_initpgm(PROGRAMMER * pgm) * optional functions */ + pgm->page_erase = butterfly_page_erase; pgm->paged_write = butterfly_paged_write; pgm->paged_load = butterfly_paged_load;