I had a similar problem with a bootloader programmer. However I wrote a script in Lua to read the hex file and actually convert into C.
Since you say you want to imbed the hex into code, that might suit you.
http://www.gammon.com.au/forum/?id=11635Converted output looks like this:
byte PROGMEM ATmegaBOOT_168_atmega1280_hex [] = {
0x0C, 0x94, 0x72, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8,
0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8,
0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8,
0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8, 0x0C, 0x94, 0x92, 0xF8,
So the code on the device doesn't need to understand how to read .hex files, that's done during the conversion phase.
If you don't want to use that they may be an option to avrdump that reads a hex file and outputs it again in a different format.
Or you could write a small C program to do it. Bear in mind each line has a sumcheck on it.