AnsweredAssumed Answered

heap and stack size

Question asked by PO220 on May 13, 2016
Latest reply on May 19, 2016 by ZhangJennie



I try to understand HEAP_SIZE  and STACK_SIZE in .ld file


In this file KDS find the RAM size  : 0x8000 for my KL17Z256VLH4 ; why should we specify KDS the size of stack and head ?


>> Why compiler and linker can not work with just the RAM size ? (to optimize its use)


>> Is there a risk in defining stack and heap to the maximum RAM size ? if so, what is the mistake ?


/*for my KL17Z256*/

HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x8000; /* defaut  0x0400*/

STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x8000; /* defaut 0x0400*/


/* 0x8000 = RAM size */


I use Freertos (with en other heap specification : configTOTAL_HEAP_SIZE)


Thank you in advance for your explanations