npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@connectedyard/node-intelhex

v1.2.4

Published

Building and converting between intel-hex and binary data

Downloads

15

Readme

node-intelhex

Conversion between binary and intel-hex files, and programmatic construction of intel-hex files.

Usage

var intelhex = require('@connectedyard/node-intelhex');

intelhex.binaryFileToIntelHexFile( "binaryFile.bin", "intelHex.hex" );
intelhex.intelHexFileToBinaryFile( "intelHex.hex", "binaryFile.bin" );

Binary Data to Intel-Hex

Convert a file using binaryFileToIntelHexFile( binaryFileName, intelHexFileName, startAtAddress )

Convert a buffer in memory using binaryToIntelHex( buffer, startAtAddress )

Use startAtAddress to specify the starting memory location of the first byte in the binary file. For example, the binary data may need to be loaded at 0x18000, so use binaryToInelHex( buffer, 0x18000 )

Intel-Hex to Binary Data

Convert a file using intelHexFileToBinaryFile( intelHexFileName, binaryFileName, options )

Convert a text string to a buffer in memory using intelHexToBinary( intelHexString, options )

Use options to specify any of the following:

{
	 startAtOffsetZero: boolean,    // default=false, binary file begins at address zero, even when first data address in intelFile is > 0
	 maxBinaryAddress: integer,     // default=0x20000000, maximum binary address, determines size of buffer required in RAM
	 verbose: boolean,              // default=false, logs processing to console
}

Programmatically Creating an Intel-Hex File

Build an intel-hex programmatically using var processor = new intelhex.BufferToIntelHexProcessor( startAddress ) and the following functions:


processor.setAddress( address );                        // location for the next block data
processor.appendBuffer( buffer, littleEndian);          // append data from buffer, default is littleEndian=false
processor.appendWords( words, littleEndian );           // append data from array of words, default is littleEndian=false
processor.appendHexString( hexString );                 // append bytes from hex string
processor.writeHexStringAtAddress(address, hexString);  // set the current address and append bytes from the hex string 
processor.close();                                      // finish and append file terminator

var intelHexFileData = processor.contents;              // retrieve finished data string

Brief Summary of Intel-Hex Formatting

From https://en.wikipedia.org/wiki/Intel_HEX

Only I16HEX formatting is supported, which supports 32 bit addressing through the Extended Segment Address.

The Intel Hex Line Format is :llaaaatt[dd...]cc

Where

  • ll = data length
  • aaaa = lower 16 bit address
  • tt = record type
  • dd = data (hex)
  • cc=checksum = 2's comp of negative of sum of all record bytes

Record Types are

  • 00 - data record
  • 01 - end-of-file record
  • 02 - extended segment address record
  • 04 - extended linear address record
  • 05 - start linear address record (MDK-ARM only)

This module only uses extended segment addresses (02)

The default hex line terminator is \n, which can be changed by setting processor.lineTerminator.