Skip to content

Commit a22d671

Browse files
committed
app: fix payload size in bootstrap command
This was erroneously doubling the file size instead of rounding it up to the nearest multiple of the flash page size. Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
1 parent 9335ec3 commit a22d671

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/commands.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ struct LoadFile : public Commands<T> {
218218
std::println("File is empty");
219219
return 0;
220220
}
221-
auto size = file_size + (file_size - file_size % flash::PageSize);
221+
auto size = (file_size + flash::PageSize - 1) & ~(flash::PageSize - 1);
222222
std::vector<uint8_t> buffer(size, 0xff);
223223
if (!file.read(reinterpret_cast<char*>(buffer.data()), file_size)) {
224224
std::println("Error reading the file.");

0 commit comments

Comments
 (0)