feat(flash): Switch to sector-by-sector flashing#47
feat(flash): Switch to sector-by-sector flashing#47JakubVanek wants to merge 2 commits intoc4ev3:masterfrom
Conversation
a227a71 to
0180811
Compare
|
There is something wrong with this and I am not certain what is it. When I flash the 1.09E firmware using this branch, one sector comes out consistently corrupted: |
|
The flashing speed is slightly lower, but it still seems acceptable.
|
Things are getting more weird: even programming the brick using the original code produces the same (mismatching) remote CRC. |
|
The CRC issue is not visible when I flash the 1.10E firmware, only when I flash the 1.09E firmware. |
|
Whatever the problem with sector 4 is, it is reproduced by flashing the brick via the classic EV3 software app on Windows and so it does not look like a bug in ev3duder. |
0180811 to
1688487
Compare
|
The code seems to work OK against a real brick after all. |
|
I think I know what the problem with sector 4 in firmware 1.09E was. The sector is matching before the brick is first rebooted out of firmware update mode. This would indicate that U-Boot has its environment block there. The available U-Boot sources indicate the same: https://github.com/mindboards/ev3sources/blob/78ebaf5b6f8fe31cc17aa5dce0f8e4916a4fc072/extra/uboot-03.20.00.13/include/configs/da850evm.h#L176 |
1688487 to
f1e6c7e
Compare
fa2fad2 to
6efb152
Compare
"flash crc" gives the user various ways of comparing the CRC of a file to the CRC reported by the EV3 bootloader. Can do that for the full image, or a group of sectors, or sector-by-sector.
This flashing flow has some advantages: - It is more interactive - the long erase command is avoided - It seems to be less sensitive to hardware malfunctions. See issue c4ev3#45 where this mode was used to flash an EV3 brick with what looks like faulty RAM. As some functions are now called repeatedly, I tried to go through them and eliminate the memory leaks in them.
6efb152 to
032cb28
Compare
|
You might find pybricks/pybricks-code#2356 interesting. I did a bunch of testing today (with Pybricks Code, not ev3duder - but the same ideas) and my conclusion is that the probability of With a bit of creativity, I was able to avoid commands of that size or smaller and so far haven't seen a I haven't done anything with CRC yet though. It could be interesting to use that to see what firmware is already on the EV3 and avoid re-flashing identical sectors. Based on the code here, it looks like that suffers from |
|
Hello, thank you for catching this issue. While it seems to me that the code could be salvaged by just iterating over blocks of two sectors, I think I'll drop the PR as the original flow is likely more battle-tested. Jakub |
This flashing flow has some advantages:
As some functions are now called repeatedly, I tried to go through them and eliminate the memory leaks in them.
I have not yet tested this new code myself, so I have created this as a draft PR for now. This is also rebased on top of #46 because I've moved the FLASH_* macros to the
funcs.hheader.