[ECOS] How to create a new platform?
Grant Edwards
grante@visi.com
Thu Feb 17 11:05:00 GMT 2000
On Thu, Feb 17, 2000 at 06:35:44PM +0000, Jonathan Larmour wrote:
> > > If this is actually a define, ie. #define UARTBASE ((UartType *)0x3604000)
> > > then it would be very bad if gcc could not optimize "UARTBASE->foo" to be a
> > > direct access to a single memory address, rather than having to do the
> > > addition.
> >
> > Most compilers will do that (and I'm pretty sure gcc does).
> > But since the ARM can't directly access memory in a general
> > way, the code generated ends up being pointer operations
> > anyway, so for me I think it turns out to be a moot point.
>
> But surely this is no worse than specifying it in a linker script?
You're right. Using ((UartType*)0x3604000)->foo should
generate the same code as the extern/linker-command method. I
was thinking of the case where a pointer variable is declared
and initialized with the constant value.
Back when I first started doing embedded stuff using a HLL it
was in Pascal, and the extern/linker-command method was easier
than convincing the compiler to access arbitrary addresses in
memory. It also made writing test stubs/drivers much easier,
since you didn't have to re-compile the module, just link to
the test harness. I've been doing it that way ever since.
--
Grant Edwards
grante@visi.com
More information about the Ecos-discuss
mailing list