gnupic: HEX file output & more
Subject:
Re: HEX file output & more
From:
####@####.#### (Byron A Jeff)
Date:
29 Sep 2002 23:44:01 -0000
Message-Id: <200209292341.g8TNfem23513@cleon.cc.gatech.edu>
>
> I'm having lots of trouble with my development process,
Sorry to hear that.
>but I've noticed one part that I'd like to get answered here.
I'll help if I can.
>
> When gpasm outputs the hex file for the following code:
>
> 0000 00083 org 0x000
> 0000 2821 00084 goto Start
> 00085
> 0004 00090 org 0x004
> 0004 00A1 M movwf WBuffer
> 0005 0EA1 M swapf WBuffer,F
> 0006 0E03 M swapf STATUS,W
> 0007 00A0 M movwf StatBuffer
> 00091 push
> 0008 2053 00092 call ServiceInterrupts
> 0009 0E20 M swapf StatBuffer,W
> 000A 0083 M movwf STATUS
> 000B 0E21 M swapf WBuffer,W
> 00093 pop
> 000C 0009 00094 retfie
Typical.
>
> I get the following from the hex file (formatted for readability):
>
> :02 0000 00 2128 B5
> :08 0008 00 A100 A10E 030E A000 EF
> :10 0010 00 5320 200E 8300 210E 0900 0739 8207 0034 87
Also typical.
>
> Notice that the code at org 0x004 ends up at offset 0x0008 in the hex file.
> Interestingly, when I load this file into the Warp-13 programmer driver, it
> shows the code in the proper place (not sure how it figures that out).
>
> Is this correct?
It is.
> It seems to me that it's not.
It is! ;-)
> Scott (or anyone else), any ideas?
It's simple. The hex file is addressed by bytes while the list file and the PIC
are addressed by words (12-16 bits depending on the particular chip). In short
each PIC instruction occupies 2 bytes of the hex file. Therefore the addresses
of the hex file are always doubled.
The programmer software displays the instruction addresses.
So this is one less thing to worry about. Most of us don't simply because once
you get going to pay no attention to the hext file.
Hope this helps,
BAJ