This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: code optimizations


On Thu, Aug 23, 2001 at 10:08:03AM -0600, Gary Thomas wrote:

> Why?  I don't see any advantage - in fact there could be major
> code generation/optimization disadvantages.  Having the actual
> addresses in header files (the eCos custom) also provides an
> additional level of documentation, however bleak.

I agree that it's easier for most people to find the addresses
when they're in a header file.

It's mostly a philosphical thing I have stuck in my head about
at what stage in the build addresses get assigned.  I think
that should happen at the link stage. If you assign addresses
to peripherals in the linker file (where the reset of the
memory addresses are defined), then all of the memory layout is
defined in a single place.  I've always thought that a nice
thing.

There aren't many other benefits, though. 

Having the debugger know the addresses of peripherals is nice
sometimes.

And there was that one time a many years ago when I was
maintaining a common set of code for two platforms. By
assigning peripheral addresses in the linker, I could avoid
re-compiling source files and only have to link twice to
support two platforms.  That was sort of an odd case, though.

> Note: I doubt that you'll find any addresses in actual code, but
> rather in header files which can be easily manipulated allowing
> for the additional flexibility I feel you seek.

Right -- by "source code" I meant the header files.

-- 
Grant Edwards
grante@visi.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]