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:
yur@ubuntu:~$ cd linux-cortexm-2.5.0
yur@ubuntu:linux-cortexm-2.5.0$ . ./ACTIVATE.sh
yur@ubuntu: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:
yur@ubuntu:linux-cortexm-2.5.0$ cd projects/rootfs
yur@ubuntu: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
yur@ubuntu:~$