Reputation: 1061
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.
Upvotes: 2
Views: 3615
Reputation: 705
It is better to program with COFF if using the IDE, and save the HEX for commits. Since the HEX file is ascii, it can be checked into source code control and diffed easily. With microchip PICs, it's easy (well.. yes) to verify fuse settings for example by checking the HEX file, so if different versions of the .asm or .c set fuses differently, a simple diff of HEX will reveal the change.
Upvotes: 1
Reputation: 10918
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.
Upvotes: 5
Reputation: 1575
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.
Upvotes: 2
Reputation: 5236
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.
Upvotes: 0