Yo!
I am happy to announce the new release of Intel_hex library. It is a Intel HEX manipulation library for parsing and generating Intel HEX (also known as IHEX) objects. 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.
This new version of the library has been completely rewritten, rethought and tested.
In use
Here is an example of how to create an Intel HEX file with test data and print it:
Intel_hex.Record.
[
Extended_linear_address 0x0F;
Data (0x0000, "Hello ");
Data (0x0007, "World!");
End_of_file;
]
|> Intel_hex.Encode.into_string
|> print_endline
:02000004000FEB
:0600000048656C6C6F20E6
:06000700576F726C6421CA
:00000001FF
Also, you can read Intel HEX objects from any source, of course.
In_channel.with_open_text "data.hex" Intel_hex.Decode.from_channel
- : Intel_hex.Object.t =
[Intel_hex.Record.Extended_linear_address(0x000F);
Intel_hex.Record.Data(0x0000, "Hello ");
Intel_hex.Record.Data(0x0007, "World!");
Intel_hex.Record.End_of_file]
New features
Intel_hex.Object.from_string ~block_size:6 "Hello World! I love it!"
- : Intel_hex.Object.t =
[Intel_hex.Record.Data(0x0000, "Hello ");
Intel_hex.Record.Data(0x0006, "World!");
Intel_hex.Record.Data(0x000C, " I lov");
Intel_hex.Record.Data(0x0012, "e it!");
Intel_hex.Record.End_of_file]
Installation
You can install the intel_hex library using the OPAM package manager or any other method you prefer.
$ opam install intel_hex.0.4