intel_hex

Load, modify and save Intel hex files in Elixir

APACHE-2.0 License

Downloads
4.5K
Stars
2

IntelHex

This is a library for loading, modifying and saving Intel HEX files. This file format is frequently used for firmware images on microcontrollers.

Here's an example use:

# Load a file. Note the little memory map of the file contents
iex> hex = IntelHex.load!("./test/test.hex")
%IntelHex{0x0->26B|0x1B->15B|0x2B->31B}

# Take a look at the first two 16-bit integers
iex> <<x::little-16, y::little-16>> = IntelHex.get(hex, 0, 4); {x, y}
{6146, 512}

# Change them to {1, 2}
iex> hex = IntelHex.set(hex, 0, <<1::little-16, 2::little-16>>)
%IntelHex{0x0->26B|0x1B->15B|0x2B->31B}

# Check that it worked.
iex> <<x::little-16, y::little-16>> = IntelHex.get(hex, 0, 4); {x,y}
{1, 2}

# Save it to a new file
iex> IntelHex.save(hex, "new.hex")
:ok

Installation

The package can be installed by adding intel_hex to your list of dependencies in mix.exs:

def deps do
  [
    {:intel_hex, "~> 0.2.1"}
  ]
end
Package Rankings
Top 33.82% on Hex.pm
Badges
Extracted from project README
CircleCI Hex version