We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Greetings:
Is anyone aware if the Keil environment can embed comments is its HEX file output?
Embedding notes (title, version, copy-write, etc.) in HEX file output has proven helpful in my plethora of CCS PIC development.
We now have developed a program to load, via ULINK, sections of an ARM flash with customer specific data. It would obviously be helpful for this program to be reasonably sure the HEX file it is directed to load is of the proper type. Embedding an ID within the file would be a convenient means to prevent (well, minimize...) mistakes. True, one could manually edit an ID in the Keil HEX file output, but as I am not guaranteed to be in the future production chain, extra manual steps best be avoided.
Thanks for any comments. doug
The hex file can't contain text, since the format is designed for a boot loader, programmer or similar to download/program something into a chip. And Intel didn't see a need for coment records.
You can have your source code contain text strings like:
const char copyright[] = "Copyright (c) 2012 World Masters Inc. All Right Reserved."; const char buildinfo[] = BUILD_INFO; // where you obviously have to #define what BUILD_INFO should be. const uint32_t version = 0x010302; // Version 1.3.2 const uint32_t build = BUILD_NUM; // Build number - incremented by own script on every full build.
Obviously, you can't see this information in the hex file. But a binary editor that supports loading of Intel Hex files will show the information.
If you want to, you can even play with the linker, to force the information to be located to a specific address - preferably somewhere at the end of the code region. Preferably also with a CRC-32 or similar to verify the validity of the binary.
I stand corrected: the Intel HEX file format does not include a definition of comments. The CCS compiler for PIC micros does and that's were I was a liberty to include comments to my hearts content. The device programmers we have here (QuickWriter, eeTools) are fine with the non-standard comments format but as I recall the contract manufacturer had some problems with the non-standard format. I think we'll have to just depend on the program users to feed it the proper data. What could possibly go wrong?
the Intel HEX file format does not include a definition of comments.
It does have an end-of-file record, though. A properly working input routine for hex files should ignore everything that comes after that line ... in theory, that is. So you could put your comments after the EOF record. That would still limit your choice of tools, though, or put your comments at risk of being shredded by some of those tools.
OTOH the other common hex file format, Motorola S-Record, does indeed have a comment record. Well, sort of. The data bytes in the S0 record are effectively free for you to use as a comment. That's not terribly much, but it may suffice.