View previous topic :: View next topic |
Author |
Message |
DrDoug
Joined: 22 Feb 2012 Posts: 4
|
problem with #ID and hex file |
Posted: Wed Feb 22, 2012 2:10 am |
|
|
I am writing code for a PIC18F458, using compiler PCH 4.005 (running under Microchip IDE v8.46).
Ok, so I'm trying to use the #ID command to load some data. Easy enough. In my code I have something like:
But here's the final few lines from the generated hex file:
Code: | :020000040030CA
:0E00000000220C0F000081000FC00FE00F4027
:020000040000FA
:082000000A000B000C000D00AA
:00000001FF
;PIC18F458 |
Ok, first line jumps to far address 0x30 0000, and the second line programs my configuration bits. Good so far. Now for the ID bytes...
Third line...jumps back to 0x00 0000. Fourth line, stores my ID values at address 0x00 2000.
Um...am I missing something? Shouldn't the ID values be shoved into address 0x20 0000? I did some searching on the board for any other mention of this and didn't find one, so maybe I'm just reading this wrong(?).
(Actually I also tried this with the PIC18 compiler under MPLABX, and the hex file does indeed put the ID data at 0x20 0000. Whacky.)
Has this issue been found/addressed before? Is there a work-around (other than editing the hex file outside of the compiler)? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Wed Feb 22, 2012 3:26 am |
|
|
You are reading it wrong.
Look up extended Intel Hex addressing.
An address _offset_ is being applied. The line addresses are not absolute.
However I'd not hold much hope of being able to get code to work with 4.005. This was an 'alpha' release version at best. Several dozens of versions before the first V4 compiler that has a chance of generating any reasonable code...
Best Wishes |
|
|
DrDoug
Joined: 22 Feb 2012 Posts: 4
|
|
Posted: Wed Feb 22, 2012 10:59 am |
|
|
Hmmm. I actually don't see how I'm reading this wrong. Sure, the line addresses are offsets; they're offsets from the previous extended address command. ID locations start at 0x20 0000. This code is trying to put the ID data at 0x00 2000. The hex file is just plain wrong.
But, since you mentioned it, I did realize I was not using my latest compiler version (v4.005 was located at c:\program files\PICC, but I have v4.090 installed under ...\Microchip\Third party\PICC). I recompiled under v4.090, and now the hex file is generated correctly. Heh, gotta watch those toolsuite paths.
Thanks for the help. |
|
|
|