Piggy-back 'Do not remove trailing 0xff' onto option -D
This commit is contained in:
parent
60960ba590
commit
ed38456f83
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 avr_mem_hiaddr(AVRMEM * mem)
|
||||||
{
|
{
|
||||||
int i, n;
|
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
|
/* return the highest non-0xff address regardless of how much
|
||||||
memory was read */
|
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
|
* if we are reading flash, just mark the size as being the
|
||||||
* highest non-0xff byte
|
* 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) {
|
if (format != FMT_IMM && !using_stdio) {
|
||||||
|
|
|
@ -528,6 +528,7 @@ int main(int argc, char * argv [])
|
||||||
|
|
||||||
case 'D': /* disable auto erase */
|
case 'D': /* disable auto erase */
|
||||||
uflags &= ~UF_AUTO_ERASE;
|
uflags &= ~UF_AUTO_ERASE;
|
||||||
|
avr_mem_hiaddr(NULL); /* disable trailing 0xff optimisation */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e': /* perform a chip erase */
|
case 'e': /* perform a chip erase */
|
||||||
|
|
Loading…
Reference in New Issue