Code Monkey home page Code Monkey logo

hexrec's People

Contributors

suudy avatar texzk avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

hexrec's Issues

blocks.find search not spanning over neighbors and only doing linear search

Hi,

thanks for this great package. I found some issues, though. The blocks.find method's documentation reads like it was done for applying binary search (just like locate_at() does). But this is apparently not the case, there is only a simple slow loop inside.

Also, the current implementation does not look into subsequent blocks. That's not a problem if you have applied merge() before but in case someone has forgotten this, the find operation might throw the exception incorrectly.

However, since the find() method is probably already in use by people, it might make sense to deprecate it and document its issue, and create an alternative method like "bin_find". Which would also return a list of block ids, not just one.

Add align method

Add an align method to flood (pad) blocks such that their boundaries become aligned to the required alignment.

hexrec.records.save_blocks always adding a dummy Linear Address Record

Hi,

from what I see, when a user calls something like:

    save_blocks(out_res_path, blocks, record_type=IntelRecord, split_kwargs={"columns": columns})

The resulting file always contains an additional block which looks like:

:020000040000FA
:0400000500000000F7

From what I know about IntelHEX format, that is probably a Linear Address Record or Extended Linear Address Record. But those were not part of the data to store. They may have some purpose for somebody but in my usecase, they end up without contents.

So my wish would be to have a parameter of save_blocks to NOT add such dummy blocks unless there is data content for them, or maybe even make that behavior default.

merge_records writes header records to memory

In merge_records, there is:

    blocks = []
    for records in data_records:
        blocks.extend([r.address, r.data] for r in records)
    blocks = Memory.collapse_blocks(blocks)

But this doesn't filter out the header records, which leads to header data corrupting memory.

filling sequence error

import hexrec.records as hr

default_values = [0xFF for _ in range(256)]

hr.save_chunk('TEST.s19', bytes(default_values), 0X1f00)

memory = hr.load_memory('TEST.s19')

memory.fill(0X1f00,0X1f05,bytes([0x01,0x02,0x03,0x04,0x05]))

hr.save_memory('TEST.s19', memory)

the first position is 0x02( position: 0x1f00 )
the last position is 0x01(position: 0x1f04)

the sequence is 0x02 0x03 0x04 0x05 0x01

Memory.__getitem__() exception

In Memory.__getitem__():

            if isinstance(step, self.items_type):
                blocks = read(blocks, start, endex, step, self.items_join)
                **blocks = flood(blocks, pattern=step, join=self.items_join)**
                items = self.items_join(items for _, items in blocks)
                return items

the call to flood() raises an exception when the range [start:endex] is empty.

It is required to call flood() with start and endex arguments.

[PyInstaller] KeyError: 'unsupported extension: .hex'

Error while running "cut" command with generated exe from PyInstaller,

\hexrec\pyinstaller\win-x86>hexrec cut -s 0x04201800 -e 0x04201850 test-input.hex test-output.hex
Traceback (most recent call last):
File "hexrec_cli.py", line 7, in
File "site-packages\hexrec-0.2.1-py3.8.egg\hexrec_main_.py", line 43, in main
File "site-packages\click\core.py", line 829, in call
File "site-packages\click\core.py", line 782, in main
File "site-packages\click\core.py", line 1259, in invoke
File "site-packages\click\core.py", line 1066, in invoke
File "site-packages\click\core.py", line 610, in invoke
File "site-packages\hexrec-0.2.1-py3.8.egg\hexrec\cli.py", line 264, in cut
File "site-packages\hexrec-0.2.1-py3.8.egg\hexrec\cli.py", line 110, in find_types
File "site-packages\hexrec-0.2.1-py3.8.egg\hexrec\records.py", line 2028, in find_record_type_name
KeyError: 'unsupported extension: .hex'
[21792] Failed to execute script hexrec_cli

Even specifying input file format throws invalid choice error,

hexrec-0.2.1-py3.8.egg\hexrec\pyinstaller\win-x86>hexrec cut -s 0x04201800 -e 0x04201850 -i intel test-input.hex test-output.hex
Usage: hexrec cut [OPTIONS] INFILE OUTFILE
Try 'hexrec cut --help' for help.

Error: Invalid value for '-i' / '--input-format': invalid choice: intel. (choose from )

But, running directly from the command line tool works OK
hexrec\pyinstaller\win-x86>python -m hexrec cut -s 0x04201800 -e 0x04201850 test-input.hex test-output.hex

System environment details:
OS : Windows 10,
Python v3.8.3

Installed hexrec from source and also tried with pip install
Same error is seen on Windows sub-system for Linux as well.

Attached input .hex file and generated hexrec.exe for reference.
win-x86.zip

Organize docs manually (no autosummary)

The templated autosummary stuff is a mess.
I'd rather generate some automatic stuff, then switch to manual page formatting, as soon as the API gets stable enough.

Microchip SQTP addressing by words

Currently Microchip SQTP is parsed as Intel HEX (commit 9c8a344).
There are issues converting to/from memory role because Microchip SQTP addresses are expressed in words (2 or 4 byte wide) instead of direct bytes.
Thus, Microchip SQTP requires dedicated management for apply_records, update_records, and the like.

Python 3.10 not supported

When I try to import the hexrec.records using newest python it says there is no module:
import hexrec.records as hr
ModuleNotFoundError: No module named 'hexrec.records'

It is installed though, and worked in python 3.9.

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.