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-2.5.0/A2F/fdpichdr/). Activate the cross-build environment
(. ./ACTIVATE.sh) before using it:

[email protected]:~$ cd linux-cortexm-2.5.0 [email protected]:linux-cortexm-2.5.0$ . ./ACTIVATE.sh [email protected]:linux-cortexm-2.5.0$ 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:

[email protected]:linux-cortexm-2.5.0$ cd projects/rootfs [email protected]: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 [email protected]:~$