From 1415c58d6cdca48e196a6b10df7ad74662363775 Mon Sep 17 00:00:00 2001 From: Alice Ziuziakowska Date: Mon, 1 Jun 2026 14:53:12 +0100 Subject: [PATCH] app: wait for flash not busy before writing misaligned segment start Signed-off-by: Alice Ziuziakowska --- app/commands.hh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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);