[cc65] HEAP from here to there

From: Thomas Giesel <skoe1directbox.com>
Date: 2009-05-26 23:27:27
All,

When customizing the linker configuration for a C64 program I found a
strange behaviour (latest snapshot).

The intended configuration:

------------------
$1000
..      CODE, DATA
..      BSS
------------------
$8000
..      (keep free)
------------------
$C000
..      HEAP/Stack
------------------
$D000
..      (keep free)

Alternatively HEAP/Stack and BSS can be swapped. This neither doesn't
work.

Snippets from my ld.cfg:
....
    RAM:    start = $1000, size = $7000, file = %O, define = yes;
    HIRAM:  start = $C000, size = $1000, define = yes;
....
    BSS:      load =   RAM, type = bss, define = yes;
    HEAP:     load = HIRAM, type = bss, optional = yes;

With this my program gives me lot's of malloc (17 kByte and more) which
are behind $8000.

A look into _heap.s makes me think that the heap if from the end of BSS
to the beginning of the stack. Shouldn't the segment HEAP used for
the start of the heap?

Is "HEAP: ... define=yes" and replacing "__BSS_START__ + __BSS_SIZE___"
with "__HEAP_START__" in _heap.s the right fix?

Regards

Thomas

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue May 26 23:27:37 2009

This archive was generated by hypermail 2.1.8 : 2009-05-26 23:27:40 CEST