On Wed, 29 Mar 2023 at 01:15, Tony Pavlov via Sdcc-user <
sdcc-user@lists.sourceforge.net> wrote:

> Hello Adrian,
>
> Wednesday, March 29, 2023, 5:52:01 AM, you wrote:
>
> just implement your own __sdcc_heap_init which set __sdcc_heap_free->next
> to something like SP - <max_stack_size> instead of HEAP_END.
>

Yup, but then:

* without recompiling/linking in an alternative definition for heap.s, i'd
have a 1k wasted default heap, and
* my CP/M hacks need to know about the internals of the heap allocator,
like the struct definitions and
  such which aren't public.

I did the above hack, but I instead wrote an sdcc_heap_add() that took
another block of RAM to add
to the free list. I had to duplicate the heap header_t definition though.
If it were something in the
library then it'd be super easy to just call to add regions that aren't
fixed. (This seems to be a
semi-common question on larger RAM 8 bit targets, so it'd likely solve this
cleanly for a bunch of folks.)



-adrian
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to