-
Notifications
You must be signed in to change notification settings - Fork 9
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
Speed up and clean up RPS creation #75
Open
jerome-pouiller
wants to merge
9
commits into
SiliconLabsSoftware:main
Choose a base branch
from
jerome-pouiller:speed-up-rps-creation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Speed up and clean up RPS creation #75
jerome-pouiller
wants to merge
9
commits into
SiliconLabsSoftware:main
from
jerome-pouiller:speed-up-rps-creation
Conversation
This file contains 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
Unix systems expect to retrieve the script interpreter on the first line. This patch fix siwx917_isp_prepare.py. Signed-off-by: Jérôme Pouiller <[email protected]>
The "crc" Python package offer implementation for arbitrary CRC. Unfortunately, this yet another dependency for the Zephyr project. In addition, this implementation is rather slow (probably mainly because of the computation of reflected bytes does not use a table). I have measured computation time with: time zsh -c ' repeat 20; python3 siwx917_isp_prepare.py --rom_addr 0x08202000 .../zephyr.bin .../zephyr.bin.rps ' With current implementation, I get 9.415s. Then I get 2.540s with common CRC algorithm: register = 0; for b in b'123456789': register ^= b for _ in range(8): lsb = register & 1; register >>= 1 if lsb: # Reflected polynomial: 0xd95eaae5 register ^= 0xa7557a9b Finally table based implementation reach 0.820s. 11x faster than the initial implementation. Signed-off-by: Jérôme Pouiller <[email protected]>
Try to clearly show the various steps of the image generation. Signed-off-by: Jérôme Pouiller <[email protected]>
Argparse is able to do various validation on arguments. Let's use this ability and simplify the main body of the code. Signed-off-by: Jérôme Pouiller <[email protected]>
'_' in option name are uncommon. '-' are preferred. Also change the name of --rom_addr in --load-addr so the Zephyr users won't be confused. Signed-off-by: Jérôme Pouiller <[email protected]>
jerome-pouiller
force-pushed
the
speed-up-rps-creation
branch
2 times, most recently
from
December 20, 2024 16:10
3eb90b7
to
0b94b1e
Compare
Zephyr compliance script is sad because this script use ' rather than ". This patch try to make it happier. Signed-off-by: Jérôme Pouiller <[email protected]>
jerome-pouiller
force-pushed
the
speed-up-rps-creation
branch
from
December 20, 2024 16:15
0b94b1e
to
a6ad7d6
Compare
Zephyr compliance script still complain about small details in siwx917_isp_prepare.py. I don't have strong opinions about these changes, so let's apply the suggestions. Signed-off-by: Jérôme Pouiller <[email protected]>
Python "crc" package is no more required. Signed-off-by: Jérôme Pouiller <[email protected]>
Python "crc" package is no more required. Signed-off-by: Jérôme Pouiller <[email protected]>
jerome-pouiller
force-pushed
the
speed-up-rps-creation
branch
from
December 20, 2024 16:29
a6ad7d6
to
a784ccf
Compare
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.
The initial goal of this PR was to drop dependency to CRC python module. I have also greatly speed up the generation of the .rps file (11 time faster) and cleaned up the script.