Skip to content

Option to insert 'Extended Segment Address' record type instead of 'Extended Linear Address' #40

Open
@fernandez85

Description

@fernandez85

Hello,
my issue might be considered more as improvement. So I don't know if this is the right place.
I've observed that when You want to use write_hex_file, then You cannot decide which type of Extend Address record type will be used in hex file:

  • Extended Segment Address: record type 0x02
    or
  • Extended Linear Address: record type 0x04

Always second one will be used (0x04) and it cannot be changed as far I can see.
The code responsible
while cur_addr <= maxaddr:
if need_offset_record:
bin = array('B', asbytes('\0'*7))
bin[0] = 2 # reclen
bin[1] = 0 # offset msb
bin[2] = 0 # offset lsb
bin[3] = 4 # rectyp
I know that having that record type (0x04) shouldn't be a problem for most cases, but I have to deal with some legacy software. I run into problems when this record is not 0x02.
Is there any chance to add an option for 'write_to_hex' to have possibility to have functionality tp force using Extended Segment Address record types in output file.
In particular scenario when You initialize IntelHex with file that contains this kind of records, writing this with 'write_hex_file' (without changing any byte of payload) will result with differences comparing to original.

I can try to create a pull request with changes by myself, but I'm not very experienced Python programmer. I do Embedded (mostly C), but I starting to use Python more and more, especially for tooling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions