Comments (3)
Can the format be handed without a flag to Bincopy
? I prefer to have format logic in add*()
methods.
from bincopy.
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 add_microchip_hex_file
:
import bincopy
# binfile = BinFile("microchip.hex") # Won't work.
binfile = BinFile()
binfile.add_microchip_hex_file("microchip.hex")
Footnotes
-
In practice, I think every fourth byte in a Microchip HEX is guaranteed to be zero (even though the example given in Microchip's format definition contradicts this), which could in theory be used to determine if a file is a normal Intel HEX or a Microchip HEX. Seems a little fragile to rely on that, since it's not explicit in the format definition. ↩
-
Scratch that, that is only the case for 16-bit word / 24-bit instruction. For PIC18 (8-bit word / 16-bit instruction) there is no such pattern. I think the formats are truly indistinguishable. ↩
from bincopy.
Looks like a good plan.
from bincopy.
Related Issues (20)
- BinFile maximum_address is actually pointing 1 byte "further"? HOT 2
- Enhancement don't parse no vailed lines of the end HOT 4
- module entry point is broken HOT 4
- save the object bincopy.BinFile HOT 1
- Invalid ELF file parsing HOT 4
- Extract data by address in S19 HOT 3
- fill empty space HOT 1
- Incorrect error check condition? HOT 3
- Enhancement: support full Verilog hex format HOT 2
- as_binary() raises a MemoryError HOT 5
- Change behaviour of `as_binary` when data is not present? HOT 2
- Invalid section from ELF file HOT 18
- 17.14.3: Missing some test files in sdist tarball HOT 4
- Do we have function like change s19 content? HOT 4
- Promote _Segments, _Segment, _Chunk to public API HOT 6
- Chunk.__len__ should return length of data HOT 1
- First chunk is misaligned if segment has non-aligned start address HOT 2
- Problem with loading ELF file produced by CodeWarrior toolchain HOT 1
- convert S19 to S19 file (add empty space and create new S19 file)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bincopy.