diff --git a/app/commands.hh b/app/commands.hh index 75d77b3..7ca67b2 100644 --- a/app/commands.hh +++ b/app/commands.hh @@ -380,8 +380,6 @@ struct LoadFileElf : public Commands { } } - this->flash.wait_not_busy(); - // Then, load the segment data from the file. auto loaded = 0; auto load_progress = ProgressBar(load_size, 50, "Loading").with_throughput(); @@ -398,6 +396,8 @@ struct LoadFileElf : public Commands { auto n = std::min(to_next, data.size()); std::vector page(data.first(n).begin(), data.first(n).end()); + this->flash.wait_not_busy(); + if (addr4b) { res = this->flash.template single_page_program_non_blocking<4>(addr, page); } else if (quad) { @@ -410,8 +410,6 @@ struct LoadFileElf : public Commands { return 0; } - this->flash.wait_not_busy(); - addr += n; loaded += n; data = data.subspan(n);