

Hextools - tools for maniuplating S-Record and Intel Hex formats.
By Steve Tell.

The tools:  (Sorry, no man pages yet.  This and the comments in the source
will have to do)

Library routines to use in you own code if you like:

xread.c, xread.h - format-independent hex file reader
	In fact, it identifies the format independently for each line,
	and so will accept input that mixes formats.  I'm not sure if this
	permissiveness is a bug or feature, but it was easier to write and
	is easier to use this way.

xwrite.c, xwrite.h - format-independent hex file writer

Complete programs:

xreloc - merge, relocate, and reformat hex files
	Concatenates one or more hex files
	The format of each input file is determined automaticly
	Optionally adds an offset to all addresses in all files
	Writes the output in any supported format

bin2hex - convert raw binary file to hex format
	Can write in any supported hex format
	On the to do list: Read a.out format directly, handle sieve function
	and do byte/word swapping.

The remaining programs are left over from an old project, and probably
aren't of much use any more.

sum32 - quick hack to compute 32-bit checksum over an a file after skipping
	the header.  Header length is compiled in; edit to match size of
	a.out header on your system.

sieve - quick hack to split binary file in half for burning two 16-bit-wide
	EPROMs for a 32-bit system. 

Examples:
	prom.makefile - makefile we used on an old project for generating
	bootstrap rom srecord files for an embedded SPARC system.
	Edited somewhat for clarity. 
	romchksum.c - used to put the checksum in the rom.

Installation notes:
	ANSI C Only.
	Tested on HP-UX, Sun4, Amiga, and Linux systems with 
	gcc versions including 2.3.3, 2.8, and 2.95.2
	Just type "make".  

Please let me know about any improvements or bug fixes.

Ideas and code fragments were borrowed from software posted to the net; see
comments in appropriate files.  To the best of my knowledge the works from
which I borrowed code were placed in the public domain by their authors.
This package is in the public domain.  I would appreciate credit if you use
this code or large parts of it in any derived works.

-Steve
tell@cs.unc.edu


TODO list:

Rename "xreloc" and "xmap" to hexreloc and hexmap, etc.  program names
starting with x seem to suggest the X window system a little to
closely, leading to confusion.

Configure and build with autoconf+automake

build and install a link-time library for xread, xwrite routines

get rid of static variables in xread.c and xwrite.c, and generalize so
that multiple streams can be open at a time.  Open routines would
return a handle for the stream that is then passed to the other routines.

Add more generic handling of multi-byte data words.  Here's an idea on
how to do that.  In the reader routines, allow specifying a data block
size, and always return exactly one word.  This is often what programs
want to see anyway.  Typicaly this block size will be one, two, four
or eight bytes, corresponding to the machine word size of the final
destination memory system.  Provide for general byte reordering and
byte selection on these blocks.  Writer routines should be able to
take in similar block-sized chunks at a time.  In xreloc, the input
and output block sizes would usually be the same unless byte selction
is going on.


