martinmroz / ihex Goto Github PK
View Code? Open in Web Editor NEWA Rust library for parsing and generating Intel HEX objects.
License: Other
A Rust library for parsing and generating Intel HEX objects.
License: Other
I believe it is swapped here.
The calculated one should be the value to be expected.
Lines 140 to 142 in fadf712
Using this package with hex files that were created on a windows system (\r\n line ending) results in RecordNotEvenLength errors.
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.
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.
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!
Hi,
Thank you for this usefull crate in a niche domain :D
Is it possible to bubble up any parsing error so we can inform the user that something gone wrong?
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.