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 (${INSTALL_ROOT}/tools/bin/fdpichdr). Activate the cross-build environment
(. ./ACTIVATE.sh) before using it:

$ cd <path_to_distribution> $ . ./ACTIVATE.sh $ 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 0x1 skipping program header 0x1 Found PT_GNU_STACK; changing value 0x2000 -> 0x8000 skipping program header 0x6 $