Ehancing stack for a core?

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
Interactive_Matter
XCore Addict
Posts: 216
Joined: Wed Feb 10, 2010 10:26 am
Contact:

Ehancing stack for a core?

Post 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


m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Post 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.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post 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
Last edited by Folknology on Wed Apr 20, 2011 5:04 pm, edited 1 time in total.
m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Post 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.
User avatar
Interactive_Matter
XCore Addict
Posts: 216
Joined: Wed Feb 10, 2010 10:26 am
Contact:

Post 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!
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Post 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).
Post Reply