-
Notifications
You must be signed in to change notification settings - Fork 39
ev3: Fix issues with flashing (some?) EV3s. #2352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
EDIT: I'll collect some notes in the issue thread instead. |
9cd1a76 to
e9e075f
Compare
|
It seems like this is fixing at least 3 different things. So would be better to split it up into 3 commits.
|
e9e075f to
c4e66ee
Compare
92dc7f6 to
1528acf
Compare
dlech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split out the checksum stuff to #2353 since it is obviously correct.
I would still like to do some hardware testing with this before merging it.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2352 +/- ##
==========================================
- Coverage 72.61% 67.11% -5.51%
==========================================
Files 201 211 +10
Lines 5163 5829 +666
Branches 1094 1278 +184
==========================================
+ Hits 3749 3912 +163
- Misses 1377 1872 +495
- Partials 37 45 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I tried running this (restoring Home firmware) and I am getting a timeout error. We need to adjust the timeout for the erase command to be proportional to the size that we are erasing. Also, the erase dialog does not close when it fails with an error. That needs to be fixed. Also, also, most of the erasing time depends on the flash memory itself, so we should be able to make the progress bar for erasing actually progress based on time. |
c89bc02 to
f50ca3b
Compare
I have a fix for this, but the firmware upload will still show as failing because the official firmware is not aligned to the sector boundary and the bootloader returns us a write error if our last write is both
Note that the firmware is in fact flashed successfully despite the error.
Do we suspect that this is my fault? I don't see what in my code would have changed this state. If you have any hints as to how to accomplish this -- I am not a react knower. (The real divergence from the "back to official" flow vs. the usual flow is that in the usual flow, the dialog is closed immediately when firmware flashing starts, whereas in the back to official flow, clicking "restore" does not close the dialogue.)
We could, although I have only tried erasing on my own machine, so I don't know exactly how fast it might go on other machines. Do you want me to assume it's the same speed on my machine as on any other, and just show progress under that assumed speed? |
f50ca3b to
61a623d
Compare
It sounds like we don't need to bother with making things align to the boundary then.
No idea. 😄 I didn't look into it deeply yet.
My point is that timing doesn't doesn't depend much on the machine, it depends mostly on the flash memory on the EV3, which is going to be the same on all EV3s. |
|
Except it's not the same on all EV3s. For the first generation, the timed indicator in pybricksdev is stuck on 100% for some time before getting ready to flash, even for the 1MB erase size, so it may be quite a lot more for the whole size. |
|
Are you saying that the progress bar is correct for later EV3 hardware? I would calibrate the progress bar for the slowest hardware. I don't see it as a problem if faster hardware finishes before it gets to 100%. |
Yeah, we should measure the slowest case and estimate a the time per sector. If we use the full erase command for the restore option we can measure that as well in case it is any different.
What size are you getting? |
I didn't check the firmware on disk. I'm just looking at what ranges are being flashed in the console logs during the actual firmware flash process. If you flash the 09e firmware using this PR's HEAD commit, and look at the debug logs, the last range to get flashed does not end on a sector boundary. Haven't investigated why.
To be clear, I know that the system starts up. But I do not know that everything works correctly. It may be that the startup process never accesses the last page to be flashed.
Let me know if this captures the info you need. |
This feature doesn't seem to work when it is issued from a USB3 bus. See pybricks/support#2515. Since we don't use the version, removing the command is harmless.
This fixes an issue where the EV3 firmware had checksums appended to it that made its size not align to the sector size, causing flashing to fail.
Research in pybricks/support#2375 (comment) and below shows that erasing the firmware and writing it sector by sector causes hangs during the flashing process. Instead, we should erase the whole firmware at once, and flash it at once. This successfully loads new EV3 firmware without hangs.
If the EV3 firmware size is not a multiple of the sector size, the flashing process will hang. Raise an error if this happens.
61a623d to
61ea870
Compare
I would also like to see a capture of the problem that requires us to have aligned firmware size. |
misaligned_firmware_selected.zip This packet capture was produced by taking the HEAD of this pull request, and introducing four zero bytes at the end of the firmware. I erased the flash at sector boundaries (including the extra padding -- so, one more sector than would have been erased without the padding), then wrote the whole firmware, including the four padded bytes. I observed a timeout on the pybricks-code end of things. |
|
What happens if we put the actual image size in the 0xf0 command? |

Flash the EV3 all in one go rather than sector-by-sector. This appears to resolve issues we had with flashing (some?) EV3s, and mirrors what we do in pybricksdev.
Fixes pybricks/support#2375.