views:

81

answers:

3

I am developing code in the MPLAB IDE and I was wondering if it is better to program a chip using the .COFF or .HEX file generated by the compiler. I'm not sure what the difference is between the two and I am assuming they will both perform the same job.

A: 

COFF is binary (as far as I know), where as HEX is ASCII. Once the device is programmed, there is no difference (the binary contents of the PIC should be identical among the two). I think a lot of 3rd party programmers (devices) only support HEX-files, which therefore often is what I use.

S.C. Madsen
+4  A: 

A COFF will typically contain debugging information (line numbers, symbols, etc.) that is useful when running the code in the IDE. The .hex format just contains the program's binary data, and is what you'd typically use to program the microcontrollers for production.

IIRC, you debug a Microchip controller by burning the code to flash, then using the ICD to step through your code, set breakpoints, etc., so either COFF or HEX will suffice. But with COFF, you have the link back to the source code that will make the debugging process much, much easier.

Niall C.
+2  A: 

Either can be used to program the chip. The HEX file contains machine code. The COFF file contains the machine code as well but also carries information useful for debugging such as symbol names, line numbers, etc.

semaj