From 0f76a43f53ea453ff1b14abb4f895ac3c147fa2b Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Sat, 24 May 2025 11:50:08 +0200 Subject: [PATCH] Refrain from autoerasing chip for autogenerated files without contents --- src/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 33315541..2c1a6b95 100644 --- a/src/main.c +++ b/src/main.c @@ -1816,9 +1816,11 @@ int main(int argc, char *argv[]) { if(flashread) { pmsg_info("NOT auto-erasing chip as flash might need reading before writing to it\n"); } else { - erase = 1; - pmsg_notice("auto-erasing chip as flash memory needs programming (-U %s:w:...)\n", upd->memstr); - imsg_notice("specify the -D option to disable this feature\n"); + if(!is_generated_fname(upd->filename) || generated_file_has_contents(p, upd->filename)) { + erase = 1; + pmsg_notice("auto-erasing chip as flash memory needs programming (-U %s:w:...)\n", upd->memstr); + imsg_notice("specify the -D option to disable this feature\n"); + } } break; }