igrr / esptool-ck

ESP8266 build/flash helper tool by Christian Klippel
GNU General Public License v2.0
364 stars 123 forks source link

pad all flash writes to BLOCKSIZE_FLASH #11

Closed rhaenel closed 9 years ago

rhaenel commented 9 years ago

It seems that esptool-ck fails to write tiny files to flash. If I write a file with less than 680 bytes, all looks well on the protocol side but nothing actually gets stored in the flash. So with 679 bytes it fails, with 680 bytes it works OK.

Other tools seem to work around this bug (probably a bug in the ESP8266 ROM) by padding the data to BLOCKSIZE_FLASH.

I have created this commit to enable padding (with 0xff) the last block of every file to BLOCKSIZE_FLASH. This effectively solves the issue of writing small files to the flash. It does not have negative side effects since the flash gets erased in quantities larger than BLOCKSIZE_FLASH anyways.

igrr commented 9 years ago

Somehow I have missed this pull request notification, sorry. Merging now, thanks.