Re: [cc65] linker cfg files

Date view Thread view Subject view

From: Greg King (gngking_at_erols.com)
Date: 2003-04-24 13:35:26


From: Ullrich von Bassewitz
Date: Wednesday, April 23, 2003, 06:01 PM
>
> On Wednesday, 23 April 2003, 00:24, Shawn Jefferson wrote:
> > I would like to see configurable heap- and stack-placement, too.
>
> I've used the traditional approach for the memory layout,
> CODE, DATA, BSS, (heap,) and STACK, in that order.  While this works for
> architectures with one big chunk of memory, it gets somewhat difficult,
> when there are several blocks of memory.
>
> Unfortunately, I don't have an idea for a solution that is
> 1. easy to handle, and
> 2. easy to implement.
> Allowing to define stack and heap in the linker config. would
> work, but this would need a complete expression-evaluation for the
> linker, so it is not exactly what I would call "easy to implement".
> As it looks now, you will have to live with the existing linker
> and code, provided that no one has a better suggestion.

Actually, the stack and the heap already are configured by the linker's
script!  The stack is put at the top of the RAM memory-area.  The script
controls where that place is.  And, the script controls how big that stack
is allowwed to grow.  The heap is put just below the stack.  If you change
the "RAM:" and "__STACKSIZE__" lines in the script, then you move the
stack and the top boundary of the heap.

You just need to expand that idea, when you design the libraries for
machines that have separated blocks of memory.  Give the stack and the
heap their own "STACK:" and "HEAP:" memory-area definitions.  Change which
linker-defined names "crt0.s" and "_heap.s" use to learn where the stack
and heap should sit (__STACK_START__ and __STACK_SIZE__ instead of
__RAM_START__ and __RAM_SIZE__, for example).

The targets will need different "_heap.s" files.  (I still prefer my more
efficient proposal:
* one common source-file, for most targets;
* "special" targets would replace it with their custom versions when their
libraries were built.)

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-04-24 14:01:09 CEST