GithubHelp home page GithubHelp logo

ihex's People

Contributors

drahnr avatar martinmroz avatar skrapi avatar thomas-brunel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ihex's Issues

Error in writer.rs

I am trying to use ihex for some hex analysis and I wanted to get a Display implementation for Record, while messing around with it, I got this error:

error[E0277]: a value of type `std::result::Result<std::vec::Vec<std::string::String>, writer::WriterError>` cannot be built from an iterator over elements of type `std::string::String`
   --><MYDIR>/ihex/src/writer.rs:192:10
    |
192 |         .collect::<Result<Vec<String>, WriterError>>()
    |          ^^^^^^^ value of type `std::result::Result<std::vec::Vec<std::string::String>, writer::WriterError>` cannot be built from `std::iter::Iterator<Item=std::string::String>`
    |
    = help: the trait `std::iter::FromIterator<std::string::String>` is not implemented for `std::result::Result<std::vec::Vec<std::string::String>, writer::WriterError>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ihex`.

I don't have enough Rust experience to fix this yet, so posting hoping one of the contributors have an idea of a fix.

Characters preceding start code not ignored

Hi,

Not sure if this is still relevant, but from the wikipedia page of the Intel hex file format it is mentioned that all characters preceding the start code of a record should be ignored, which is not the case as of today. I have done a modification on my fork to do this, but I wanted to know if this is still relevant before doing a PR.

License

Would you consider making it dual licensed to MIT OR Apache-2.0? Reasons have been discussed fully i.e. lo48576/fbx_direct#1

Thanks for creating this awesome crate!

Potentially stronger README example?

pub struct MemoryRegion {
    pub start: u32,
    pub end: u32,
    pub name: String,
    pub buffer: Vec<u8>,
}

impl MemoryRegion {
    fn address_in_region(&self, address: u32) -> bool {
        address >= self.start && address <= self.end
    }

    fn set(&mut self, address: u32, value: u8) {
        let offset = (address - self.start) as usize;
        self.buffer[offset] = value;
    }

    fn get(&self, address: u32) -> u8 {
        let offset = (address - self.start) as usize;
        self.buffer[offset]
    }

    fn to_ihex(&self) -> String {
        let mut data: Vec<u8> = vec![];
        for i in (self.start..self.end) {
            data.push(self.get(self.start + i));
        }
        let offset = (self.start >> 16) as u16;
        return ihex::create_object_file_representation(&[
            ihex::Record::ExtendedSegmentAddress((self.start >> 16) as u16),
            ihex::Record::Data { offset, value: data },
            ihex::Record::EndOfFile,
        ]).unwrap();
    }
}

I'm trying to dump this MemoryRegion:

MemoryRegion {
                start: 0x50000000,
                end: 0x5001DFFF,
                buffer: vec![0; 0x1E000],
                name: String::from("CPU2_DSPR"),
            }

and I'm a little confused how I should be doing the looping given the constraints from ihex::Record::Data (Specifies a 16-bit offset address and up to 255 bytes of data)

Can you maybe help me better understand what it would take to dump this memory region and maybe we can PR it to the README for a stronger, more real world Intel hex example?

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.