Maximum stack size needed for a C program on MSP430 -
in c program doesn't use recursion, should possible in theory work out maximum/worst case stack size needed call given function, , calls. there free, open source tools can this, either source code or compiled elf files?
alternatively, there way extract function's stack frame size elf file, can try work out manually?
i'm compiling msp430 using mspgcc 3.2.3 (i know it's old version, have use in case). stack space allocate set in source code, , should small possible rest of memory can used other things. have read need take account of stack space used interrupts, system i'm using takes account of - i'm trying work out how space add on top of that. also, i've read function pointers make difficult. in few places function pointers used here, know functions can call, take account of these cases manually if stack space needed called functions , calling functions known.
static analysis seems more robust option stack painting @ runtime, working out @ runtime option if there's no way statically.
edit:
i found gcc's -fstack-usage
flag, saves frame size each function compiled. unfortunately, mspgcc doesn't support it. useful trying similar on different platform.
while static analysis best method determining maximum stack usage may have resort experimental method. method cannot guarantee absolute maximum can provide idea of stack usage.
you can check linker script location of __stack_end , __stack_size. can use these fill stack space recognizable pattern 0xdead or 0xaa55. run code through torture test try , make sure many interrupts generated possible.
after test can examine stack space see how of stack overwritten.
Comments
Post a Comment