Skip to content

Commit

Permalink
Simplify first block check
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Feb 27, 2024
1 parent 7c75c60 commit b511ae7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions teensy_loader_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ int main(int argc, char **argv)
printf_verbose("Programming");
fflush(stdout);
for (addr = 0; addr < code_size; addr += block_size) {
if (block_count == 0 && !ihex_bytes_within_range(addr, addr + block_size - 1)) {
if (block_count > 0) {
// don't waste time on blocks that are unused,
// but always do the first one to erase the chip
continue;
if (!ihex_bytes_within_range(addr, addr + block_size - 1)) continue;
if (memory_is_blank(addr, block_size)) continue;
}
if (block_count > 0 && memory_is_blank(addr, block_size)) continue;
printf_verbose(".");
if (block_size <= 256 && code_size < 0x10000) {
buf[0] = addr & 255;
Expand Down

0 comments on commit b511ae7

Please sign in to comment.