hexrec.records#

Hexadecimal record management.

The core of this library are hexadecimal record files. Such files are used to store binary data in text form, where each byte octet is represented in hexadecimal format. Over the whole byte addressing range of the memory to store (typically 32-bit addressing), only the relevant data is kept.

The hexadecimal data text is split into record lines, which give the name to this family of file formats. Each line should at least be marked with the address of its first byte, so that it is possible to load data from sparse records.

Usually not only plain data records exist, but also records holding metadata, such as: a terminator record, the record count, the start address to set the program counter upon loading an executable, a generic header string, and so on. Each record line is thus marked with a tag to indicate which kind of data it holds.

Record lines are commonly protected by a checksum, so that each line can be checked for (arguably weak) consistency. A count number is used to measure the record line length some way.

Summarizing, a record line holds the following fields:

  • a tag to tell which kind of (meta)data is hold;

  • some bytes of actual data, or tag-specific;

  • the address of its first data byte, or tag-specific;

  • the count of record line characters;

  • a checksum to protect the record line.

This module provides functions and classes to handle hexadecimal record files, from the record line itself, to high-level procedures.

Module attributes

RECORD_TYPES

Registered record types.

Functions

blocks_to_records

Converts blocks to records.

convert_file

Converts a record file to another record type.

convert_records

Converts records to another type.

find_record_type

Finds the record type class.

find_record_type_name

Finds the record type name.

get_data_records

Extracts data records.

load_blocks

Loads blocks from a record file.

load_memory

Loads a virtual memory from a file.

load_records

Loads records from a record file.

merge_files

Merges record files.

merge_records

Merges data records.

records_to_blocks

Converts records to blocks.

register_default_record_types

save_blocks

Saves blocks to a record file.

save_chunk

Saves a data chunk to a record file.

save_memory

Saves a virtual memory to a record file.

save_records

Saves records to a record file.

Classes

Record

Abstract record type.

Tag

Abstract record tag.