Pad all pages with zeroes (#18)

This commit is contained in:
Jacob Young 2023-11-26 19:09:43 -05:00 committed by GitHub
parent 0550d4b151
commit 8037b439cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ pub const Archive = struct {
.extension_tags_present = false,
},
.target_addr = std.mem.alignBackward(u32, addr, prog_page_size),
.payload_size = 0,
.payload_size = prog_page_size,
.block_number = undefined,
.total_blocks = undefined,
.file_size_or_family_id = .{
@ -110,13 +110,9 @@ pub const Archive = struct {
try file.reader().readNoEof(block.data[block_offset..][0..n_bytes]);
segment_offset += n_bytes;
block.payload_size = block_offset + n_bytes;
}
}
// pad last page with zeros
if (!first) self.blocks.items[self.blocks.items.len - 1].payload_size = prog_page_size;
if (opts.bundle_source)
@panic("TODO: bundle source in UF2 file");
}