AnsweredAssumed Answered

How set the correct stack and heap size ?

Question asked by samuel boivineau on Feb 16, 2017
Latest reply on Feb 16, 2017 by Daniel Chen



I am writing a multi-task app, using MQX and a K64. I am currently facing at some time a MQX_OUT_OF_MEMORY error, so I have used TAD, and I have some idea which task stack to increase or decrease. My question is about the linker, I see this line :

 -Xlinker --defsym=__stack_size__=0x400  -Xlinker --defsym=__heap_size__=0x5000 (changed by me)

and it seems the task stack is taken from the heap. So if do the math and add all the task stacks I use, I get about 0x9d00.


- Do I must understand I was very lucky and this overflow wasn't doing anything bad to me for the moment ? I should then set the heap size to 0x10000 for example ?

- The K64 I use has got 256KB of RAM. Which size maximum can I use for the heap ?

- the (real) stack (size 0x400) is used by all the stuff outside MQX and its tasks ? (startup.c etc)


Thanks for your help !