You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -363,6 +382,8 @@ struct load_command : public cmd {
363
382
group get_cli() override {
364
383
return (
365
384
(
385
+
option('n', "--no-overwrite").set(settings.load.no_overwrite) % "When writing flash data, do not overwrite an existing program in flash. If picotool cannot determine the size/presence of the program in flash, the command fails" +
386
+
option('N', "--no-overwrite-unsafe").set(settings.load.no_overwrite_force) % "When writing flash data, do not overwrite an existing program in flash. If picotool cannot determine the size/presence of the program in flash, the load continues anyway" +
366
387
option('v', "--verify").set(settings.load.verify) % "Verify the data was written correctly" +
367
388
option('x', "--execute").set(settings.load.execute) % "Attempt to execute the downloaded file as a program after the load"
fail(ERROR_FORMAT, "File to load contained an invalid memory range 0x%08x-0x%08x", mem_range.from,
1728
1754
mem_range.to);
1729
1755
}
1756
+
if (settings.load.no_overwrite && mem_range.intersects(flash_binary_range)) {
1757
+
if (flash_binary_end_unknown) {
1758
+
if (!settings.load.no_overwrite_force) {
1759
+
fail(ERROR_NOT_POSSIBLE, "-n option specified, but the size/presence of an existing flash binary could not be detected; aborting. Consider using the -N option");
1760
+
}
1761
+
} else {
1762
+
fail(ERROR_NOT_POSSIBLE, "-n option specified, and the loaded data range clashes with the existing flash binary range %08x->%08x",
1763
+
flash_binary_range.from, flash_binary_range.to);
1764
+
}
1765
+
}
1730
1766
}
1731
1767
for (auto mem_range : ranges) {
1732
1768
enum memory_type type = get_memory_type(mem_range.from);
0 commit comments