Function parseIntelHex

  • Parse an Intel HEX file into contiguous flash regions.

    Gaps in the address map become separate regions, so a later writeFlash of those regions leaves partitions that have no records (for example NVS and factory data) unerased. Addresses come from the HEX file: extended linear address (type 04) and extended segment address (type 02) set the upper bits. Do not add a caller-supplied base offset on top of the returned addresses.

    The HEX must be sparse. A file converted from a padded merged binary still contains the gap bytes and will erase those partitions.

    Parameters

    • input: string | Uint8Array

      Intel HEX text, or the same text as bytes.

    Returns IntelHexSegment[]

    Contiguous regions in ascending address order.