Commit 0b573f3
committed
tinyprog: limit trailing padding to aligned writes
To avoid wrap around when writing beyond the 256 octet sector, if the
write starts part way into the 256 octet sector, only do the padding
to a full 256 octet sector if we are writing from the begining of the
sector (and thus writing a full 256 octets will not wrap around).
We also write 0xff for safety, as in most SPI flash that is the erased
value, and effectively one can only write 0 bits, so writing twice to
a cell (without erasing) writes (existing value AND new value), which
for a new value of 0xff should be the existing value.1 parent 959ab55 commit 0b573f3
1 file changed
+13
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
520 | 518 | | |
521 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
522 | 529 | | |
523 | 530 | | |
524 | 531 | | |
| |||
0 commit comments