Setting the Stack Size for a User-Space Application Print


This application note explains how to set up the stack size for a user-space application.

The stack size can be changed using the fdpichdr utility. This utility is provided as a part of the Emcraft distribution (linux-cortexm-<target>-<release>/A2F/fdpichdr/). Activate the cross-build environment (. ./ before using it:

$ cd linux-cortexm-<target>-<release> $ . ./ $ fdpichdr --help Usage: fdpichdr [options] <elfs> Options: -[s:vqhV] -s, --stack-size <size> * Set the stack size -v, --verbose * Make a lot of noise -q, --quiet * Only show errors -h, --help * Print this help and exit -V, --version * Print version and exit

Let's for example set the stack size of the lcdtest application to 32KB:

$ cd projects/rootfs fdpichdr -vs $((32 * 1024)) lcdtest/lcdtest lcdtest/lcdtest: setting stack size to 32768 (0x8000) skipping program header 0x70000001 skipping program header 0x6 skipping program header 0x3 skipping program header 0x1 skipping program header 0x1 skipping program header 0x2 Found PT_GNU_STACK; changing value 0x8000 -> 0x8000 $