-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature request: Support Microchip HEX format #38
Comments
Can the format be handed without a flag to |
It could be done like this: def add_microchip_hex(self, records, overwrite=False):
self.word_size_bytes = 1
self.add_ihex(records, overwrite)
self.word_size_bytes = 2
self.segments.word_size_bytes = 2
for segment in self.segments:
segment.word_size_bytes = 2
def add_microchip_hex_file(self, filename, overwrite=False):
with open(filename, 'r') as fin:
self.add_microchip_hex(fin.read(), overwrite) However, since Microchip's format is indistinguishable12 from Intel, users would have to directly call import bincopy
# binfile = BinFile("microchip.hex") # Won't work.
binfile = BinFile()
binfile.add_microchip_hex_file("microchip.hex") Footnotes
|
Looks like a good plan. |
The Microchip HEX format is identical to the Intel format, except the addresses in the HEX file are twice the actual machine addresses. This is because Microchip's PIC architecture typically has wider instructions than its machine word. For example, the PIC24 uses 16-bit words but 24-bit instructions.
This can be handled by parsing the file as Intel format with a word size of one byte, and then changing the word size to two bytes after parsing is done.
I can make a PR if you think this would be a useful feature. It could be enabled with an optional
microchip=False
argument toBinFile
.The text was updated successfully, but these errors were encountered: