-
Notifications
You must be signed in to change notification settings - Fork 299
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
use bmap files to skip flashing unused blocks #394
Conversation
Can you fixed CI build error? /home/runner/work/mfgtools/mfgtools/libuuu/bmap.cpp: In function ‘bool parse_image_size(bmap_t&, const tinyxml2::XMLElement*)’: |
Hi. I tried to use this PR as we have a very large image with a lot of empty space. I built it on linux (wsl) first. At first it did not work with either the builtin scripts or a custom one. This is because the version number generated from tags was incorrect. After removing the tags "uuu_db_bmap" and db_bmap", it worked correctly and sped up the flash significantly. Then, I tried to build for Windows. Same issue with tags. It also couldn't find tinyxml2.h even with the submodules checked out and I had to install tinyxml2 using vcpkg. After this, the build suceeded, but the binary did not work correctly. The flashing finished after a few seconds (way too fast) and the image in flash was corrupt and could not boot. There seems to be an issue that occurs only on Windows and not on Linux. |
@ondrejhennel Thank you for your testing this PR. |
On Linux, with the bmap file available, with the same name as the image, it works well and the flashing time is considerably reduced (thanks!). However, if modify the flashing script this way:
I see:
which is expected, but then it fails:
|
@nxpfrankli @ondrejhennel I can't deduce how the tags thing should work. The build is not working without a tag. |
During the build, git describe is used to generate a version number from the latest tag. The build will be successful if there is any tag. However, the version number is used to check compatibility with the scripts. If there is a tag like uuu_db_bmap, uuu will think it is incompatible with the builtin scripts and fail to run. I think the easiest solution to make the build work is to just use the tags that are in the original repo and not add any others. |
The Unsigned64Text call is a recent change in the TinyXML while the previous versions of the library don't implement it. For backward compatibility with TinyXML v2.7 which is only available on Ubuntu 18 and other OS, replace the call to Int64Text.
* restored the original flash -raw2sparce behavior. .bmap files will be ignored if not explicitly specified in script commands * added -no-bmap global options to ignore .bmap files even if those are specified in script commands * added -bmap global option to try using .bmap files even if thise are not specified in script commands
@nxpfrankli I have fixed CI issues |
The flashing with bmap now works correctly on Windows. However, there is some strange behavior with the command-line switches. Here are some examples:
The flags only work correctly in a custom script in a command such as |
@ondrejhennel Thanks for reporting. I found where I screwed with the command line parsing. Could you try with the fix? I locally verified so it should work as expected. |
When using the -bmap command line flag, it still gets stuck like this.
Other than that, it works correctly now. |
This is an incorrect usage. The global -bmap option doesn't take an an argument. I'm not sure thath the stuck is related to the command handler itself. |
I've tested this PR locally with success. |
Use .bmap files created by WIC tool the same way as bmaptool does, i.e. skip flashing irrelevant blocks.
This is a -raw2sparce extension.
By default, a file with the same base name but with "bmap" extension would be searched to get block map from.
An option '-no-bmap' would inhibit the search.
Also, a specific bmap file can be specified in the flash command via '-bmap' option.