Page 1 of 1

Ehancing stack for a core?

Posted: Wed Apr 20, 2011 1:10 pm
by Interactive_Matter
Hi,

If I install my code how I want to install it on my XMOS the linker denies to link it. It says that there is not enough stack available on one core. I do not know if the memory is completely filled up on that core.

Is it possible to increase the stack space (at the cost of variable space)?

Thanks

Marcus

Re: Ehancing stack for a core?

Posted: Wed Apr 20, 2011 2:50 pm
by m_y
The stack space isn't of fixed size. Starting from the lowest memory address and working upwards there is text (code), initialised data, bss (uninitialised data), heap (malloc-able memory) and finally stack (which value abuts the highest usable address in memory).

The size of text, data and bss are dependent only on what's declared in your program. The stack size is the maximum your program will ever use, as derived from a static analysis. The heap size is whatever's left between the top end of bss and the bottom of the stack space.

The linker error you're seeing is because text, data, bss and stack won't all fit in 64KB. The only way to make them fit is to make at least one of them smaller.

Re: Ehancing stack for a core?

Posted: Wed Apr 20, 2011 4:45 pm
by Folknology
Xmap should break it down for you so you can see where the resources are being used up - tools guide 13.6, use -report option


Then you can choose to reduce the memory usage or move stuff to other cores and use channels to share data between them.

regards
Al

Re: Ehancing stack for a core?

Posted: Wed Apr 20, 2011 5:02 pm
by m_y
If you're looking for a breakdown of memory usage when something is too big to fit then the linker's --map option is also a good bet.

To use, add this to the compile line: "-Xmapper --map -Xmapper mapfile". After a link (even a failed link) you get a file called "mapfile" which contains lots of information about what function and data are are on each core and how much space each uses.

Re: Ehancing stack for a core?

Posted: Wed Apr 20, 2011 6:07 pm
by Interactive_Matter
That is what I expected - but not wanted - to hear ;)
It is just too much data on that poor core. Will solve the problem with shifting processes to other cores

But thanks for your help - especially analyzing it is very helpful!

Re: Ehancing stack for a core?

Posted: Tue Nov 14, 2017 11:20 am
by robertxmos
> Will solve the problem with shifting processes to other cores
... on other tiles.
The memory is per tile, so pick a core on another tile... assuming you have more than one tile (8 cores).