fix(read_flash): flush transmit buffer less often to inrease throughput

Closes https://github.com/espressif/esptool/issues/936
This commit is contained in:
Peter Dragun
2024-01-03 13:55:31 +01:00
committed by Radim Karniš
parent 17866a56d2
commit 8ce5ed3c2b
6 changed files with 28 additions and 21 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -171,8 +171,15 @@ void stub_tx_one_char(char c)
#endif // WITH_USB_OTG
uart_tx_one_char(c);
#if WITH_USB_JTAG_SERIAL
static unsigned short transferred_without_flush = 0;
if (stub_uses_usb_jtag_serial()){
stub_tx_flush();
// Defer flushing until we have a (full - 1) packet or a end of packet (0xc0) byte to increase throughput.
// Note that deferring flushing until we have a full packet can cause hang-ups on some platforms.
++transferred_without_flush;
if (c == '\xc0' || transferred_without_flush >= 63) {
stub_tx_flush();
transferred_without_flush = 0;
}
}
#endif // WITH_USB_JTAG_SERIAL
}