waybyte / tool-pymtkflasher

Python based flash tool for Mediatek MT6261 and MT2503 SoC.
17 stars 10 forks source link

Pre format with multiple source files fix #1

Closed alrieckert closed 3 years ago

alrieckert commented 3 years ago

HI @ajaybhargav When uploading multiple files, each file will return new number of ACKs to read while pre-formating immediately followed by the ACKs for each file. Currently the code tries to read the number of acks for all files in file_count before it starts to receive the ACKs

So for example, if you send 3 files you will receive [ACK COUNT 1] [ACK] [ACK] [ACK] [ACK] [ACK COUNT 2] [ACK] [ACK] [ACK] [ACK] [ACK COUNT 3] [ACK] [ACK] [ACK] [ACK]

Currently the code does the following [ACK COUNT 1] [ACK COUNT 2] [ACK COUNT 3] [ACK] [ACK] [ACK] [ACK] [ACK] [ACK] [ACK] [ACK][ACK] [ACK] [ACK] [ACK]

With my patch applied I'm using it on the M26, M66 and MC60 modules for both custom firmware as well as with the standard ROM and VIVA images from Quectel

ajaybhargav commented 3 years ago

Yes you're right. The flow is different for application files and ROM/VIVA + Application files

For ROM+VIVA+APP image

[Filecount][ACK][ack for file 1][ACK][ACK]....[ack count for file 2][ACK][ACK]...[ack count for app file][ACK][ACK]...[ACK?]

APP Files only (which is currently implemented): I flashed two small files so ack count is 0 for both. image

Here is another screenshot with one small and one big app files: image

[Filecount][ACK][Ack for file1][ack for file2][ACK] [ACK][ACK]....

alrieckert commented 3 years ago

Thank you @ajaybhargav

I think the flow might be the same for APP images as well as for the ROM/VIVA images The reason you see the [Ack count for file 1] followed by the [Ack count for file 2] is that the [Ack count for file 1] is 0

If you send a bigger APP file 1 and it returns an value bigger that 0 we should first see the Acks of file 1 and then the Ack count for file 2

I'll test is a bit later and revert back with my findings

ajaybhargav commented 3 years ago

I just updated my comment with bigger file test. I knew you will have this doubt, so I updated with a bigger file as well.

alrieckert commented 3 years ago

Thank you @ajaybhargav, can you make file 1 also bigger to bring ack an ack count that is greater than 0?

ajaybhargav commented 3 years ago

aaa yes.. Good point. I think you're right. looks like I have never checked with first file as bigger one. image

Can you update your patches with following changes?

  1. Merge the first two readme changes in one patch
  2. I think the whole progress bar logic should also be put in loop, currently only the first pre format is in loop

image

alrieckert commented 3 years ago

Thank you, I'll merge the two README file updates

I've placed the format progress bar into the loop as follow: Screenshot from 2021-04-12 08-25-41

This is when uploading 3 files. Each file shows it's own format progress bar

ajaybhargav commented 3 years ago

Looks good... sadly we cannot merge pre format bars in one. Probably it can be done by pre calculation, the erase size used internally seems to be rounded to 0x10000 since we know the size of files, we can do estimate of number of acks that would come. Meanwhile this will do the trick 👍

You can force update the same branch, with updated patches.