gnupic: Re: [gnupic] gpdasm 0.13.6 alpha question
Subject:
Re: [gnupic] gpdasm 0.13.6 alpha question
From:
Rob Pearce ####@####.####
Date:
12 Mar 2009 09:18:49 -0000
Message-Id: <200903120917.47096.rob@bdt-home.demon.co.uk>
On Thursday 12 March 2009, Peter Keller wrote:
>
> I just noticed something else too, suppose the addresses were right, and it
> looked like this:
>
> 300000: 0804 sublw 0x4
> 300002: 1e38 comf 0x38, 0x1, 0
>
> I would read that (from left to right) as being:
>
> 300000: 08
> 300001: 04
> 300002: 1e
> 300003: 38
>
No, that would be a wrong reading. The PIC is little-endian, so the byte at
0x300000 is the lower byte of the word.
> But, as far as I can determine, there seems to be an endian swap, and it
> really should look like this:
>
> 300000: 0408
> 300002: 381e
>
> leading to:
>
> 300000: 04
> 300001: 08
> 300002: 38
> 300003: 1e
>
No, you're still parsing that as big-endian. The first listing, where the WORD
at 0x300000 is 0804, matches your last listing where the BYTE at 0x300000 is
04. This is just how the PIC works. That's why the byte at 0x300002 is called
CONFIG2L and the one at 0x300003 is CONFIG2H.
>
> How would one make gdasm and gpvo smarter to actually print out the
> configuration bits is a much more human readable manner?
>
They're doing the right thing for what they're intended to do. The
instructions interpreted by gpdasm are all word values stored in the flash
LSB first.
>
> Could I get a bit more clarification on where the EEPROM addresses are on
> PICs in general? It seems a hard thing to pin down.
>
That's not an entirely meaningful question - the EEPROM is in a separate
address space. It's a bit like asking where 38 South Road is on High Street -
it isn't, it's somewhere else. Since the HEX file format doesn't allow for
multiple address spaces, MicroChip decided on a convention (or several
different conventions, in fact) for mapping the EEPROM address space into
out-of-range normal address space so that programmers can load it. These
conventions are therefore programmer related rather than device related. You
can usually find them in a comment in the "In Circuit Serial Programming"
guide for the family. The 0xF00000 address is used for most (all?) 18F
devices, while 0x2100 is generally used for mid-range (16F) devices (but note
that mid-range devices use word addressing).
Cheers,
Rob