Skip to content

Commit

Permalink
Pad all pages with zeroes (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobly0 authored and mattnite committed Feb 26, 2024
1 parent 140203c commit edc3ef9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions tools/uf2/src/uf2.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 = .{
Expand All @@ -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");
}
Expand Down

0 comments on commit edc3ef9

Please sign in to comment.