Giter VIP home page Giter VIP logo

Comments (3)

eerimoq avatar eerimoq commented on August 16, 2024 1

I clarified that giving padding as None means pad with 0xff.

from bincopy.

eerimoq avatar eerimoq commented on August 16, 2024

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.

ahogen avatar ahogen commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.