Skip to content

espflasher: add retry logic for flash block writes and fix compressed timeouts - #56

Merged
deadprogram merged 1 commit into
mainfrom
esp32-timeout-fixes
Jul 18, 2026
Merged

espflasher: add retry logic for flash block writes and fix compressed timeouts#56
deadprogram merged 1 commit into
mainfrom
esp32-timeout-fixes

Conversation

@deadprogram

Copy link
Copy Markdown
Member

Add per-block retry (3 attempts) for both compressed and uncompressed flash writes, matching esptool.py's WRITE_BLOCK_ATTEMPTS behavior. Transient SLIP timeouts and framing errors are common during flashing and typically resolve on retry. The stub handles duplicate sequence numbers gracefully, so resending an already-processed block is safe.

Fix the per-block timeout for compressed flash writes: the timeout was computed from the compressed block size, but the stub must decompress and write much more data before ACKing. Scale the timeout by the compression ratio so it reflects the actual flash write time.

Fix retry desync: wait before flushing (not after) so a delayed response from the timed-out attempt arrives and gets cleared by the flush, preventing stale SLIP frames from corrupting the retry's response parsing.

… timeouts

Add per-block retry (3 attempts) for both compressed and uncompressed
flash writes, matching esptool.py's WRITE_BLOCK_ATTEMPTS behavior.
Transient SLIP timeouts and framing errors are common during flashing
and typically resolve on retry. The stub handles duplicate sequence
numbers gracefully, so resending an already-processed block is safe.

Fix the per-block timeout for compressed flash writes: the timeout was
computed from the compressed block size, but the stub must decompress
and write much more data before ACKing. Scale the timeout by the
compression ratio so it reflects the actual flash write time.

Fix retry desync: wait before flushing (not after) so a delayed
response from the timed-out attempt arrives and gets cleared by the
flush, preventing stale SLIP frames from corrupting the retry's
response parsing.

Signed-off-by: deadprogram <ron@hybridgroup.com>
@deadprogram
deadprogram merged commit 345786f into main Jul 18, 2026
3 checks passed
@deadprogram
deadprogram deleted the esp32-timeout-fixes branch July 18, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant