next up previous contents index
Next: 3.1.3 Projects with Multiple Up: 3.1 Compiling Previous: 3.1.1 Single Source File   Contents   Index


3.1.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://sf.net/projects/srecord .



2008-12-05