Skip to content

Commit

Permalink
backport #7491
Browse files Browse the repository at this point in the history
  • Loading branch information
d-a-v committed Aug 2, 2020
1 parent 1cdec7b commit 2843a5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,16 @@ static SpiFlashOpResult spi_flash_write_puya(uint32_t offset, uint32_t *data, si
} else {
bytesLeft = 0;
}
rc = spi_flash_read(pos, flash_write_puya_buf, bytesNow);
size_t bytesAligned = (bytesNow + 3) & ~3;
rc = spi_flash_read(pos, flash_write_puya_buf, bytesAligned);
if (rc != SPI_FLASH_RESULT_OK) {
return rc;
}
for (size_t i = 0; i < bytesNow / 4; ++i) {
for (size_t i = 0; i < bytesAligned / 4; ++i) {
flash_write_puya_buf[i] &= *ptr;
++ptr;
}
rc = spi_flash_write(pos, flash_write_puya_buf, bytesNow);
rc = spi_flash_write(pos, flash_write_puya_buf, bytesAligned);
pos += bytesNow;
}
return rc;
Expand Down

0 comments on commit 2843a5a

Please sign in to comment.