Refrain from autoerasing chip for autogenerated files without contents

This commit is contained in:
stefanrueger
2025-05-24 11:50:08 +02:00
parent 325a3435fb
commit 0f76a43f53

View File

@@ -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;
}