Open
Conversation
7fcaad3 to
f8f860c
Compare
Author
|
My initial assumption that responses are up to 44 bytes long clearly was incorrect. However, I assume that response cannot be longer than the entire flash memory, so I bounded it by 5Mi now. |
0b4c554 to
e065772
Compare
Author
|
Using 8MiB as a static upper bound still causes the tool to hang -- apparently, reading 8MiB one-by-one takes a while. So I've added max response length guessing based of the
Apparently, this is enough to both pass the CI and solve the issue. Please let me know what you think. |
Member
SergioGasquez
left a comment
There was a problem hiding this comment.
Changes look good to me, but they introduce major breaking changes. There are two options:
- Restoring
read_response, marking it as deprecated and adding two new functions - Waiting for the espflash@v5 development to get this merged
b902a06 to
7a161c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've encountered an issue with the same symptoms as #989, except in my case
espflashwould sometimes start working again after re-plugging the cable.I reproduced the issue on the
mainbranch, and traced to core reason -- when sending theSynccommand,slip-codec's decoder appeared to be stuck reading bytes indefinitely here. Specifically -- byte0x0awould be read indefinitely, never terminating the loop.So I've added a byte count bounded variant of
Connection::read(Connection::read_bounded), and used it to read the response(right now, the code expects responses of at most.44bytes, so that was selected as an upper bound)I also removed the claim that response is read with the timeout -- I am sure I've spent more than 100ms waiting for the
Synccommand to complete. My guess is that reading0x0afrom the port overrides the timeout, and thus the command itself never times out. This change is questionable, let me know if I should revert it, or...?The tool works fine for me now -- ELF gets flashed every time.
As you could probably tell, I have little knowledge of what's actually going on. So I would appreciate extra attention to make sure this change doesn't actually break anything.