3.2.2 Postprocessing the Intel Hex file
Keywords: sdccman

##
3.2.2 Postprocessing the Intel Hex file

In most cases this won't be needed but the Intel Hex file which is generated by SDCC might include lines of varying length and the addresses within the file are not guaranteed to be strictly ascending. If your toolchain or a bootloader does not like this you can use the tool packihx which is part of the SDCC distribution:
packihx sourcefile.ihx >sourcefile.hex
The separately available srecord package additionally allows to set undefined locations to a predefined value, to insert checksums of various flavours (crc, add, xor) and to perform other manipulations (convert, split, crop, offset, ...).
srec_cat sourcefile.ihx -intel -o sourcefile.hex -intel
An example for a more complex command line3.1 could look like:
srec_cat sourcefile.ihx -intel -fill 0x12 0x0000 0xfffe -little-endian-checksum-negative 0xfffe 0x02 0x02 -o sourcefile.hex -intel
The srecord package is available at `http://sourceforge.net/projects/srecord/`.