from_strings#

hexrec.formats.sqtp.from_strings(strings, start=0, retlw=None, wordsize=2, forcedela=False)[source]#

Creates a file from byte strings.

Given a sequence of byte strings, it creates an Intel HEX file with the special record sequence and addressing of Microchip SQTP.

All the strings must be the same length, between the minimum word size of the processor (minimum 2) and 256.

Parameters:
  • strings (list of bytes) – Sequence of byte strings.

  • start (int) – Start word address of a byte string within the target memory.

  • retlw (int) – If None, this has no effect. If a byte integer is given, it must be the equivalent of the RETLW opcode of the target processor. The RETLW byte is put after each byte of the byte string.

  • wordsize (int) – Memory word size (2 or 4 bytes).

  • forcedela (bool) – Forces Extended Linear Address generation.

Returns:

IhexFileMicrochip SQTP file as special Intel HEX format.

Examples

>>> from hexrec.formats.sqtp import from_strings
>>> strings = [b'abcdefghijklm', b'nopqrstuvwxyz', b'ABCDEFGHIJKLM', b'NOPQRSTUVWXYZ']
>>> file = from_strings(strings, forcedela=True)
>>> _ = file.print()
:020000040000FA
:0D0000006162636465666768696A6B6C6DB8
:0D0000006E6F707172737475767778797A0F
:0D0000004142434445464748494A4B4C4D58
:0D0000004E4F505152535455565758595AAF
:00000001FF
>>> file = from_strings(strings, start=0x1FC02FF0, wordsize=4)
>>> _ = file.print()
:020000047F007B
:0DBFC0006162636465666768696A6B6C6D39
:0DBFC0006E6F707172737475767778797A90
:0DBFC0004142434445464748494A4B4C4DD9
:0DBFC0004E4F505152535455565758595A30
:00000001FF
>>> file = from_strings(strings, start=0x8000, retlw=0x34)
>>> _ = file.print()
:020000040001F9
:1A0000006134623463346434653466346734683469346A346B346C346D3407
:1A0000006E346F3470347134723473347434753476347734783479347A345E
:1A0000004134423443344434453446344734483449344A344B344C344D34A7
:1A0000004E344F3450345134523453345434553456345734583459345A34FE
:00000001FF