package intel_hex

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.0.tar.gz
md5=00c5a2732686c0545b73e1e63868c5e3
sha512=50067d47646f48a2b272fb0a7673b7ba4373502a0346175834502b5d57748647cb80e7cf7c3ede895b0cb01e31a90cf248533c3d71e987a3828f7bff2b097b77

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
  2. ocaml >= "5.2"
  3. dune >= "3.6"

Dev Dependencies (2)

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

Used by

None

Conflicts

None