diff --git a/src/avr.c b/src/avr.c index 3605e518..52022d16 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1599,6 +1599,12 @@ Memtable avr_mem_order[100] = { {"sib", MEM_SIB | MEM_READONLY}, }; +// Whether a memory is an exception that shouldn't be there for this particular i/face +int avr_mem_exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) { + return // Classic part usersig memories cannot be read/written using ISP + mem_is_usersig(mem) && (p->prog_modes&PM_Classic) && (pgm->prog_modes&p->prog_modes&PM_ISP); +} + int avr_get_mem_type(const char *str) { for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) { if(avr_mem_order[i].str && str_eq(avr_mem_order[i].str, str)) diff --git a/src/libavrdude.h b/src/libavrdude.h index 31c5a8e0..ba755f44 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -1144,6 +1144,8 @@ int avr_get_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int *cycles); int avr_put_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int cycles); +int avr_mem_exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem); + int avr_get_mem_type(const char *str); int avr_mem_is_flash_type(const AVRMEM *mem); diff --git a/src/update.c b/src/update.c index ab691520..66929a7f 100644 --- a/src/update.c +++ b/src/update.c @@ -269,15 +269,9 @@ static void ioerror(const char *iotype, const UPDATE *upd) { msg_ext_error("\n"); } -// Whether a memory is an exception that shouldn't be included -static int exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) { - return // Classic part usersig memories cannot be read/written using ISP - mem_is_usersig(mem) && (p->prog_modes&PM_Classic) && (pgm->prog_modes&p->prog_modes&PM_ISP); -} - // Whether a memory should be returned for ALL: exclude IO/SRAM static int is_interesting_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) { - return !mem_is_io(mem) && !mem_is_sram(mem) && !(pgm && exclude(pgm, p, mem)); + return !mem_is_io(mem) && !mem_is_sram(mem) && !(pgm && avr_mem_exclude(pgm, p, mem)); } // Whether a memory should be backup-ed: exclude sub-memories