View previous topic :: View next topic |
Author |
Message |
dpaul
Joined: 15 Mar 2005 Posts: 12
|
Embedding build numbers |
Posted: Tue Mar 15, 2005 1:57 pm |
|
|
Greeting:
Is there a convenient way to embed a build or version number in a Hex file and retrieve it? I'm having trouble keeping track of what code is where in several development platforms. I have found how to retrieve the program hex file with the ICD Control Program V2.12, but I am not sure if there is an approved manner to handle such information within these files.
Thanks for your thoughts,
Doug |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
|
Excellent tip |
Posted: Wed Mar 16, 2005 2:50 am |
|
|
Excellent tips. Thanks! |
|
|
dpaul
Joined: 15 Mar 2005 Posts: 12
|
HEX file format for Orged Value |
Posted: Wed Mar 16, 2005 7:55 am |
|
|
Orging a string or a value is an excellent idea. I still need some help deciphering the .HEX file format so I can read the embedded identifier.
Here�s a test: I defined the following easily locatable array:
#org 0x1FD0, 0x1FDF
const char BuildNumber [] =
{
0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07
};
Examining the very short .HEX file in my test program, I can pick out the following record which has my BuildNumber data in it.
:103FA0008207003401340234033404340534063407
Can anyone tell me what the record format is in the .HEX file? This record was locatable because the test program was very short (only a dozen lines in the .HEX file), and the array values known. Obviously finding the BuildNumber record would be much more daunting in a real program. This record, surprisingly, was in the middle of the .HEX file despite being Orged at the end of memory. I would have thought/hoped the #org statement would have physically located it at the end of the .HEX file making it easy to manually pick out, but obviously that was only a guess, and a wrong one at that.
Again, thanks for any help.
Doug |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Wed Mar 16, 2005 2:11 pm |
|
|
I use printf(__DATE__ __TIME__) |
|
|
LomasS Guest
|
|
Posted: Wed Mar 16, 2005 4:17 pm |
|
|
The .Hex file format is an Intel hex file, characterised by the initial ':' search the internet for 'Intel Hex File Format' or similar for lots of descriptions.
Steve. |
|
|
RossJ
Joined: 25 Aug 2004 Posts: 66
|
|
Posted: Wed Mar 16, 2005 5:48 pm |
|
|
The reason why you are seeing 34s in there is because of the way CCS C implements const arrays. 0x34 is the upper byte of the return with literal in W instruction (on a 16 series PIC). If all you want is to see the raw hex bytes, try the #rom directive instead of a const array. |
|
|
|