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
@@ -367,6 +386,8 @@ struct load_command : public cmd {
367
386
group get_cli() override {
368
387
return (
369
388
(
389
+
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" +
390
+
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" +
370
391
option('v', "--verify").set(settings.load.verify) % "Verify the data was written correctly" +
371
392
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,
1760
1786
mem_range.to);
1761
1787
}
1788
+
if (settings.load.no_overwrite && mem_range.intersects(flash_binary_range)) {
1789
+
if (flash_binary_end_unknown) {
1790
+
if (!settings.load.no_overwrite_force) {
1791
+
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");
1792
+
}
1793
+
} else {
1794
+
fail(ERROR_NOT_POSSIBLE, "-n option specified, and the loaded data range clashes with the existing flash binary range %08x->%08x",
1795
+
flash_binary_range.from, flash_binary_range.to);
1796
+
}
1797
+
}
1762
1798
}
1763
1799
for (auto mem_range : ranges) {
1764
1800
enum memory_type type = get_memory_type(mem_range.from);
0 commit comments