eerimoq / bincopy

Mangling of various file formats that conveys binary information (Motorola S-Record, Intel HEX, TI-TXT, Verilog VMEM, ELF and binary files).
MIT License
109 stars 38 forks source link

Extract data by address in S19 #26

Closed fncode246 closed 2 years ago

fncode246 commented 2 years ago

Thanks for the useful library.

Is it possible to extract part of Data by start address from S19 and convert to binary. because in my S19 there are jumps in addresses and there is no need to convert all of them to binary and add 0xFF in such jumped places.

eerimoq commented 2 years ago

I'm sure it's possible. Maybe iterate over segments? Not sure I quite understand you use case.

fncode246 commented 2 years ago

For example: Iterate over all segments that are printed below: Segment(address=1024, data=bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff~\xf9\xff\xff')) Segment(address=16880, data=bytearray(b'\x06el\x0b\x06d\xfc\x0b')) Segment(address=245760, data=bytearray(b'\x0f\x00\x00\x00\x00\x00\x00\x00'))

I want to convert the data in each segment to binary (using f.as_binary())

eerimoq commented 2 years ago

The segment contains the data. Just do segment.data.