Hello
I assume you are building in banked memory model. I did some quick smoke test locally.
If you want to use far Heap you need to do the following:
1- edit the file {Install}\lib\hc12c\include\libdefs.h
2-Go to line 180 and change
#define LIBDEF_FAR_HEAP_DATA 0
into
#define LIBDEF_FAR_HEAP_DATA 1
3- On line 193, adjust LIBDEF_HEAPSIZE to the desired size.
4- If you intend to use dynamically allocated data into other ANSI C functions you need to adjust also
macros LIBDEF_FAR_CONST_STRINGS, LIBDEF_FAR_STRINGS,
LIBDEF_FAR_CONST_VOID_PTR, LIBDEF_FAR_VOID_PTR.
5- There is an issue in the delivered alloc.c source file.
Edit the file alloc.c and change it as follows:
Change line 84 from:
free_ptr = (header *) &_heap_[0];
to
free_ptr = (header *LIBDEF_HEAP_DPTRQ) &_heap_[0];
6- Rebuild the libraries
7- In your .prm file define a global memory area to store your heap. If you need 28000 bytes of heap,
then the paged RAM area should be defined as
GLOBAL_RAM = NO_INIT 0xF8000'G TO 0xFEFFF'G;
and the RAM memory area should be redefined as
RAM = READ_WRITE 0x3000 TO 0x3FFF;
I would define the big paged memory area as NO_INIT so it will not be initialized at Startup.
RAM memory area needs to be adjusted because address 0xFE000'G is the same as 0x2000'L.
So I defined a smaller RAM area to avoid overlap.
8- place HEAP_SEGMENT in GLOBAL_RAM in your .prm file
That should be it.
I will report the issue with the wrong code in alloc.c to engineering for a fix in a future release of the
library.
CrasyCat