gnupic: Re: [gnupic] What About GCC and PIC's
Subject:
Re: [gnupic] What About GCC and PIC's
From:
Daniel Serpell ####@####.####
Date:
23 Apr 2005 00:04:01 +0100
Message-Id: <20050422230342.GB7337@aplik.cl>
Hi!
El Mon, Apr 18, 2005 at 02:15:46PM -0500, Martin McCormick escribio:
> I know that GCC can be compiled as a cross-compiler if one
> needs to do such things. Has anyone tried to adapt gcc and gdb to
> handle PIC's?
Well, I tried that in the gcc-2.95 times (about 5 years ago, I think),
and it didn't work well.
Problem is, GCC expect a somewhat big number of registers, so I tried
using some memory locations as register. But then, generated code
was not very good, because all arithmetical operation had to go
through the W register, giving a lot of copies.
Then, I tried mapping the W register as a normal register, and the
FSR as an index register. This actually produced some code, but
any decent amount of C code gave a GCC internal compiler error
(not enough register for reload). And function calls were really
bad, because PIC's don't have a real stack, so GCC had to keep
a register as stack and reload variables at each call.
I then realized that C is not a good language to program a
microcontroller, I think that people use C in this environment only
because they have previous knowledge of the language.
Daniel.