Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ikskuh/zig-ihex

An intel hex loader written in Zig
https://github.com/ikskuh/zig-ihex

ihex intel-hex zig zig-package ziglang

Last synced: about 1 month ago
JSON representation

An intel hex loader written in Zig

Awesome Lists containing this project

README

        

# Zig Intel Hex parser

A loader for the [Intel Hex](https://en.wikipedia.org/wiki/Intel_HEX) format used in embedded
development.

## Features
- Supports all 6 record types
- Raw record parser (`parseRaw`)
- User-friendly preprocessor (`parseData`)
- Pedantic and lax parsing

## Example

```zig
fn processData(x: void, offset: u32, data: []const u8) !void {
std.debug.warn("read slice @ 0x{x}: {x}\n", .{ offset, data });
}

pub fn main() !void {
var file = try std.fs.cwd().openFile("data/example.ihex", .{ .read = true, .write = false });
defer file.close();

var entry_point = try ihex.parseData(file.reader(), ihex.ParseMode{ .pedantic = true }, {}, error{}, processData);
if (entry_point) |ep| {
std.debug.warn("entry point: 0x{x}\n", .{ep});
}
}
```