This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am compiling my code with the LARGE_MODEL option defined and linking it with rts2800_ml.lib.
It is my understanding that in doing so, I do not explicitly use to declare pointers etc. as far or use the far_ versions of library calls such as malloc(), in order to create objects on the far heap.
I noticed, however, that malloc() returns 0 as soon as the near heap (which is very small indeed) is exhausted. Must I still use the far_-versions of the library calls explicitly? Or is there anything else I am doing wrong? My relevant linker options are:
-farheap0x020000 -f0x0 -heap0x2000 -stack0x4000 --disable_auto_rts -w -l"rts2800_ml.lib"
My linker command file looks like this:
MEMORY
{
PAGE 0 : /* Program Memory */
/* Flash as one big segment */
FLASH : origin = 0x300000, length = 0x040000
PAGE 1 : /* Data Memory */
/* Internal SARAM */
RAM_0 : origin = 0x000000, length = 0x002000 /* was 0x002000 *
/* 0x2000 to 0x3FFF: Not defined */
STACK : origin = 0x004000, length = 0x004000 /* stack needs own segment in low RAM */
RAM_1 : origin = 0x008000, length = 0x008000
/* External memory */
EMEM : origin = 0x100000, length = 0x025000 /* was 0x030000 */
}
SECTIONS
{
/* segment allocation */
.cinit : > FLASH, PAGE = 0 /* initialized internal RAM-data */
.pinit : > FLASH, PAGE = 0 /* initialized constructors */
.stack : > STACK, PAGE = 1
.text : > FLASH, PAGE = 0
.bss : > RAM_0, PAGE = 1
.ebss : > RAM_1, FILL = 0x0020, PAGE = 1 /* uninitialized external RAM-data */
.econst : > FLASH, PAGE = 0
.esysmem : > EMEM, PAGE = 1 /* not used if no malloc calls in code */
.cio : > RAM_0, PAGE = 1
.sysmem : > RAM_1, PAGE = 1
/* keep the linker from complaining */
.reset : > FLASH, PAGE = 0, TYPE = DSECT /* not used */
}
Any help would be greatly appreciated.
NOTE: My code (CppUTest unit test framework library) is calling malloc() from a cplusplus source. That leaves an ambiguity, as according to spru514e, the C++ compiler provides far intrinsics, and does not recognize the far keyword, but malloc() is a C function and as such, I probably should be calling far_malloc() instead. However, this leads to errors, because "far" is used in function prototypes:
"UtestPlatform.cpp", line 255: error #121: return value type does not match the function type