mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-27 22:45:27 +00:00
Piggy-back 'Do not remove trailing 0xff' onto option -D
This commit is contained in:
10
src/avr.c
10
src/avr.c
@@ -282,6 +282,16 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
int avr_mem_hiaddr(AVRMEM * mem)
|
||||
{
|
||||
int i, n;
|
||||
static int disableffopt;
|
||||
|
||||
/* calling once with NULL disables any future trailing-0xff optimisation */
|
||||
if(!mem) {
|
||||
disableffopt = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(disableffopt)
|
||||
return mem->size;
|
||||
|
||||
/* return the highest non-0xff address regardless of how much
|
||||
memory was read */
|
||||
|
@@ -1594,7 +1594,10 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
* if we are reading flash, just mark the size as being the
|
||||
* highest non-0xff byte
|
||||
*/
|
||||
rc = avr_mem_hiaddr(mem);
|
||||
int hiaddr = avr_mem_hiaddr(mem);
|
||||
|
||||
if(hiaddr < rc) /* if trailing-0xff not disabled */
|
||||
rc = hiaddr;
|
||||
}
|
||||
}
|
||||
if (format != FMT_IMM && !using_stdio) {
|
||||
|
@@ -528,6 +528,7 @@ int main(int argc, char * argv [])
|
||||
|
||||
case 'D': /* disable auto erase */
|
||||
uflags &= ~UF_AUTO_ERASE;
|
||||
avr_mem_hiaddr(NULL); /* disable trailing 0xff optimisation */
|
||||
break;
|
||||
|
||||
case 'e': /* perform a chip erase */
|
||||
|
Reference in New Issue
Block a user