View Source IntelHex (intel_hex v0.2.1)

Manipulate Intel HEX files

This is the main interface for loading, modifying and saving Intel HEX files. In general, you'll want to use methods here for most operations.

Internally, data is stored as lists of IntelHex.Block structs. See that module for transformations that aren't possible with the main functions.

Summary

Types

t()

Primary type for handling Intel Hex file data

Functions

Only keep data within the specified address range

Get the data at a specified address

Load an Intel Hex-formatted file into memory

Load an Intel Hex-formatted file into memory

Create an empty hex file

Save data to an Intel Hex-formatted file

Set a set of bytes at the specified address

Types

@type t() :: %IntelHex{blocks: [IntelHex.Block.t()], path: String.t()}

Primary type for handling Intel Hex file data

Functions

Link to this function

crop(hex, address, length)

View Source
@spec crop(t(), non_neg_integer(), non_neg_integer()) :: t()

Only keep data within the specified address range

Link to this function

get(hex, address, num_bytes, options \\ [])

View Source
@spec get(t(), non_neg_integer(), non_neg_integer(), [{:fill, 0..255}]) :: binary()

Get the data at a specified address

Options:

  • :fill - value to use when none exists (defaults to 0)
@spec load(Path.t()) :: {:ok, t()} | {:error, term()}

Load an Intel Hex-formatted file into memory

@spec load!(Path.t()) :: t()

Load an Intel Hex-formatted file into memory

Raises File.Error or IntelHex.DecodeError if an error occurs.

@spec new() :: %IntelHex{blocks: [], path: String.t()}

Create an empty hex file

Use IntelHex.set/3 or other functions to populate it.

Link to this function

save(hex, path, options \\ [])

View Source
@spec save(t(), Path.t(), keyword()) :: :ok

Save data to an Intel Hex-formatted file

Options:

  • :block_size - the max data bytes per record. (defaults to 16)
@spec set(t(), non_neg_integer(), binary()) :: t()

Set a set of bytes at the specified address