Skip to content

troycondit/intelhex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

intelhex

A lightweight, header-only C++20 library for parsing Intel HEX firmware files.

Features

  • Fully header-only (just copy include/IntelHex.hpp)
  • C++20 design with no external dependencies
  • Parses standard Data, EOF, Extended Segment, and Extended Linear Address records
  • Automatically verifies line checksums

Usage

#include <IntelHex.hpp>
#include <fstream>
#include <iostream>

int main() {
    std::ifstream file("firmware.hex");
    if (!file) {
        std::cerr << "Failed to open file\\n";
        return 1;
    }

    intelhex::Parser parser;
    try {
        parser.parse(file);
        
        // Get the flattened binary blob
        std::vector<uint8_t> firmware = parser.get_firmware_data();
        std::cout << "Firmware size: " << firmware.size() << " bytes\\n";
        
    } catch (const std::exception& e) {
        std::cerr << "Failed to parse: " << e.what() << "\\n";
    }

    return 0;
}

Testing

To build tests:

cmake -S . -B build -DINTELHEX_BUILD_TESTS=ON
cmake --build build
ctest --test-dir build

About

intel hex file parser

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors