Forums

Re: What address format for 9S12X?

Started by linktek May 31, 2008
It looks like Metrowerks lowered the price of their development tools it seems to be going for $1000-00....is that correct??

----- Original Message -----
From: John Hartman (NoICE)
To: 6...
Sent: Friday, May 30, 2008 5:12 PM
Subject: Re: [68HC12] What address format for 9S12X?
At 05:31 PM 5/30/08, you wrote:
>The draft v3.0 of the m8-16eabi ABI does support both banked and global
>addresses,
>and as far as I know both Cosmic and Metrowerks are following it.

Thanks. Any idea where I can get a copy of the 3.0 draft? Search
for m8-16eabi on freescale.com turns up nothing, and Google finds
only the 2.0 version that I have.

Decoding is no big deal - if there is something to tell me what
format to use. At least in Cosmic's case the elf file's e_machine is
just plain HC12 (53.)

>BTW: How does GCC12 encode addresses?

Here is my code for DECODING 32-bit addresses in the elf generated by GCC12
// GCC address format
// 0-FFFF: 16-bit
// 10000 and above: subtract 0x10000 and interpret as Moto Linear
// banked address: 16K banks
UINT logicalAddress = (theAddress & 0x3FFF) | 0x8000;
UINT page = (theAddress - 0x10000) / 0x4000;

GCC12 also uses different numbers for registers:
"X", // 0
"D", // 1
"Y", // 2
"SP", // 3
"PC", // 4
"A", // 5
"B", // 6
"CC", // 7
"Y", // 8
"FP", // 9 GCC generates this as frame pointer
NULL, // 10 TMP soft register
NULL, // 11 Z soft register
NULL // 12 XY soft register

Versus eabi
"A", // 0
"B", // 1
"D", // 3
"X", // 7
"Y", // 8
"SP", // 15
"PC", // 16
"CC" // 17

>John Hartman (NoICE) wrote:
> > Does anyone know how 9S12X addresses appear in elf/dwarf
> > files? Banked? Global?
> >
> > Long ago, Motorola recommended the use of "linear" address format in
> > S2 records for the HC12. Then they bought Metrowerks, who used
> > "banked" format and quitely stopped talking about it...
> >
> > In IEEE-695 and Elf/dwarf format, almost everyone has used the
> > "banked" format. So an address in an elf file like 0x1289AB would be
> > PPAGE, logical addressAB. That is what is specified in the
> > EABI (GCC12 followed a different format for address and register
> > numbers, but that is a different thread)
> >
> > OK - now comes the 9S12X. One certainly COULD use the same formats -
> > linear or banked, and be compatible with existing debuggers and
> > tools. That would seem like a good thing.
> >
> > OR one could use the global addresses. It appears that Cosmic has
> > done that. Are they alone, or part of the mainstream?
> >
> > Best regards, John Hartman
> > NoICE Debugging Tools
> > http://www.noicedebugger.com
> >
> >
> >
> >
> >
> >
> >
> >