Comments (3)
I clarified that giving padding as None
means pad with 0xff.
from bincopy.
len(binflie)
is the sum of all segments' lengths.
len(binfile.as_binary()
is the binary minimum address subtracted from the maximum address. So this includes padding between segments.
So if you have a file with two segments, say addresses 0-10 and 90-100, len(binfile)
returns 20, while len(binfile.as_binary()
returns 100.
I have absolutely no idea if this behavior is good, but that's how it works.
from bincopy.
Ah! Okay, that is good to know. I can certainly understand the reasoning there.
I guess maybe the padding=None
default argument of as_binary()
might have been throwing me off. In terms of the English language, that obviously looks like "no padding will be added between segments". Which obviously does not make sense when generating a binary blob... you need padding. So the behavior makes sense, but the "api" wording was throwing me off.
Anyhow, thanks for the clarification.
And thanks for the library! Been getting a some good use out of it! Saved me a lot of headache as I have a need to read, modify, and write compiled ihex/binaries.
Cheers!
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
- Feature request: Support Microchip HEX format HOT 3
- 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.