package intel_hex

  1. Overview
  2. Docs
Intel HEX parsing and manipulation library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.1.tar.gz
md5=ed5cd15a1276212568595a3af01d9c6c
sha512=29057ec2218bb1f4f74bbd3559d35dafedb6821816f33ac9c9571470f523b928c5dfaf086602a93c6922d5558514f4648743e5eadc8be8d23ad53ad2fd288517

Description

A library for parsing and generating Intel HEX (also known as IHEX) objects

Tags

ihex intelhex embedded bytes hex

Added to opam-repository:

README

intel_hex

Intel HEX parsing and manipulation library.

This format is commonly used to represent compiled program code and data that is loaded into a microcontroller, flash memory, or ROM in embedded systems programming.

Quick start

You can install the intel_hex library using the OPAM package manager or any other method you prefer. If you are using Dune, please add the intel_hex library to your dependencies.

In use

The library provides a simple API for parsing and creating Intel HEX files. To create an Intel HEX file, you can use the following code:

Intel_hex.Record.
[
  Extended_linear_address 0x0F;
  Data (0x0000, "Hello ");
  Data (0x0007, "World!");
  End_of_file;
]
|> Intel_hex.Object.to_string
|> print_endline
:02000004000FEB
:0600000048656C6C6F20E6
:06000700576F726C6421CA
:00000001FF

And to parse a string containing an Intel HEX file:

":0600000048656C6C6F20E6\n:06000700576F726C6421CA"
|> Intel_hex.Object.of_string
(* - : Intel_hex.Object.t =
  [ Intel_hex.Record.Data (0, "Hello "); 
    Intel_hex.Record.Data (7, "World!") ] *)

However, the library also provides a module for working with memory images built from Intel HEX files or other sources.

Intel_hex.Memory.of_string ~block_size:6 "Hello World!"
(* - : Intel_hex.Memory.t =
 [ Intel_hex.Memory.Segment(0x0000, "Hello ");
   Intel_hex.Memory.Segment(0x0006, "World!") ] *)

For more details, see the API reference and the examples/ directory.

References

Format description

Reference implementations

License

The project is licensed under the MIT License, which allows for all permissions. Just use it and enjoy yourself without fear. We are always open to pull requests!

Dependencies (3)

  1. hexen >= "0.2"
  2. ocaml >= "5.2"
  3. dune >= "3.6"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test

Used by

None

Conflicts

None