Skip to content

Commit feabaa5

Browse files
ziuziakowskaengdoreis
authored andcommitted
app: wait for flash not busy before writing misaligned segment start
Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
1 parent ed6037b commit feabaa5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

app/commands.hh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,6 @@ struct LoadFileElf : public Commands<T> {
380380
}
381381
}
382382

383-
this->flash.wait_not_busy();
384-
385383
// Then, load the segment data from the file.
386384
auto loaded = 0;
387385
auto load_progress = ProgressBar(load_size, 50, "Loading").with_throughput();
@@ -398,6 +396,8 @@ struct LoadFileElf : public Commands<T> {
398396
auto n = std::min(to_next, data.size());
399397
std::vector<uint8_t> page(data.first(n).begin(), data.first(n).end());
400398

399+
this->flash.wait_not_busy();
400+
401401
if (addr4b) {
402402
res = this->flash.template single_page_program_non_blocking<4>(addr, page);
403403
} else if (quad) {
@@ -410,8 +410,6 @@ struct LoadFileElf : public Commands<T> {
410410
return 0;
411411
}
412412

413-
this->flash.wait_not_busy();
414-
415413
addr += n;
416414
loaded += n;
417415
data = data.subspan(n);

0 commit comments

Comments
 (0)