Add option/parameters to strip padding from the end of binary data. #64
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.
Sometimes when converting iHex -> binary and you specify a range, it is not because you want to fill that range, but rather because you want to limit the output to (at most) that range.
For example, a PIC18F might have 32kB of Flash, but has a few bytes of config memory that loads at address 3M. So when you create a .bin file for it, the 32kB part winds up with a 3MB binary! And, if you're loading the binary through a bootloader, you don't need the config memory anyway.
So, you might limit the range to 0x800:0x7FFF (above the bootloader to the end of Flash). But if the app is only 4kB, then >80% of the binary is padding, and sending it to the bootloader taks considerably longer than necessary.
This PR adds a
strip
option to the functions that output to binary, that can tell them to strip off any padding at the end of the binary array. It also adds a--strip
option to the hex2bin.py script to pass that option along.This probably isn't an optimal solution, and I assume there's other ways to accomplish the same goal, but this update fit our needs.