Purpose
Hexmate.exe is a command line program for Windows that Microchip
publishes with it's Hi-Tech tool suite. (Microchip acquired Hi-Tech and
hexmate.exe was part of the Hi-Tech tools for a long time.) It is the
best tool for combining hex files that I have found. It is very easy to
use and does a very good job.
The UBW, UBW32 and EBB boards all use a USB based bootloader. This
allows users to update or change the firmware on the boards without
using a hardware programmer. Instead, the new firmware is transferred
over the USB from an application on the PC and then burned into Flash
on the board. This works very well and is
very easy to use, but it means that there are two separate programs
that need to be loaded onto the board's Flash - first the bootloader
and then the
actual firmware application.
These two programs are developed separately and built as separate HEX
files. Once the two HEX files have been created, there are two ways to
get these HEX files onto a board:
- Use a hardware programmer like the PICKit2 or PICKit3 to program
the
USB bootloader HEX file onto the board. Then boot the board and use the
bootloader to download and program the firmware HEX file.
- Combine the two HEX files into a single HEX file and program that
combined file onto the board using a hardware programmer like the
PICKit2 or PICKit3.
For speed's sake, the second method is used for production. Thus there
is a need to combine HEX files into one. Hexmate.exe is the right tool
for that job, this page explains how to use it.
Download
Microchip has been kind enough to grant us permission to distribute
Hexmate.exe from this website. So you can pick up a copy right here
without downloading a larger package from Microchip
- Hexmate.exe (zipped, build
1.35694) - For Windows. It's just a command line tool, so I suspect
that it runs on all Windows versions from 2000 on up.
Usage
You can do some very complicated things with hexmate, but the most
common thing to do is to combine two hex files into one. Let's say you
have a bootloader file called
boot.hex
and a firmware file called
firmware.hex.
You want an output file called
combined.hex.
So put both files in the same directory, put hexmate.exe there as well
(or put it in your path), then open a command window and navigate to
the directory. Then type:
hexmate boot.hex firmware.hex -Ocombined.hex
If there are any sections of the two hex files that overlap, hexmate
will complain and not output a file. You can either choose to fix the
problem by re-building the offending hex file, or you can ask hexmate
to use the second file's data as the 'winner' of the conflict by using
hexmate boot.hex +firmware.hex -Ocombined.hex
There are a lot of other options for hexmate.exe. For a complete list,
and for complete documentation, see section 6.6 of the HI-TECH PICC
compiler manual (called manual.pdf, installed by default to C:\Program
Files\HI-TECH Software\PICC\9.70\docs\manual.pdf).