From 52b20f4a2808dc6732fd9d185a9f0b3c1122b7e0 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 28 Apr 2022 17:26:09 +0100 Subject: [PATCH] Provide self-documenting API for disabling trailing-0xff removal --- src/arduino.c | 3 +-- src/libavrdude.h | 1 + src/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arduino.c b/src/arduino.c index 7f030a13..f7b60246 100644 --- a/src/arduino.c +++ b/src/arduino.c @@ -131,6 +131,5 @@ void arduino_initpgm(PROGRAMMER * pgm) pgm->open = arduino_open; pgm->close = arduino_close; - /* disable trailing-0xff removal when reading input files and avr flash */ - avr_mem_hiaddr(NULL); + disable_trailing_ff_removal(); /* so that arduino bootloader can ignore chip erase */ } diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..d8d5739a 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -787,6 +787,7 @@ int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles); int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); +#define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) int avr_mem_hiaddr(AVRMEM * mem); int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p); diff --git a/src/main.c b/src/main.c index c3bc0381..526ae35f 100644 --- a/src/main.c +++ b/src/main.c @@ -528,7 +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 */ + disable_trailing_ff_removal(); break; case 'e': /* perform a chip erase */