This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Hitachi HD6303 target
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: tm <tm at mail dot kloo dot net>
- Cc: john dot carter at tait dot co dot nz, gcc at gcc dot gnu dot org
- Date: Sat, 20 Jul 2002 09:42:25 +0100 (BST)
- Subject: Re: Hitachi HD6303 target
- References: <Pine.LNX.4.21.0207191410460.24931-100000@mail.kloo.net>
tm writes:
>
> John Carter wrote:
>
> >I have been given the opportunity to create a cross compiler to ye olde
> >16 bit Hitachi HD 6303 CPU.
>
> >It's best known incarnation is probably the Psion
> >Organizer II (although I would be using it in a weird embedded thing).
>
> >Allegedly it is similar in instruction set to the Motorola 6805
>
> >Questions to the list:
> >- Wild guess as to the number of man days to do such a thing
> >- Is there any C compiler for this thing?
> >- Is there any gcc port or partial port for this thing?
> >- Is there any gcc port or partial port for the 6805?
The 6085 is even harder. IMO the 6801 would be hard, the 6805 near
impossible. It has a 6-bit stack pointer and an 11-bit program
counter, I think.
> >- Given that this is a slow, register starved, tiny memory space (64k
> > address space) beastie, would targetting gcc to it be the right thing?
>
> You would probably emulate a machine with general-purpose registers
> and emit multiple native instructions to move stuff in/out of the
> emulated gp registers.
The 6303 (a 6801 variant IIRC) has a fairly small memory space, and
the instruction set is such that the code to spill a variable to a
stack slot will be long. Better make sure you have a huge number of
virtual registers to make that never happens. It's possible that
you'd run out of memory quite quickly with moderately complex program.
Instead, it's a good idea to create an interpreter that can
efficiently be implemented on a 6801 and then do a gcc back end for
that. Profile a few applications, and then tweak the architecture of
the virtual machine as necessary.
> >- Would it be easier retarget a forth implementation?
>
> Probably a factor of two to four easier IMHO to do a Forth implementation.
Probably, and on such a beast it's an easier way to get things done.
You have to think about a debugger, don't forget...
Andrew.