package intel_hex
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=00c5a2732686c0545b73e1e63868c5e3
sha512=50067d47646f48a2b272fb0a7673b7ba4373502a0346175834502b5d57748647cb80e7cf7c3ede895b0cb01e31a90cf248533c3d71e987a3828f7bff2b097b77
doc/README.html
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
:00000001FFAnd 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
- https://en.wikipedia.org/wiki/Intel_HEX
- https://www.tasking.com/documentation/smartcode/ctc/reference/objfmt_hex.html
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!